Browse Source

Clear WindowResized event boolean at the start of each Poll

master
Noah Petherbridge 3 years ago
parent
commit
4d008b5c46
  1. 3
      canvas/events.go
  2. 5
      sdl/events.go

3
canvas/events.go

@ -161,6 +161,9 @@ func (e *Engine) PollEvent() *Event {
func (e *Engine) Poll() (*event.State, error) {
s := e.events
// Reset some event states.
s.WindowResized = false
for event := e.PollEvent(); event != nil; event = e.PollEvent() {
switch event.Class {
case WindowEvent:

5
sdl/events.go

@ -12,7 +12,7 @@ import (
var (
DebugWindowEvents = false
DebugMouseEvents = false
DebugClickEvents = true
DebugClickEvents = false
DebugKeyEvents = false
)
@ -20,6 +20,9 @@ var (
func (r *Renderer) Poll() (*event.State, error) {
s := r.events
// Reset some events.
s.WindowResized = false
// helper function to push keyboard key names on keyDown events only.
pushKey := func(name string, state uint8) {
s.SetKeyDown(name, state == 1)

Loading…
Cancel
Save