示例#1
0
package menu

import (
	"github.com/ArchRobison/Gophetica/nimble"
)

var (
	foregroundColor         = nimble.Black
	disabledForegroundColor = nimble.Gray(0.5)
	backgroundColor         = nimble.White
	itemHilightColor        = nimble.RGB(0.875, 0.875, 1)
	tabHilightColor         = nimble.RGB(0, 0, 1)
	separatorColor          = nimble.Gray(0.75)
)

var menuFont, checkFont *nimble.Font

// Each "item" row of the menu is drawn as:
// | margin checkWidth margin | margin itemWidth margin |
var (
	checkWidth  int32 // Width of "check" column (not including margins)
	marginWidth int32 // Margin in pixels between text and border
)

// Return b ? p : q
func choose(b bool, p, q nimble.Pixel) nimble.Pixel {
	if b {
		return p
	} else {
		return q
	}
func BenchmarkDraw(b *testing.B) {
	for n := 0; n < b.N; n++ {
		Draw(dst, 250, 250, src[0], nimble.Gray(1))
	}
}
示例#3
0
func (*context) Render(pm nimble.PixMap) {
	pm.Fill(nimble.Gray(0.1))
	theMenu.Draw(pm, 50, 100)
}