Created
October 30, 2017 20:04
-
-
Save JoshClose/61aec280fe5816fdc1010ceb3d403d13 to your computer and use it in GitHub Desktop.
MonoGame draw issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Xna.Framework; | |
using Microsoft.Xna.Framework.Graphics; | |
using Microsoft.Xna.Framework.Input; | |
namespace Game1 | |
{ | |
public class Game1 : Game | |
{ | |
GraphicsDeviceManager graphics; | |
SpriteBatch spriteBatch; | |
SpriteFont hudFont; | |
public Game1() | |
{ | |
graphics = new GraphicsDeviceManager( this ); | |
Content.RootDirectory = "Content"; | |
} | |
protected override void Initialize() | |
{ | |
base.Initialize(); | |
} | |
protected override void LoadContent() | |
{ | |
spriteBatch = new SpriteBatch( GraphicsDevice ); | |
hudFont = Content.Load<SpriteFont>( "HudFont" ); | |
} | |
protected override void UnloadContent() | |
{ | |
} | |
protected override void Update( GameTime gameTime ) | |
{ | |
if( GamePad.GetState( PlayerIndex.One ).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown( Keys.Escape ) ) | |
Exit(); | |
base.Update( gameTime ); | |
} | |
protected override void Draw( GameTime gameTime ) | |
{ | |
GraphicsDevice.Clear( new Color( 255, 0, 255 ) ); | |
spriteBatch.Begin(); | |
spriteBatch.DrawString( hudFont, "this is a test", new Vector2( 0, 0 ), Color.Black ); | |
spriteBatch.End(); | |
base.Draw( gameTime ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment