示例#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 (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("")
	}
}