-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
56 lines (45 loc) · 1.01 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"image/color"
"os"
"strconv"
muraylib "github.com/gabstv/microui-go-raylib"
"github.com/gabstv/microui-go/demo"
mu "github.com/gabstv/microui-go/microui"
rl "github.com/gen2brain/raylib-go/raylib"
)
func main() {
var flags uint32
if ok, _ := strconv.ParseBool(os.Getenv("HIGHDPI")); ok {
flags |= rl.FlagWindowHighdpi
}
if ok, _ := strconv.ParseBool(os.Getenv("RESIZE")); ok {
flags |= rl.FlagWindowResizable
}
rl.SetConfigFlags(flags)
rl.InitWindow(800, 500, "microui-go + raylib-go")
rl.SetTargetFPS(60)
ctx := mu.NewContext()
muraylib.Setup(ctx)
for !rl.WindowShouldClose() {
muraylib.UpdateInputs(ctx)
ctx.Begin()
demo.DemoWindow(ctx)
demo.LogWindow(ctx)
demo.StyleWindow(ctx)
ctx.End()
rl.BeginDrawing()
// get the color from the demo window (because of the sliders)
bgc := demo.BackgroundColor()
cc := color.RGBA{
R: bgc.R,
G: bgc.G,
B: bgc.B,
A: bgc.A,
}
rl.ClearBackground(cc)
ctx.Render()
rl.EndDrawing()
}
rl.CloseWindow()
}