In previous tutorial I wrote about how to write a working Neat code. You can skip some of the steps mentioned in that tutorial by using NeatStarter project as your starting point. To do that, download and extract the NeatStarter project folder from the latest Neat release. Open the NeatStarter.csproj project file using Visual Studio. You might see the following message, if so, choose Permanently remove source control association bindings:

neat_tut_2_sc

Now the project should be opened in your Visual Studio. if you open the References folder of your project, you’ll notice that there’s an exclamation mark on Neat. That means Visual Studio can’t find Neat.exe. to fix this, remove Neat from the references and add it again. you should also add a reference to NeatContent to your project. both of these are explained in the previous tutorial.

If you did everything correctly, you should see the fading This is Neat. logo when you build and run the project. This means Neat is ready to use. you can access the console by pressing the Tilde ( ~ ) key.

neat_tut_2_this_is_neat

 

So, let’s take a look at the code and learn how things work:

There are two main classes in NeatStarter: The NeatStarterGame class which can be found inside the Game1.cs file, and the StartScreen class that is inside StartScreen.cs code file. I’m going to explain NeatStarterGame first.

In the constructor of this class, we can see these lines:

GameWidth = 800;
GameHeight = 600;
GameBackGroundColor = Color.CornflowerBlue;
FullScreen = false;

The first two lines define our game’s boundaries and can be changed dynamically via the script using the g_size command. The third line sets the background color of the game if the AutoClear value is true (which is the default behavior). It is equivalent to the g_backcolor command in the console. The last line specifies the full screen mode and can be changed using the g_fullscreen command from the console.

Content files can be loaded in the LoadContent() method using LoadTexture(…), LoadSound(…), LoadEffect(…) and similar methods or dynamically using the load command via script.

In the AddScreens() method, we can bind our screens to the engine. mainmenu is the first screen that will be shown when the game starts. if you don’t change it’s default value, Neat’s Main Menu will be shown by default. Screens can be switched using the ActivateScreen(…) method from the code or the e_show command via console/scripts.

That was the basics of a Neat game. There are plenty more features and tweaks to go around, but these were the essential parts that you should know if you’re going to use Neat.

Let’s take a look at the StartScreen class. A Neat Screen looks pretty much like a regular XNA game: It has a constructor, Initialize, LoadContent, Behave and Render methods. If you are familiar with XNA games, you should have no problems using Screens.

Good Luck!

Last edited Jan 30, 2011 at 8:05 PM by saeedoo, version 2

Comments

No comments yet.