Skip to content

Commit

Permalink
update changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jafework committed Nov 5, 2012
1 parent b40f226 commit b3d0ed9
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 0 deletions.
42 changes: 42 additions & 0 deletions TestGame/TestGame/GSM/StateManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestGame
{
class StateManager
{
public enum GameState
{
initilize,
menu,
playground,
inventory,
store,
multiplayer,
tournamentloby,
fightlobby,
fightscene,
wagerloby
}

private GameState _currentstate;
public GameState currentstate
{
get
{
return _currentstate;
}
set
{
_currentstate = value;
}
}

public StateManager()
{
_currentstate = GameState.initilize;
}
}
}
48 changes: 48 additions & 0 deletions TestGame/TestGame/SM/Scene.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System.Collections;

namespace TestGame
{
class Scene
{
public Texture2D background;
public int height;
public int width;
public int x;
public int y;
public bool visible;
//array of Elements
public ArrayList elements = new ArrayList();

public void AddElement(Element newElement){
elements.Add(newElement);
}

public void RemoveElement(int index)
{
elements.RemoveAt(index);
}
public Scene(int x, int y, Texture2D background)
{
this.x = x;
this.y = y;
this.width = background.Bounds.Width;
this.height = background.Bounds.Height;
this.background = background;
}
public Scene(int x, int y, int height, int width, Texture2D background)
{

}

}
}
80 changes: 80 additions & 0 deletions TestGame/TestGame/SM/SceneManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using System.Collections;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace TestGame
{
class SceneManager
{
//Refferes to the current Scene
private Scene _currentScene;
public Scene currentScene
{
get
{
return _currentScene;
}
set
{
_currentScene = value;
}
}
//Stack of All of our Scenes
private ArrayList sceneStack = new ArrayList();
//Constructor
public SceneManager()
{
}

public void PushScene(Scene newScene){
sceneStack.Add(newScene);
_currentScene = newScene;
}

public void PopScene(Scene oldScene)
{
sceneStack.Remove(oldScene);
if (sceneStack.Count == 0)
{
_currentScene = null;
}
else
{
_currentScene = (Scene)sceneStack[sceneStack.Count - 1];
}
}

public void DrawScene(Scene scene,GraphicsDevice graphicsDevice,SpriteBatch spriteBatch,GameTime gametime)
{
spriteBatch.Begin();
graphicsDevice.Clear(Color.Black);
Texture2D shape = new Texture2D(graphicsDevice, 1, 1);
shape.SetData(new[] { Color.White });

spriteBatch.Draw(shape, new Rectangle(0, 0, 100, 100), Color.White);
spriteBatch.Draw(scene.background, new Rectangle(scene.x, scene.y, scene.width, scene.height), Color.White);
foreach(Element element in scene.elements.ToArray()){
if (element.visible == true)
{
if (element.text == "")
{
spriteBatch.Draw(element.image, new Rectangle(element.x, element.y, element.width, element.height), Color.White);
}
else
{
spriteBatch.DrawString(element.Font, element.text, new Vector2(element.x, element.y), element.color);
}
}
}
spriteBatch.End();
//_currentScene.Draw(gametime);
}
}
}
60 changes: 60 additions & 0 deletions TestGame/TestGame/Sprite/Sprite.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace TestGame.Sprite
{
/// <summary>
/// This is a game component that implements IUpdateable.
/// </summary>
public class Sprite : Microsoft.Xna.Framework.DrawableGameComponent
{
Vector2 position;
Texture2D image;


public Sprite(Game game, Texture2D image, Vector2 position ) : base(game)
{
// TODO: Construct any child components here
this.position = position;
this.image = image;
}

/// <summary>
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
/// </summary>
public override void Initialize()
{
// TODO: Add your initialization code here

base.Initialize();
}

/// <summary>
/// Allows the game component to update itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Draw(GameTime gameTime)
{
// TODO: Add your update code here

base.Draw(gameTime);
}

public override void Update(GameTime gameTime)
{
// TODO: Add your update code here

base.Update(gameTime);
}
}
}
60 changes: 60 additions & 0 deletions TestGame/TestGameContent/Times New Roman.spritefont
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">

<!--
Modify this string to change the font that will be imported.
-->
<FontName>Times New Roman</FontName>

<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>14</Size>

<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>

<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>

<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>

<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<!-- <DefaultCharacter>*</DefaultCharacter> -->

<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>

0 comments on commit b3d0ed9

Please sign in to comment.