Hi all, it's me again. I'm in the process of making a game with a friend for class, and we're stuck at a certain point. We're having a problem making our game "real-time", that is to say, it constantly refreshes and while still being able to take input, say from a keyboard.
However, we're using a bastardization, for lack of better terms, of the windows application. We don't have that much of a grasp on forms, and we're hard-coding most of the game in the Program.cs area of a windows application.
I can provide code snippets for things related to paint, and key-mapping; but a lot of the program is working and has no real bearing on the re-drawing methods.
Specifically, we have a game that is set in space, with gravity effects. But at the moment, the program only redraws when a key is pressed. We have tried beforehand to constantly refresh the screen, but that poses problems in taking input from the keyboard. Also, it even causes our visuals to not show up at all.
Mahesh ChandPosted May 23, 2008, 4:17 PM
We have a Games section on this site. Check it out for some games samples. Here it is:
http://www.c-sharpcorner.com/Articles/ArticleListing.aspx?SectionID=1&SubSectionID=65
In general, GDI+ (Windows Forms) is not a way to create real-time games. I would select DirectX for that. If you want to use GDI+, use multithreading where one thread will take input while other thread in always drawing in the background. See Multithreading section on this site for samples.
J ElasiguePosted May 23, 2008, 2:11 PM
Johnny GCPosted May 23, 2008, 1:02 AM
does System.Threading.Timer help?