本文整理汇总了Golang中github.com/google/gxui/drivers/gl.StartDriver函数的典型用法代码示例。如果您正苦于以下问题:Golang StartDriver函数的具体用法?Golang StartDriver怎么用?Golang StartDriver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了StartDriver函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: gxuiOpenWindow
func gxuiOpenWindow(width uint, height uint, dblBuf *doublebuffer.DoubleBuffer, commands chan Message, events chan Message) {
gl.StartDriver(func(driver gxui.Driver) {
theme := flags.CreateTheme(driver)
window := theme.CreateWindow(int(width), int(height), "MyGameEngine")
window.SetScale(flags.DefaultScaleFactor)
screen := theme.CreateImage()
window.AddChild(screen)
window.OnClose(func() {
driver.Terminate()
events <- Message{MESSAGE_EXIT, 0}
})
window.OnKeyDown(func(e gxui.KeyboardEvent) {
fmt.Println("keydown") // FIXME: without this line, randomly crash ...
events <- Message{MESSAGE_KEY_DOWN, int(e.Key)}
})
// repaint function
go func() {
for {
<-commands
last := screen.Texture()
driver.CallSync(func() {
texture := driver.CreateTexture(dblBuf.GetPreviousImage().GetBuffer(), 1)
screen.SetTexture(texture)
if last != nil {
last.Release()
}
})
}
}()
})
}
示例2: main
func main() {
f, err := os.Open("mesh.json")
if err != nil {
log.Fatal(err)
}
if err := json.NewDecoder(f).Decode(&list); err != nil {
log.Fatal(err)
}
vertices = list.Vertices
triangles = list.Triangles
dijkstra.CreateMatrixFromMesh(Mesh{vertices, triangles})
gl.StartDriver(appMain)
}
示例3: main
func main() {
log.SetFlags(log.Lshortfile | log.Ldate)
meshFileName := "../mesh.json"
data, err := ioutil.ReadFile(meshFileName)
if err != nil {
log.Fatal(err)
}
nmj = new(navmesh.NavMeshJson)
err = json.Unmarshal(data, nmj)
if err != nil {
log.Fatal(err)
}
n_m, err := navmesh.NewNavMesh(meshFileName)
if err != nil {
log.Fatal(err)
}
nm = n_m
nmastar = navmesh.NewNavMeshAStar(nm)
gl.StartDriver(appMain)
//
// ps, isWalk := nm.FindPath(179, 41, 178, 886)
// log.Println(isWalk, ps)
// if isWalk {
// fn := "tt.cpuprof"
// f, err := os.Create(fn)
// if err != nil {
// log.Fatal(err)
// }
// err = pprof.StartCPUProfile(f)
// if err != nil {
// log.Fatal(err)
// }
// max := int64(100000)
// st := time.Now()
// for i := int64(0); i < max; i++ {
// nm.FindPath(179, 41, 178, 886)
// }
// nt := time.Since(st)
// log.Println(nt, nt.Nanoseconds()/max)
// pprof.StopCPUProfile()
// }
}
示例4: GUImain
func GUImain() {
FieldNames = []string{
"chan size",
"blur",
"cpus", // 1- MAX_CPUS (8?)
"update freq",
"colour basis", // any of rgb
"echospacing", // float between 0 and 1 determining how much to progress through set before ES
"flip draw", // technically a bool
"intermediate steps", // also a bool
"seed colour", // any of 0x000000 - 0xFFFFFF
//"seed chroma", // colour to ignore in initial image
//"seed duplicates", // bool; attemp to reseed seen colours
//"seed image", // uploaded image
//"seed culling rate", // % of pixels to reject from seed image
"start X",
"start Y",
"tag",
"width",
"height",
}
gl.StartDriver(appMain)
}
示例5: main
func main() {
gl.StartDriver(appMain)
}
示例6: main
func main() {
flag.Parse()
gl.StartDriver(appMain)
}
示例7: main
func main() {
gl.StartDriver(dashboard.Initdashboard)
}
示例8: ShowWindow
func ShowWindow() {
gl.StartDriver(mainView)
}
示例10: main
func main() {
initWallet()
gl.StartDriver(appMain)
}