Quantcast
Channel: blackstar Wiki & Documentation Rss Feed
Viewing all articles
Browse latest Browse all 19

Updated Wiki: Getting Started

$
0
0
Welcome to a quick guide to get you started using BlackStar.

This guide was written for use with [Release 0.1.0|release:23012], Microsoft Visual C# Express 2008, and XNA Game Studio 3.0. Please be sure that you have a recent version of Visual C# installed along with a recent version of XNA Game Studio before continuing.

In order to continue, you will need to download the x86 version of the release. Alternatively, you may prefer to download the source code version and compile your own assemblies.

Start by opening Visual C# and creating a new project using the Windows Game (3.0) template.

Next add a reference to the BlackStar.dll assembly to the project.

Add a Content Reference to the BlackStarPipeline.dll assembly. This is needed so that the XML content used to define your GUI can be compiled into .xnb files.

Add a new folder to the content of your project called 'GUI'.

To this folder there are a few files that need to be added in order to render a gui. The simplest way to do this is to copy the contents of the GUI folder from the Release Zip archive into the newly created GUI folder.

At this point, a theme has been added. The theme contains all the files needed to render the GUI, including Sprite Fonts and Cursors. The KeyMapDefault.XML file contains data that convert keyboard codes to an appropriate display character. Last the GUI.XML file contains a simple gui for purposes of this guide.

Now you are ready to start writing some code. Open up the game1.cs file that was created when the project was created. At the top of the Game1 class declare a variable to hold the GUI like this:

BlackStar.GUI gui;

Now some code is needed to create an instance of the GUI.

gui = new BlackStar.GUI(this, "GUI\\GUI", "GUI\\Themes\\Default\\Theme",  "GUI\\KeymapDefault");

Lets explain the parameters in the above code. First of a BlackStar GUI is a Drawable Game Component. It ancestor class requires a Game so we provide the instance of the Game1 class.

Second, the GUI needs an XML content file that contains instructions about what forms and controls to draw, so the second parameter points to the GUI.xml file, since the XML will be compiled into an .xnb file we don't specify the .xml extension.

The third parameter is to another XML content file. This time the parameter points to the Theme.xml file which contains instructions on how to use all the textures needed to draw the GUI.

The fourth parameter is for yet another XML content file, the Keymap file.

If you run the code now, you should see a Login Dialog.

Viewing all articles
Browse latest Browse all 19

Latest Images

Trending Articles





Latest Images