-
-
Save Forsevin/24f1aaf10001efab9597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Input processing | |
func (input *Input) Process() bool { | |
var event sdl.Event | |
for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() { | |
switch t := event.(type) { | |
case *sdl.QuitEvent: | |
return false | |
case *sdl.KeyDownEvent: | |
if key, ok := sdlKeyMap[t.Keysym.Sym]; ok { | |
input.SetKeyDown(key) | |
} | |
case *sdl.KeyUpEvent: | |
if key, ok := sdlKeyMap[t.Keysym.Sym]; ok { | |
input.SetKeyUp(key) | |
} | |
} | |
} | |
return true | |
} | |
// creating the window | |
window := sdl.CreateWindow("", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, 640, 480, sdl.WINDOW_SHOWN|sdl.WINDOW_RESIZABLE), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment