Game Development Reference
In-Depth Information
Application.SetCompatibleTextRenderingDefault(false);
SlimFramework.GameWindow gameWindow = new
SlimFramework.GameWindow("Our First Game
Window", 640, 480, false);
gameWindow.StartGameLoop();
}
This code is fairly simple. The first two lines were already there, created by Visual
Studio. I removed the third line that Visual Studio added—which made a call to Ap-
plication.Run() —since we don't need it. The next line simply creates a new
GameWindow object and passes in parameters to specify the title of the window, the
width and height of the window, and lastly whether or not we want to run it in full-
screen mode. In this case, we set the window title to Our First Game Window ,
and the window size to 640x480 . And lastly, we pass in the value false for the
last parameter since we do not want to run in fullscreen mode, as we haven't im-
plemented it yet anyway. The last line of code in this method calls the GameWin-
dow class's StartGameLoop() method to start up the game loop. The parameter
of the Main() method is simply a String array that contains any command-line
arguments that were passed in when the application was started. You would simply
add code somewhere that would process the passed in command-line arguments, if
any. This is how you would add some command-line switches to your game.
We are now ready to compile and run our code. To do this, click on the Start button
on Visual Studio's toolbar. This button has a green triangle icon beside it. The follow-
ing screenshot shows what our game window looks like when you run the program.
You may recall that we set black as our default background color, but the background
of this window is not very black. This is not a bug, it is simply because we have no
drawing code yet.
Search WWH ::




Custom Search