reorganize
This commit is contained in:
+8
-5
@@ -15,6 +15,12 @@ import (
|
|||||||
"github.com/ktr0731/go-fuzzyfinder/matching"
|
"github.com/ktr0731/go-fuzzyfinder/matching"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const windowWidth = 800
|
||||||
|
const fontSize = 20
|
||||||
|
const textBoxHeight = fontSize + 6
|
||||||
|
|
||||||
|
// TODO: move the raymenu function to its own package
|
||||||
|
|
||||||
//go:embed gomono-font/Go-Mono.ttf
|
//go:embed gomono-font/Go-Mono.ttf
|
||||||
var font_tff []byte
|
var font_tff []byte
|
||||||
|
|
||||||
@@ -51,13 +57,11 @@ const (
|
|||||||
Count_RayMenuResult int = iota
|
Count_RayMenuResult int = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
const width = 800
|
|
||||||
|
|
||||||
func isPressedRepeat(key int32) bool {
|
func isPressedRepeat(key int32) bool {
|
||||||
return rl.IsKeyPressed(key) || rl.IsKeyPressedRepeat(key)
|
return rl.IsKeyPressed(key) || rl.IsKeyPressedRepeat(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fontSize = 20
|
|
||||||
|
|
||||||
func raymenu(options []string) (choice string, result RayMenuResult) {
|
func raymenu(options []string) (choice string, result RayMenuResult) {
|
||||||
state := initialize()
|
state := initialize()
|
||||||
@@ -154,7 +158,6 @@ func raymenu(options []string) (choice string, result RayMenuResult) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var yOffset float32 = 0.0
|
var yOffset float32 = 0.0
|
||||||
const textBoxHeight = fontSize + 6
|
|
||||||
|
|
||||||
func resetBounds() {
|
func resetBounds() {
|
||||||
yOffset = 0.0
|
yOffset = 0.0
|
||||||
@@ -168,7 +171,7 @@ func nextBounds() (bounds rl.Rectangle) {
|
|||||||
|
|
||||||
func initialize() State {
|
func initialize() State {
|
||||||
rl.SetTraceLogLevel(rl.LogError)
|
rl.SetTraceLogLevel(rl.LogError)
|
||||||
rl.InitWindow(width, 0, "raymenu")
|
rl.InitWindow(windowWidth, 0, "raymenu")
|
||||||
rl.SetWindowState(rl.FlagWindowUndecorated)
|
rl.SetWindowState(rl.FlagWindowUndecorated)
|
||||||
rl.SetTargetFPS(
|
rl.SetTargetFPS(
|
||||||
int32(
|
int32(
|
||||||
@@ -181,7 +184,7 @@ func initialize() State {
|
|||||||
monitorWidth := rl.GetMonitorWidth(monitor)
|
monitorWidth := rl.GetMonitorWidth(monitor)
|
||||||
monitorHeight := rl.GetMonitorHeight(monitor)
|
monitorHeight := rl.GetMonitorHeight(monitor)
|
||||||
rl.SetWindowSize(
|
rl.SetWindowSize(
|
||||||
width,
|
windowWidth,
|
||||||
monitorHeight/2,
|
monitorHeight/2,
|
||||||
)
|
)
|
||||||
rl.SetWindowPosition(
|
rl.SetWindowPosition(
|
||||||
|
|||||||
Reference in New Issue
Block a user