Exemplo n.º 1
0
func (w *ButtonWidget) Render() {
	// HACK: Brute-force check the mouse pointer if it contains this widget
	isOriginHit := false
	for _, hit := range mousePointer.OriginMapping {
		if w == hit {
			isOriginHit = true
			break
		}
	}
	isHit := len(w.HoverPointers()) > 0

	// HACK: Assumes mousePointer rather than considering all connected pointing pointers
	if isOriginHit && mousePointer.State.IsActive() && isHit {
		//DrawGBox(w.pos, w.size)
		//drawInnerRoundedBox(w.pos, w.size, highlightColor, grayColor)
		c := mgl64.Vec3{42.0 / 255, 154.0 / 255, 254.0 / 255}
		drawInnerRoundedBox(w.pos, w.size, c.Mul(201.0/255), c)
		gl.Color3d(1, 1, 1)
		//} else if (isHit && !mousePointer.State.IsActive()) || isOriginHit {
		//	//DrawYBox(w.pos, w.size)
		//	drawInnerRoundedBox(w.pos, w.size, highlightColor, nearlyWhiteColor)
	} else {
		//DrawNBox(w.pos, w.size)
		//drawInnerRoundedBox(w.pos, w.size, mgl64.Vec3{0.3, 0.3, 0.3}, nearlyWhiteColor)
		c := mgl64.Vec3{1, 1, 1}
		drawInnerRoundedBox(w.pos, w.size, c.Mul(201.0/255), c)
		gl.Color3d(0, 0, 0)
	}

	NewOpenGlStream(w.pos.Add(mgl64.Vec2{8, 3})).PrintText("Software Update...")
}
Exemplo n.º 2
0
func drawBox() {
	c := mgl64.Vec3{1, 1, 1}
	if boxUpdated {
		c = mgl64.Vec3{42.0 / 255, 154.0 / 255, 254.0 / 255}
	}

	drawInnerRoundedBox(mgl64.Vec2{50, 100},
		mgl64.Vec2{106, 18},
		c.Mul(201.0/255),
		c)
}
Exemplo n.º 3
0
func drawBox() {
	/*gl.Translated(50, 100, 0)
	gl.Color3d(201.0/255, 201.0/255, 201.0/255)
	gl.Recti(0, 0, 106, 18)
	if !boxUpdated {
		gl.Color3d(1, 1, 1)
	} else {
		gl.Color3d(0, 1, 0)
	}
	gl.Recti(0+1, 0+1, 106-1, 18-1)*/

	c := mgl64.Vec3{1, 1, 1}
	if boxUpdated {
		c = mgl64.Vec3{42.0 / 255, 154.0 / 255, 254.0 / 255}
	}

	drawInnerRoundedBox(mgl64.Vec2{50, 100},
		mgl64.Vec2{106, 18},
		c.Mul(201.0/255),
		c)
}
Exemplo n.º 4
0
	"log"
	"os"
	"path/filepath"
	"strings"

	"github.com/go-gl/gl/v2.1/gl"
	"github.com/go-gl/mathgl/mgl64"

	"github.com/shurcooL/Conception-go/caret"
)

var oFontBase, oFontBackground uint32
var lodBias float64 = -66.67

var selectedTextColor = mgl64.Vec3{195 / 255.0, 212 / 255.0, 242 / 255.0}
var selectedTextDarkColor = selectedTextColor.Mul(0.75)

// FontOptions specifies the properties of the font.
type FontOptions uint8

const (
	Regular FontOptions = iota
	Bold
	Italic
	BoldItalic
)

// IsBold returns true if the font has the bold property set.
func (fo FontOptions) IsBold() bool { return fo == Bold || fo == BoldItalic }

// IsItalic returns true if the font has the italic property set.