Creating an instance of the GUI to add to your game

RuminateGUI _gui = new RuminateGUI(this);

The GUI instance you just created acts as the root node of a tree which you
will connect all of you widgets to. Widgets can also be added to other widgets,
when this happens the lowest widgets will be drawn first. The GUI needs the
containing game instance to know what window to attach the input listener.

Set the theme to use

_gui.SetTheme(new EmbeddedTheme(_gui));

The GUI library now comes with a embedded theme so you don't need to
supply your own graphics. Simply pass a new instance of the EmbeddedTheme
to make use of the embedded theme. If you want to use your own theme simply
change out the textures and modify the dimensional values.

Add element to the GUI

_gui.AddElement(new Panel(new Offset(10, 10, 100, 100)));

Use the RuminateGUI's AddElement function to add widgets to the rootnode
of the GUI. You can also attach children element to other elements. The elements
are draw in a DFS fashion so adding elements to a panel ensures that they will
be drawn in front of the panel.

Hook the GUI into you main game loop

_gui.Update();

Should be called in the Update function in the generated Game1 class. I haven't
tested how things perform at speeds other than 60 updates per second so give
me a heads up if you have any problems.

_gui.Draw();

Should be called in the draw function in the generated Game1 class. The GUI uses
its own spriteBatch so don't call the draw function between spriteBatch.Begin and
spriteBatch.End.

Last edited Sep 7, 2012 at 10:13 AM by ClassicThunder, version 2

Comments

No comments yet.