Game Programming Class4

esse quam videri
Revision as of 04:28, 16 February 2009 by Jeff (talk | contribs) (Came Components)
Jump to: navigation, search

Game Components

About components Application Overview

Game Components are reusable and easy to add to a game Game Components

  • GameComponent Class
  • DrawGameComponent Class

Game Service

A game service is a game component that uses and interface to enforce a singleton pattern and make a single instance of a game component accessible to all other components.

A singleton is a class that only allows a single instance of the class to be created. A game service is not a true singleton as it uses a unique interface to identify and expose it at the game level.

A game service is a built in mechanism that allows a game to create and manage a single instance of a component ans allows other components access to the service.

Good candidates for a game service are.

  • InputHandler
  • GameConsole
  • Profiling Service
  • Scoreboard

Console Class

Separate IntroGameLibrary Project to help Encapsulate Reusable Code.

IntoGameLibrary/GameConsole.cs To Add the Component to the Game we make an delclare in the game class Then we need to add the componnet to the Game Components Collection.


       GameConsole gameConsole;
       public Game1()
           graphics = new GraphicsDeviceManager(this);
           Content.RootDirectory = "Content";
           gameConsole = new GameConsole(this);