示例#1
0
文件: los.go 项目: genbattle/haunts
func (wp *waypoint) RenderOnFloor() {
	if !wp.active {
		return
	}
	wp.drawn = true
	gl.Color4ub(200, 0, 0, 128)
	base.EnableShader("waypoint")
	base.SetUniformF("waypoint", "radius", float32(wp.Radius))

	t := float32(time.Now().UnixNano()%1e15) / 1.0e9
	base.SetUniformF("waypoint", "time", t)
	gl.Begin(gl.QUADS)
	gl.TexCoord2i(0, 1)
	gl.Vertex2i(gl.Int(wp.X-wp.Radius), gl.Int(wp.Y-wp.Radius))
	gl.TexCoord2i(0, 0)
	gl.Vertex2i(gl.Int(wp.X-wp.Radius), gl.Int(wp.Y+wp.Radius))
	gl.TexCoord2i(1, 0)
	gl.Vertex2i(gl.Int(wp.X+wp.Radius), gl.Int(wp.Y+wp.Radius))
	gl.TexCoord2i(1, 1)
	gl.Vertex2i(gl.Int(wp.X+wp.Radius), gl.Int(wp.Y-wp.Radius))
	gl.End()

	base.EnableShader("")

	// base.EnableShader("")
}
示例#2
0
func (co *colorOption) DrawInfo(x, y, dx, dy int) {
	gl.Disable(gl.TEXTURE_2D)
	gl.Color4ub(co.r, co.g, co.b, co.a)
	gl.Begin(gl.QUADS)
	gl.Vertex2i(gl.Int(x), gl.Int(y))
	gl.Vertex2i(gl.Int(x), gl.Int(y+dy))
	gl.Vertex2i(gl.Int(x+dx), gl.Int(y+dy))
	gl.Vertex2i(gl.Int(x+dx), gl.Int(y))
	gl.End()
}
示例#3
0
文件: spawn.go 项目: genbattle/haunts
func (sp *SpawnPoint) Render(pos mathgl.Vec2, width float32) {
	gl.Disable(gl.TEXTURE_2D)
	gl.Color4d(1, 1, 1, 0.1)
	gl.Begin(gl.QUADS)
	gl.Vertex2f(gl.Float(pos.X-width/2), gl.Float(pos.Y))
	gl.Vertex2f(gl.Float(pos.X-width/2), gl.Float(pos.Y+width))
	gl.Vertex2f(gl.Float(pos.X+width/2), gl.Float(pos.Y+width))
	gl.Vertex2f(gl.Float(pos.X+width/2), gl.Float(pos.Y))
	gl.End()
}
示例#4
0
func (o *Overlay) Draw(region gui.Region) {
	o.region = region
	switch o.game.Side {
	case SideHaunt:
		if o.game.los.denizens.mode == LosModeBlind {
			return
		}
	case SideExplorers:
		if o.game.los.intruders.mode == LosModeBlind {
			return
		}
	default:
		return
	}
	for _, wp := range o.game.Waypoints {
		if !wp.active || wp.drawn {
			continue
		}

		cx := float32(wp.X)
		cy := float32(wp.Y)
		r := float32(wp.Radius)
		cx1, cy1 := o.game.viewer.BoardToWindow(cx-r, cy-r)
		cx2, cy2 := o.game.viewer.BoardToWindow(cx-r, cy+r)
		cx3, cy3 := o.game.viewer.BoardToWindow(cx+r, cy+r)
		cx4, cy4 := o.game.viewer.BoardToWindow(cx+r, cy-r)
		gl.Color4ub(200, 0, 0, 128)

		base.EnableShader("waypoint")
		base.SetUniformF("waypoint", "radius", float32(wp.Radius))

		t := float32(time.Now().UnixNano()%1e15) / 1.0e9
		base.SetUniformF("waypoint", "time", t)

		gl.Begin(gl.QUADS)
		gl.TexCoord2i(0, 1)
		gl.Vertex2i(gl.Int(cx1), gl.Int(cy1))
		gl.TexCoord2i(0, 0)
		gl.Vertex2i(gl.Int(cx2), gl.Int(cy2))
		gl.TexCoord2i(1, 0)
		gl.Vertex2i(gl.Int(cx3), gl.Int(cy3))
		gl.TexCoord2i(1, 1)
		gl.Vertex2i(gl.Int(cx4), gl.Int(cy4))
		gl.End()

		base.EnableShader("")
	}
}
示例#5
0
func (e *Entity) Render(pos mathgl.Vec2, width float32) {
	var rgba [4]float64
	gl.GetDoublev(gl.CURRENT_COLOR, (*gl.Double)(&rgba[0]))
	e.last_render_width = width
	gl.Enable(gl.TEXTURE_2D)
	e.drawReticle(pos, rgba)
	if e.sprite.sp != nil {
		dxi, dyi := e.sprite.sp.Dims()
		dx := float32(dxi)
		dy := float32(dyi)
		tx, ty, tx2, ty2 := e.sprite.sp.Bind()
		gl.Begin(gl.QUADS)
		gl.TexCoord2d(gl.Double(tx), gl.Double(-ty))
		gl.Vertex2f(gl.Float(pos.X), gl.Float(pos.Y))
		gl.TexCoord2d(gl.Double(tx), gl.Double(-ty2))
		gl.Vertex2f(gl.Float(pos.X), gl.Float(pos.Y+dy*width/dx))
		gl.TexCoord2d(gl.Double(tx2), gl.Double(-ty2))
		gl.Vertex2f(gl.Float(pos.X+width), gl.Float(pos.Y+dy*width/dx))
		gl.TexCoord2d(gl.Double(tx2), gl.Double(-ty))
		gl.Vertex2f(gl.Float(pos.X+width), gl.Float(pos.Y))
		gl.End()
	}
}