December 2004
Beginner
432 pages
10h 17m
English
You can keep the code for your button in the same gui.cs code file you've been using up to this point (which is what the code on the included CD does), or you can put it in its own code file, which you would need to add to your project. Either way, add the class in Listing 5.9 to your code file.
/// <summary> /// Will hold a 'button' that will be rendered via DX /// </summary> public class UiButton { private Sprite renderSprite = null; private Texture buttonTextureOff = null; private Texture buttonTextureOn = null; private Rectangle onSource; private Rectangle offSource; private Vector3 location; private bool isButtonOn = false; private Rectangle buttonRect; // The click event public event EventHandler ... |
Read now
Unlock full access