using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace LunaLightXMG { public class Game1 : Game { private GraphicsDeviceManager graphics; private SpriteBatch spriteBatch; // Test Render Target private RenderTarget2D renderTarget; private Rectangle renderDestination; // Native retro scale private int retroWidth = 320; private int retroHeight = 180; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; //Window.ClientSizeChanged += OnClientSizeChanged; // Jensen can implement Window.AllowUserResizing = true; IsMouseVisible = true; } protected override void Initialize() { // Set initial window size graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; graphics.ApplyChanges(); base.Initialize(); //CalculateRenderDestination(); // Jensen can implement } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); // Test Render Target renderTarget = new RenderTarget2D(GraphicsDevice, retroWidth, retroHeight); } protected override void Update(GameTime gameTime) { // Temporary quit game - eventually handle in a pause menu class if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); // TODO: Add your update logic here base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // Test Render Target - Draw sprites to the render target GraphicsDevice.SetRenderTarget(renderTarget); // Test Sprite spriteBatch.Begin(samplerState: SamplerState.PointClamp); // Draw sprites here spriteBatch.End(); // Test Render Target - Draw render target to the screen GraphicsDevice.SetRenderTarget(null); spriteBatch.Begin(samplerState: SamplerState.PointClamp); spriteBatch.Draw(renderTarget, renderDestination, Color.White); spriteBatch.End(); base.Draw(gameTime); } } }