Advertisement

Getting SDL keyevents to work with NeHe Tutorial 32

Started by July 15, 2005 08:09 PM
1 comment, last by ScottNCSU 19 years, 2 months ago
This is based on NeHe Lesson 32, the shooting gallery. The main "game" loop is in NeHeGL.c, where I'd like to have SDL handling key events. Lesson32.c however has OpenGL handling keyevents, and this seems to catch all keyevents that would be passed to the SDL keyevent buffer. The OpenGL initialization method called in NeHeGL.c is: (/code) BOOL Initialize (GL_Window* window, Keys* keys) (\code) Is there a way to call an OpenGL initialization that won't disrupt the SDL keyevent grabber in the main loop?
1. OpenGL doesn't handle key event's.

2. it is the fuction "WindowProc" that contains the main loop that does this, somewhere in that big switch statement.

read this http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fGetKeyState

I have little experience with SDL but it looks straightforward enough.
Advertisement
I see what you mean by WindowProc, not OpenGL, intercepting keyboard events (and every other thinkable event). I found that the NeHeGL SDL pack on their website takes over most of what WindowProc does, I just need to integrate it into my program.

[Edited by - ScottNCSU on July 15, 2005 10:29:58 PM]

This topic is closed to new replies.

Advertisement