O'Reilly logo

Beginning 3D Game Programming by Tom Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required