center the window in a nicer way and add todo

This commit is contained in:
Ivar Fatland
2026-05-09 23:19:01 +02:00
parent 0d6e69d682
commit eb9b086ed4
+11 -4
View File
@@ -116,7 +116,6 @@ func raymenu(options []string) (choice string, result RayMenuResult) {
} }
if enter { if enter {
rl.EndDrawing() // TODO: dont need this?
rl.CloseWindow() rl.CloseWindow()
if cursor < len(matched) { if cursor < len(matched) {
return options[matched[cursor].Idx], RayMenuResult_Chosen return options[matched[cursor].Idx], RayMenuResult_Chosen
@@ -137,6 +136,9 @@ func raymenu(options []string) (choice string, result RayMenuResult) {
) )
if i == cursor { if i == cursor {
// TODO if cursor is not visible then keep some offset or make
// 2d camera so you can scroll through all the options if you
// want
rl.DrawCircle( rl.DrawCircle(
int32(bounds.X)+int32(bounds.Height)/2, int32(bounds.X)+int32(bounds.Height)/2,
int32(bounds.Y)+int32(bounds.Height)/2, int32(bounds.Y)+int32(bounds.Height)/2,
@@ -175,11 +177,16 @@ func initialize() State {
), ),
), ),
) )
monitor := rl.GetCurrentMonitor()
monitorWidth := rl.GetMonitorWidth(monitor)
monitorHeight := rl.GetMonitorHeight(monitor)
rl.SetWindowSize( rl.SetWindowSize(
width, width,
rl.GetMonitorHeight( monitorHeight/2,
rl.GetCurrentMonitor(), )
), rl.SetWindowPosition(
monitorWidth/2-rl.GetScreenWidth()/2,
monitorHeight/2-rl.GetScreenHeight()/2,
) )
return State{ return State{