Exemple #1
0
func (g *Game) RenderLocalSetup(region g2.Region) {
	g.Setup.local.RLock()
	defer g.Setup.local.RUnlock()
	dict := base.GetDictionary("luxisr")
	size := 60.0
	y := 100.0
	dict.RenderString("Engines:", size, y, 0, size, gui.Left)
	for i, id := range g.Setup.EngineIds {
		y += size
		if id == g.local.Engine.Id() {
			gui.SetFontColor(0.7, 0.7, 1, 1)
		} else {
			gui.SetFontColor(0.7, 0.7, 0.7, 1)
		}
		dataStr := fmt.Sprintf("Engine %d, Side %d, %s", id, g.Setup.Players[id].Side, g.Champs[g.Setup.Players[id].ChampIndex].Name)
		dict.RenderString(dataStr, size, y, 0, size, gui.Left)
		if g.IsManaging() && i == g.Setup.local.Index {
			dict.RenderString(">", 50, y, 0, size, gui.Right)
		}
	}
	y += size
	gui.SetFontColor(0.7, 0.7, 0.7, 1)
	if g.IsManaging() {
		dict.RenderString("Start!", size, y, 0, size, gui.Left)
		if g.Setup.local.Index == len(g.Setup.EngineIds) {
			dict.RenderString(">", 50, y, 0, size, gui.Right)
		}
	}
}
Exemple #2
0
func (b *Button) Draw(region Region, style StyleStack) {
	b.Last = region
	selected, ok := style.Get("selected").(bool)
	var xOffset float64
	var renderName string
	if b.Hover || (ok && selected) {
		gui.SetFontColor(0, 0, 0, 1)
		renderName = ">" + b.Name
		xOffset = 0.0
	} else {
		gui.SetFontColor(0, 0, 0, 0.7)
		renderName = b.Name
		xOffset = base.GetDictionary("luxisr").StringWidth(">", float64(b.Size))
	}
	base.GetDictionary("luxisr").RenderString(renderName, xOffset+float64(region.X), float64(region.Y), 0, float64(b.Size), gui.Left)
}
Exemple #3
0
func (p *PosWidget) Draw(region Region, style StyleStack) {
	gl.Disable(gl.TEXTURE_2D)
	gl.Color4ub(0, 255, 0, 255)
	gl.Begin(gl.QUADS)
	x := gl.Int(region.X)
	y := gl.Int(region.Y)
	dx := gl.Int(base.GetDictionary("luxisr").StringWidth(p.text, float64(p.Size)))
	dy := gl.Int(p.Size)
	gl.Vertex2i(x, y)
	gl.Vertex2i(x, y+dy)
	gl.Vertex2i(x+dx, y+dy)
	gl.Vertex2i(x+dx, y)
	gl.End()
	base.Log().Printf("%v %v %v %v", x, y, dx, dy)
	gl.Color4ub(255, 0, 255, 255)
	base.GetDictionary("luxisr").RenderString(p.text, float64(region.X), float64(region.Y), 0, float64(p.Size), gui.Left)
}
Exemple #4
0
func MakeConsole(dx, dy int) *Console {
	var c Console
	c.lines = make([]string, maxLines)
	c.tail = base.GetLogTailer()
	c.dict = base.GetDictionary("luxisr")
	c.dims.Dx = dx
	c.dims.Dy = dy
	return &c
}
Exemple #5
0
func (p *PosWidget) RequestedDims() Dims {
	return Dims{int(base.GetDictionary("luxisr").StringWidth(p.text, float64(p.Size))), p.Size}
}
Exemple #6
0
func (g *Game) renderBases() {
	gui.SetFontColor(0, 255, 0, 255)
	for side, data := range g.Level.Room.SideData {
		base.GetDictionary("luxisr").RenderString(fmt.Sprintf("S%d", side), data.Base.X, data.Base.Y, 0, 100, gui.Center)
	}
}
Exemple #7
0
func (b *Button) RequestedDims() Dims {
	mark := base.GetDictionary("luxisr").StringWidth(">", float64(b.Size))
	name := base.GetDictionary("luxisr").StringWidth(b.Name, float64(b.Size))
	return Dims{int(mark + name), b.Size}
}