Skip to content

Instantly share code, notes, and snippets.

@Kraballa
Last active August 10, 2022 06:21
Show Gist options
  • Save Kraballa/e928ea611b0727548416c325f55e841a to your computer and use it in GitHub Desktop.
Save Kraballa/e928ea611b0727548416c325f55e841a to your computer and use it in GitHub Desktop.
main game class of a basic FNA project
using Microsoft.Xna.Framework;
namespace YourNamespace
{
internal class Controller : Game
{
private static string Title = "Title";
public const int WIDTH = 1280;
public const int HEIGHT = 720;
public static Controller Instance;
private Color ClearColor { get; set; } = Color.White;
private GraphicsDeviceManager Graphics;
public Controller() : base()
{
Instance = this;
IsMouseVisible = true;
Graphics = new GraphicsDeviceManager(this);
IsFixedTimeStep = false;
Window.Title = Title;
Window.AllowUserResizing = false;
Graphics.PreferredBackBufferWidth = WIDTH;
Graphics.PreferredBackBufferHeight = HEIGHT;
Graphics.ApplyChanges();
}
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
GraphicsDevice.Clear(ClearColor);
//begin render
//...
//end render
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment