Tuesday, March 11, 2008

Code of Duty

I am thinking of making a little XBOX 360 game. Just downloaded XNA Game Studio Express and I’m trying to dig in.


Here are some simple GUI control elements for XNA games. This uses events and delegates to link the GUI elements to your game that I grabbed from codeplex

To create a panel and add it to your game:
DPanel panel = new DPanel(Game, 5, 5, 400, 400); // Panel at 5,5 and dimensions
400x400 pixels
Components.Add(panel);

You can add panels inside other panels:
DPanel childPanel = new DPanel(Game, 5, 5, 200, 200);
panel.AddPanel(childPanel);

To register events for your gui elements, you can do something like the following:
DButton button = new DButton(Game, 5, 5);
button.OnClick += new ButtonEventHandler(handleClick);
// Register the click listener

The basic language I think I’ll be able to get. It’s the game development that might be a little bit of a problem. No one needs a better solitaire. I’m better on the other side of the controller in that respect.

No comments: