Browse Source

Clear WindowResized event boolean at the start of each Poll

master
Noah Petherbridge 1 year ago
parent
commit
4d008b5c46
2 changed files with 7 additions and 1 deletions
  1. +3
    -0
      canvas/events.go
  2. +4
    -1
      sdl/events.go

+ 3
- 0
canvas/events.go View File

@@ -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:


+ 4
- 1
sdl/events.go View File

@@ -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