Skip to content

Instantly share code, notes, and snippets.

@Forsevin
Created May 11, 2014 16:25
Show Gist options
  • Save Forsevin/24f1aaf10001efab9597 to your computer and use it in GitHub Desktop.
Save Forsevin/24f1aaf10001efab9597 to your computer and use it in GitHub Desktop.
// 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