Skip to content
Permalink
Browse files

Added editable window title.

Kudos to FainTMako, his implementation at his fork helped to understand more easily how to do it.
  • Loading branch information
Windblade-GR01 committed Dec 4, 2019
1 parent 9c34fdd commit ea4b9f51ec459e944b2cf1e9560c8128e414625c
Showing with 13 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 src/main.go
  3. +6 −0 src/script.go
  4. +3 −2 src/system.go
@@ -7,5 +7,6 @@ bin/*

# Compilation files
go/*
src/*.syso
releaseconf.xml.backup
Ikemen_GO.xml.backup
@@ -78,6 +78,7 @@ func main() {
defer glfw.Terminate()
defcfg := []byte(strings.Join(strings.Split(
`{
"WindowTitle": "Ikemen GO",
"HelperMax": 56,
"PlayerProjectileMax": 256,
"ExplodMax": 512,
@@ -194,6 +195,7 @@ func main() {
ControllerStickSensitivity float32
XinputTriggerSensitivity float32
WindowMainIconLocation []string
WindowTitle string
}{}
chk(json.Unmarshal(defcfg, &tmp))
const configFile = "save/config.json"
@@ -211,6 +213,7 @@ func main() {
}
sys.controllerStickSensitivity = tmp.ControllerStickSensitivity
sys.xinputTriggerSensitivity = tmp.XinputTriggerSensitivity
sys.windowTitle = tmp.WindowTitle
sys.helperMax = tmp.HelperMax
sys.playerProjectileMax = tmp.PlayerProjectileMax
sys.explodMax = tmp.ExplodMax
@@ -2291,5 +2291,11 @@ func debugScriptInit(l *lua.LState, file string) error {
l.Push(lua.LBool(sys.allowDebugKeys))
return 1
})
luaRegister(l, "setWindowTitle", func(*lua.LState) int {
sys.windowTitle = string(strArg(l, 1))
sys.window.SetTitle(sys.windowTitle)
return 0
})

return l.DoFile(file)
}
@@ -251,6 +251,7 @@ type System struct {
wavVolume int
bgmVolume int
AudioDucking bool
windowTitle string
//FLAC_FrameWait int

controllerStickSensitivity float32
@@ -284,10 +285,10 @@ func (s *System) init(w, h int32) *lua.LState {
var err error
if s.fullscreen {
s.window, err = glfw.CreateWindow(int(s.scrrect[2]), int(s.scrrect[3]),
"Ikemen GO", glfw.GetPrimaryMonitor(), nil)
s.windowTitle, glfw.GetPrimaryMonitor(), nil)
} else {
s.window, err = glfw.CreateWindow(int(s.scrrect[2]), int(s.scrrect[3]),
"Ikemen GO", nil, nil)
s.windowTitle, nil, nil)
}
chk(err)
s.window.MakeContextCurrent()

0 comments on commit ea4b9f5

Please sign in to comment.
You can’t perform that action at this time.