You are previewing C# Game Programming: For Serious Game Creation.

C# Game Programming: For Serious Game Creation

Cover of C# Game Programming: For Serious Game Creation by Daniel Schuller Published by Course Technology PTR
  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. About the Author
  4. Introduction
    1. CD-ROM Downloads
  5. I. Background
    1. 1. The History of C#
      1. C# Basics
      2. Summary
    2. 2. Introducing OpenGL
      1. Architecture of OpenGL
      2. OpenGL Is Changing
      3. OpenGL and the Graphics Card
      4. The Tao Framework
      5. Summary
    3. 3. Modern Methods
      1. Pragmatic Programming
      2. Summary
  6. II. Implementation
    1. 4. Setup
      1. Introducing Visual Studio Express—A Free IDE for C#
      2. Subversion, an Easy Source Control Solution
      3. Tao
      4. NUnit
      5. Summary
    2. 5. The Game Loop and Graphics
      1. How Do Games Work?
      2. Implementing a Fast Game Loop in C#
      3. Graphics
      4. Summary
    3. 6. Game Structure
      1. The Basic Pattern of a Game Object
      2. Handling Game State
      3. Game State Demo
      4. Setting the Scene with Projections
      5. Sprites
    4. 7. Rendering Text
      1. Font Textures
      2. Font Data
      3. Rendering Text
      4. Refining the Text Class
      5. Faster Rendering with glDrawArrays
      6. Summary
    5. 8. Game Math
      1. Trigonometric Functions
      2. Vectors
      3. Two-Dimensional Intersection
      4. Tweens
      5. Matrices
    6. 9. Making the Game Engine
      1. A New Game Engine Project
      2. Extending the Game Engine
      3. Adding Sound Support
      4. Improving Input
    7. 10. A Simple Side-Scrolling Shooting Game
      1. A Simple Game
      2. The First Implementation Pass
      3. Developing the Inner Game
      4. Continuing Iterations
    8. 11. Creating Your Own Game
      1. Project Management
      2. Display Methods
      3. Types of Games
      4. Final Words
  7. A. Recommended Reading
    1. The Practice of Programming
      1. The Pragmatic Programmer: From Journeyman to Master (ISBN 0-201-61622-X) by Andrew Hunt and David Thomas
      2. Code Complete Second Edition: A Practical Handbook of Software Construction (ISBN-13: 978-0735619678) by Steve McConnell
    2. The C# Language and Software Architecture
      1. CLR via C#, 3rd Edition (ISBN-13: 978-0735627048) by Jeffrey Richter
      2. Head First Design Patterns (ISBN-13: 978-0596007126) by Eric T Freeman, Elisabeth Robson, Bert Bates, and Kathy Sierra
    3. Math and Graphics Programming
      1. 3D Math Primer for Graphics and Game Development (ISBN-13: 978-1556229114) by Fletcher Dunn and Ian Parberry
      2. Computer Graphics: Principles and Practice in C (2nd Edition) (ISBN-13: 978-0201848403) by James D. Foley, Andries van Dam, Steven K. Feiner, and John F. Hughes
    4. OpenGL
      1. OpenGL Programming Guide: The Official Guide to Learning OpenGL (ISBN-13: 978-0321552624) by Dave Shreiner
      2. OpenGL Shading Language 3rd Edition by Randi J. Rost, Bill Licea-Kane, Dan Ginsburg, John M. Kessenich, Barthold Lichtenbelt, Hugh Malan, and Mike Weiblen

Chapter 7. Rendering Text

Most games need text—at the very least to display a score or menu.

Text rendering is also very useful for rendering out variable values as the game is running. A basic font system can be made very simply; each letter and number is represented as a sprite. Then a string of text is translated into a list of sprites. This method is easy to extend to any language, though Asian languages such as Chinese will need a larger number of textures to account for all the different glyphs.

Font Textures

Figure 7.1 is a texture with the entire Roman alphabet, numbers, and some punctuation marks. This is a great base to use to draw text. Such textures are easy to create if the correct tools are used. An excellent tool for bitmap fonts is ...

The best content for your career. Discover unlimited learning on demand for around $1/day.