Skip to content

Commit

Permalink
Remove exit from default responder
Browse files Browse the repository at this point in the history
  • Loading branch information
WinPooh32 committed Dec 5, 2021
1 parent eb071e7 commit 8c3681a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 2 additions & 6 deletions responder.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,5 @@ func (g *Game) Render() {}
func (g *Game) Resize(w, h float32) {}
func (g *Game) Mouse(x, y float32, button Key, action Action) {}
func (g *Game) Scroll(amount float32) {}
func (g *Game) Key(key Key, modifier Modifier, action Action) {
if key == BoardEscape {
Exit()
}
}
func (g *Game) Type(char rune) {}
func (g *Game) Key(key Key, modifier Modifier, action Action) {}
func (g *Game) Type(char rune) {}
11 changes: 6 additions & 5 deletions suslik_glfw.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package suslik
Expand Down Expand Up @@ -51,7 +52,9 @@ func run(title string, width, height int, fullscreen bool, hideCursor bool) {
glfw.WindowHint(glfw.ContextVersionMajor, 2)
glfw.WindowHint(glfw.ContextVersionMinor, 1)

window, err := glfw.CreateWindow(width, height, title, monitor, nil)
var err error

window, err = glfw.CreateWindow(width, height, title, monitor, nil)
fatalErr(err)
window.MakeContextCurrent()

Expand Down Expand Up @@ -124,17 +127,15 @@ func run(title string, width, height int, fullscreen bool, hideCursor bool) {
Files.Load(func() {})
responder.Setup()

shouldClose := window.ShouldClose()
for !shouldClose {
for !window.ShouldClose() {
responder.Update(Time.Delta())
gl.Clear(gl.COLOR_BUFFER_BIT)
responder.Render()
window.SwapBuffers()
glfw.PollEvents()
Time.Tick()

shouldClose = window.ShouldClose()
}

window.Destroy()
glfw.Terminate()
responder.Close()
Expand Down

0 comments on commit 8c3681a

Please sign in to comment.