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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.