-
Notifications
You must be signed in to change notification settings - Fork 51
/
main.go
42 lines (31 loc) · 1.08 KB
/
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
40
41
42
package main
import (
"fmt"
"runtime"
"github.com/AllenDang/cimgui-go/backend"
"github.com/AllenDang/cimgui-go/backend/glfwbackend"
"github.com/AllenDang/cimgui-go/examples/common"
"github.com/AllenDang/cimgui-go/imgui"
_ "github.com/AllenDang/cimgui-go/immarkdown"
_ "github.com/AllenDang/cimgui-go/imnodes"
)
var currentBackend backend.Backend[glfwbackend.GLFWWindowFlags]
func init() {
runtime.LockOSThread()
}
func main() {
common.Initialize()
currentBackend, _ = backend.CreateBackend(glfwbackend.NewGLFWBackend())
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)
currentBackend.SetDropCallback(func(p []string) {
fmt.Printf("drop triggered: %v", p)
})
currentBackend.SetCloseCallback(func(b backend.Backend[glfwbackend.GLFWWindowFlags]) {
fmt.Println("window is closing")
})
currentBackend.SetIcons(common.Image())
currentBackend.Run(common.Loop)
}