This project is read-only.


RhinoXNAAdapter is the class that needs to be utilized to use RhinoXNA. RhinoXNAAdapter holds several details related to the game project and is passed as a common object to all areas of the RhinoXNA framework. It is a singleton, as such requires to be accessed through the Instance property.


Namespace: RhinoXNA

Public Functions
public void Setup(ContentManager content, GraphicsDeviceManager graphics, SpriteBatch sBatch, int screenWidth, int screenHeight)
public void AddNewLevel(ILevel level)
public void AddNewMenu(IMenu menu)
public void DrawLevel()
public void DrawMenu()
public int RandomInt(int min, int max)

Currently, only a single ILevel is supported so loading a new level will overload any currently stored one.

Public Properties
public RhinoXNAAdapter Instance
public ILevel Level
public IMenu Menu
public ContentManager ContentManager
public SpriteBatch SpriteBatch 
public Rectangle SCREEN_SAFE
public float AspectRatio

Implementation Example


Following is a sample of a new RhinoXNAAdapter being created as in ProjectAmbush. Notice, it is required that the Setup() method of the RhinoXNAAdapter is called in the LoadContent() of the main game class. This example will create a window of size 1280x720, and will load a new menu.

protected override void LoadContent() 
    // Create a new SpriteBatch, which can be used to draw textures.
    spriteBatch = new SpriteBatch(GraphicsDevice);
    RhinoXNAAdapter.Instance.Setup(this.Content,, spriteBatch, 1280, 720);
    RhinoXNAAdapter.Instance.AddNewMenu(new MainMenu());


Next, the adapter should update the menu whenever the Update method is called in a default XNA project:

protected override void Update(GameTime gameTime) 


Finally after the menu is created and continues to update, we will need to draw the menu using the XNA Draw method.

protected override void Draw(GameTime gameTime) 

Implementation Note

The above is just a simple example to link RhinoXNA to the rest of your project and to process appropriately. Many of these methods will change to include specific game state calls (for example, after the menu a game will typically update and draw an 'In-Game' state).

Last edited Oct 7, 2010 at 7:15 PM by MattChristian, version 13


No comments yet.