I have a basic game loop set up, which is based on an old C# game prorgramming book. Having set up all the graphics device bits and bobs, and drawn my sprite on screen, I enter a method in my Game class called Run(). This has the following content:
[source lang="csharp"] public void Run() { while( this.Created ) { // Process one frame of the game ProcessFrame(); Render(); // Handle all events Application.DoEvents(); } }[/source]
ProcessFrame() is supposed to have all the game logic in it, in response to events. Whilst I have a simple event handler (based on an override of OnKeyDown) set up to detect keypresses, I'm wondering how to collect keypresses such that I can process the responses to them in the ProcessFrame() method.
Some initial research on this subject suggests creating a HashSet<Keys>. I've never done this before, so I'm not sure how I would go about it.
There are probably many ways to do this, so I thought I'd see what people would recommend before jumping right in there.







