本文整理汇总了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()
}
})
}
}()
})
}
开发者ID:reachtheflow,项目名称:gotris,代码行数:32,代码来源:gsxui.go
示例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)
}
开发者ID:lazytiger,项目名称:navmesh,代码行数:13,代码来源:main.go
示例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()
// }
}
开发者ID:gbember,项目名称:gt,代码行数:48,代码来源:main.go
示例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)
}
开发者ID:Kapura,项目名称:pixelart,代码行数:24,代码来源:ui.go
示例5: main
func main() {
gl.StartDriver(appMain)
}
开发者ID:oOLokiOo,项目名称:random-film,代码行数:3,代码来源:main.go
示例6: main
func main() {
flag.Parse()
gl.StartDriver(appMain)
}
开发者ID:ww24,项目名称:goss,代码行数:4,代码来源:main.go
示例7: main
func main() {
gl.StartDriver(dashboard.Initdashboard)
}
开发者ID:jonysugianto,项目名称:adminkost,代码行数:3,代码来源:tut3.go
示例8: ShowWindow
func ShowWindow() {
gl.StartDriver(mainView)
}
开发者ID:blanc01,项目名称:snmp,代码行数:3,代码来源:snmpWindow.go
示例9: Start
func Start() {
gl.StartDriver(appMain)
}
开发者ID:kelwang,项目名称:godu-pan,代码行数:3,代码来源:ui.go
示例10: main
func main() {
initWallet()
gl.StartDriver(appMain)
}
开发者ID:FactomProject,项目名称:GUIWallet,代码行数:4,代码来源:main.go
注:本文中的github.com/google/gxui/drivers/gl.StartDriver函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论