Today we are going to take a look at creating our first Cocos2D-XNA program.  This will focus on Windows and Visual Studio and then cover the other systems in separate parts.

We are trying really hard to make this as easy as possible for developers to get up and running quickly so you guys can focus on building your games.  One of the ways is with templates that are available to be installed within Visual Studio for the systems that we support.

What you will learn:

  • Finding and Installing the Cocos2D-XNA Templates
  • Creating a new Cocos2D-XNA Empty Game Solution

Finding and Installing the Cocos2D-XNA Templates

To get a list of the Cocos2D-XNA templates available we will be using the Extensions and Updates dialog box:

  1. In Visual Studio click on Tools and select Extensions and Updates and you will be presented with the dialog box, or type Extensions in the Quick Launch window.  This shows all the extensions that you have installed or are available to install. image
  2. Select the option for Online (depending on the version of Visual Studio this might read Online Gallery) and in the Search Visual Studio Gallery window (text box in the upper right corner of the dialog) type in cocos2d-xna.  You should see the following templates displayed (this could vary depending on the number of templates we provide).                                                                                                    image
  3. Select the Cocos2D-XNA Empty Game Windows GL template.  As you can see in the image above I already have three templates installed that are marked with a green check mark.  If there is not a green check mark then when you select the template entry you will get a download button.  Click the Download button and install the template.  In the following image I have uninstalled the template to demonstrate the download button and the installed versus the non installed templates.  Clicking the download obviously starts to download the template selected as you can see from the Downloading status window.                                                                     imageimage
  4. The following screen will be presented after a slight pause.  Click the Install button.image
  5. Once installed you should have a green checkmark beside the template option you can verify if it is installed by selecting Installed –> Templates in the left paneimage

You should now have the template installed so we can continue on to the next section.  Just to make sure you know –> A restart of Visual Studio is required in order to load the Template.

Creating a new Cocos2D-XNA Empty Game Solution

  1. On the File menu, select New and then click Project.image
  2. In the left pane, select Installed –> Templates –> Visual C# –> Cocos2D-XNA –> Windows and select the template we just installed.  If you have other Cocos2D-XNA templates installed that target different platforms you will also find those platforms under the Cocos2D-XNA heading as well.
  3. Follow the path you would normally to create a solution.  Here we will just use the defaults.                                                                           image
  4. Click Start to see the results.  If everything is ok then you should see the following program.image

Summary

We have shown how to install the templates for Cocos2D-XNA and now you can experiment with any of the templates that are out there.

You will also notice that there are templates for multiple platforms out there for Visual Studio.  A requirement to use the iOS or Android templates is that Xamarin MonoTouch or MonoAdroid is needed.  Please visit their site if you would like to target writing Cocos2D-XNA for those operating systems from Visual Studio and Windows.

Have fun playing around with the templates for the different systems.

In Part 2 we will take a look at the code.