Beispiel #1
0
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("")
}
Beispiel #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()
}
Beispiel #3
0
func SetUniformI(shader, variable string, n int) {
	prog, ok := shader_progs[shader]
	if !ok {
		if !warned_names[shader] {
			Warn().Printf("Tried to set a uniform in an unknown shader '%s'", shader)
			warned_names[shader] = true
		}
		return
	}
	bvariable := []byte(fmt.Sprintf("%s\x00", variable))
	loc := gl.GetUniformLocation(gl.Uint(prog), (*gl.Char)(unsafe.Pointer(&bvariable[0])))
	gl.Uniform1i(loc, gl.Int(n))
}
Beispiel #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("")
	}
}