-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathmain.go
39 lines (28 loc) · 976 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"github.com/AllenDang/cimgui-go/backend"
ebitenbackend "github.com/AllenDang/cimgui-go/backend/ebiten-backend"
"github.com/AllenDang/cimgui-go/examples/common"
"github.com/AllenDang/cimgui-go/imgui"
)
var currentBackend backend.Backend[ebitenbackend.EbitenBackendFlags]
func main() {
common.Initialize()
currentBackend, _ = backend.CreateBackend(ebitenbackend.NewEbitenBackend())
currentBackend.SetAfterCreateContextHook(common.AfterCreateContext)
currentBackend.SetBeforeDestroyContextHook(common.BeforeDestroyContext)
currentBackend.SetBgColor(imgui.NewVec4(0.45, 0.55, 0.6, 1.0))
currentBackend.CreateWindow("Hello from cimgui-go", 1200, 900)
// TODO: not implemented
/*
backend.SetDropCallback(func(p []string) {
fmt.Printf("drop triggered: %v", p)
})
*/
currentBackend.SetCloseCallback(func() {
fmt.Println("window is closing")
})
currentBackend.SetIcons(common.Image())
currentBackend.Run(common.Loop)
}