本文整理汇总了Golang中github.com/runningwild/glop/gui.Gui.AddChild方法的典型用法代码示例。如果您正苦于以下问题:Golang Gui.AddChild方法的具体用法?Golang Gui.AddChild怎么用?Golang Gui.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/runningwild/glop/gui.Gui
的用法示例。
在下文中一共展示了Gui.AddChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
sys = system.Make(gos.GetSystemInterface())
sys.Startup()
wdx := 1000
wdy := 500
render.Init()
var ui *gui.Gui
render.Queue(func() {
sys.CreateWindow(50, 150, wdx, wdy)
sys.EnableVSync(true)
err := gl.Init()
if err != nil {
f, err2 := os.Create(filepath.Join(datadir, "gl_log.txt"))
if err2 != nil {
fmt.Printf("Unable to write log to a file:%v\n%v\v", err, err2)
} else {
fmt.Fprintf(f, "%v\n", err)
f.Close()
}
}
ui, _ = gui.Make(gin.In(), gui.Dims{wdx, wdy}, filepath.Join(datadir, "fonts", "luxisr.ttf"))
font, err := loadFont()
if err != nil {
panic(err.Error())
}
dict = gui.MakeDictionary(font, 15)
})
render.Purge()
anchor := gui.MakeAnchorBox(gui.Dims{wdx, wdy})
ui.AddChild(anchor)
var event_handler handler
gin.In().RegisterEventListener(&event_handler)
actions_list := gui.MakeVerticalTable()
keyname_list := gui.MakeVerticalTable()
both_lists := gui.MakeHorizontalTable()
both_lists.AddChild(actions_list)
both_lists.AddChild(keyname_list)
anchor.AddChild(both_lists, gui.Anchor{1, 0.5, 1, 0.5})
var actions []string
for action := range action_map {
actions = append(actions, action)
}
sort.Strings(actions)
for _, action := range actions {
actions_list.AddChild(gui.MakeTextLine("standard", action, 150, 1, 1, 1, 1))
keyname_list.AddChild(gui.MakeTextLine("standard", commands[action].Cmd, 100, 1, 1, 1, 1))
}
current_anim := gui.MakeTextLine("standard", "", 300, 1, 1, 1, 1)
current_state := gui.MakeTextLine("standard", "", 300, 1, 1, 1, 1)
frame_data := gui.MakeVerticalTable()
frame_data.AddChild(current_anim)
frame_data.AddChild(current_state)
anchor.AddChild(frame_data, gui.Anchor{0, 1, 0, 1})
speed := 100
speed_text := gui.MakeTextLine("standard", "Speed: 100%", 150, 1, 1, 1, 1)
anchor.AddChild(speed_text, gui.Anchor{0, 0, 0, 0})
var box1, box2 boxdata
box1.name = "box1"
box1.sb = makeSpriteBox(nil)
anchor.AddChild(box1.sb, gui.Anchor{0.5, 0.5, 0.25, 0.5})
box1.load(GetStoreVal("box1"))
box := box1
box2.name = "box2"
box2.sb = makeSpriteBox(nil)
anchor.AddChild(box2.sb, gui.Anchor{0.5, 0.5, 0.45, 0.5})
box2.load(GetStoreVal("box2"))
box2.sb.top = true
box_other := box2
box2.sb.r, box2.sb.g, box2.sb.b = 0.2, 0.1, 0.4
box1.sb.r, box1.sb.g, box1.sb.b = 0.4, 0.2, 0.8
error_msg = gui.MakeTextLine("standard", "", wdx, 1, 0.5, 0.5, 1)
anchor.AddChild(error_msg, gui.Anchor{0, 0, 0, 0.1})
var chooser gui.Widget
// curdir := GetStoreVal("curdir")
// if curdir == "" {
// curdir = "."
// } else {
// _,err := os.Stat(filepath.Join(datadir, curdir))
// if err == nil {
// go func() {
// anim, err := sprite.LoadSprite(filepath.Join(datadir, curdir))
// loaded <- loadResult{ anim, err }
// } ()
// } else {
// curdir = "."
// }
// }
// var profile_output *os.File
then := time.Now()
sys.Think()
for key_map["quit"].FramePressCount() == 0 {
//.........这里部分代码省略.........