We need to provide a way for components to load content. They can’t do it in their constructors because they may not have a GameScreen set to access the Engine’s content manager yet. To accomplish this we will add a Load() function to the Component class, which will be called (assuming the component has not [...]
-
December 29th, 2009 by Sean
XNA provides a ContentManager class that is used to load and unload content. However, we are going to create our own that caches loaded content so we only have to load an asset once to use it repeatedly, and also supports unloaded specific peaces of content (when entering a different area, for example). Add a [...]
-
December 29th, 2009 by Sean
The final core class of the engine is the “Engine” class. This class maintains the GameScreen stack, keeps track of utility classes, and is the starting point for updating and drawing all the GameScreens and thus all the Components. Later on it will also be in charge of saving and loading the state of the [...]
-
October 21st, 2009 by Sean
One feature of the GameScreen is that it can draw components in whatever order they want to be drawn in. This can be useful for features like transparency, where transparent objects must be drawn last so that they can draw over the object behind them. To implement this, we will provide a property on the [...]
-
October 20th, 2009 by Sean
Add a new class to your engine’s project, and this time call it “GameScreen”. Once again we can remove some of the “using” statements, until we are left with the following. using System; using System.Collections.Generic; namespace InnovationEngine { public class GameScreen { } } As GameScreen is in charge of managing a set of components, [...]
-
October 20th, 2009 by Sean
The component class is pretty simple. It only needs to (for now) provide an Update function and a Draw function, and keep track of its name. The name needs to remain unique, meaning that it must always be the only component that has that name. This is so that later on when we get into [...]
-
October 20th, 2009 by Sean