Skip to content

Instantly share code, notes, and snippets.

@JoshClose
Created October 30, 2017 20:04
Show Gist options
  • Save JoshClose/61aec280fe5816fdc1010ceb3d403d13 to your computer and use it in GitHub Desktop.
Save JoshClose/61aec280fe5816fdc1010ceb3d403d13 to your computer and use it in GitHub Desktop.
MonoGame draw issue
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