/*
* DungeonScreen.cs
* Authors:
* Copyright (c) 2007-2008 Cornell University
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
namespace HackerHavoc
{
///
/// This will be where a level will be drawn
///
class DungeonScreen:GameScreen
{
int mItemSelected = 0;
SpriteBatch mSpriteBatch;
SpriteFont mSpriteFont;
InputHandler inputHandler;
public DungeonScreen()
{
}
///
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
///
public override void Initialize()
{
inputHandler = GetNewInputHandler();
inputHandler.Initialize();
inputHandler.Bind(Keys.Escape, InputHandler.Trigger.Pressed, (int)EventCodes.Menu_Select);
base.Initialize();
}
///
/// LoadContent will be called once per game and is the place to load
/// all of your content.
///
protected override void LoadContent()
{
mSpriteBatch = new SpriteBatch(GraphicsDevice);
mSpriteFont = Game.Content.Load(@"Fonts//menufont");
base.LoadContent();
}
///
/// UnloadContent will be called once per game and is the place to unload
/// all content.
///
protected override void UnloadContent()
{
}
public override void Reinitialize()
{
inputHandler.Enable();
this.Enabled = true;
this.Visible = true;
}
protected override void Dispose(bool disposing)
{
//Console.WriteLine("Example menu screen disposing");
if (disposing)
{
inputHandler.Dispose();
mSpriteBatch.Dispose();
}
base.Dispose(disposing);
}
///
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
///
/// Provides a snapshot of timing values.
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
while (inputHandler.HasEvent())
{
InputEvent e = inputHandler.GetNextEvent();
switch ((EventCodes)e.EventCode)
{
case EventCodes.Menu_Select:
Done();
break;
}
}
}
///
/// This is called when the game should draw itself.
///
/// Provides a snapshot of timing values.
public override void Draw(GameTime gameTime)
{
mSpriteBatch.GraphicsDevice.Clear(Color.DarkGreen);
base.Draw(gameTime);
Vector2 location = new Vector2(100, 100);
Vector2 shadow = new Vector2(102, 102);
mSpriteBatch.Begin();
mSpriteBatch.DrawString(mSpriteFont, "Hacking Phase", shadow, Color.Black);
mSpriteBatch.DrawString(mSpriteFont, "Hacking Phase", location, Color.BurlyWood);
//Add drawing code
mSpriteBatch.End();
}
}
}