mirror of
https://github.com/Fluffy-Bean/ColouringApp.git
synced 2025-05-19 09:54:57 +00:00
Check if user wants to quit app 2
This commit is contained in:
parent
3740187ee2
commit
51a6bf959c
2 changed files with 20 additions and 14 deletions
17
main.go
17
main.go
|
@ -43,11 +43,7 @@ func main() {
|
|||
for !applicationShouldQuit {
|
||||
// Update default loop values
|
||||
if raylib.WindowShouldClose() {
|
||||
if canvas.UnsavedChanges {
|
||||
applicationState = StateWindowWantsToDie
|
||||
} else {
|
||||
applicationShouldQuit = true
|
||||
}
|
||||
applicationState = StateWindowWantsToDie
|
||||
}
|
||||
if raylib.IsWindowResized() {
|
||||
applicationWindowWidth = int32(raylib.GetScreenWidth())
|
||||
|
@ -287,7 +283,6 @@ func main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
raylib.EndScissorMode()
|
||||
case StateNewCanvas:
|
||||
if !canvas.UnsavedChanges {
|
||||
|
@ -311,6 +306,16 @@ func main() {
|
|||
AddToast("Created New Canvas: " + canvas.Name)
|
||||
}
|
||||
case StateWindowWantsToDie:
|
||||
if !canvas.UnsavedChanges {
|
||||
applicationShouldQuit = true
|
||||
break
|
||||
}
|
||||
if !canvas.UnsavedChanges {
|
||||
applicationState = StateNormal
|
||||
shouldCreateNewCanvas = true
|
||||
AddToast("Created New Canvas: " + canvas.Name)
|
||||
break
|
||||
}
|
||||
gui.Unlock()
|
||||
raylib.DrawRectangle(0, 0, applicationWindowWidth, applicationWindowHeight, raylib.Fade(raylib.Black, 0.5))
|
||||
windowPos := raylib.NewRectangle(float32((applicationWindowWidth/2)-200), float32((applicationWindowHeight/2)-75), 400, 150)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue