Adding New Base Classes
That's all the changes you need to make to the existing classes you got from the Blockers game, but now you should add a new control, something that you haven't done before but that is common—the text box. This object is actually pretty simple, so go ahead and add the class in Listing 12.5 to your gui.cs code file (might as well keep all the base classes together).
Listing 12.5. The Text Box
public class UiTextBox { private Texture textureSource = null; private Rectangle textureRect; private Rectangle textRectangle; private Point renderLocation; private Direct3D.Font textFont = null; private string currentText = string.Empty; private bool enabled = false; /// <summary> /// Create a new text box /// </summary> public UiTextBox(Device ... |
Get Beginning 3D Game Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.