From 7a8d2bcd75d88a5429937bf551878c55e1dcf0fd Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Wed, 6 Aug 2025 22:36:34 +1000 Subject: moved everything to seperate projects, and started compiler work + push and pop instructions added --- DisplayEngine.cs | 76 -------------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 DisplayEngine.cs (limited to 'DisplayEngine.cs') diff --git a/DisplayEngine.cs b/DisplayEngine.cs deleted file mode 100644 index 3f67bed..0000000 --- a/DisplayEngine.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using Q1Emu.Chip; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; - -namespace Q1Emu; - -public class DisplayEngine : Game -{ - private readonly Action _onScreenTextureLoaded; - private readonly Action _requestUpdate; - private GraphicsDeviceManager _graphics; - private SpriteBatch _spriteBatch; - - private Texture2D _texture; - public int Scaling { get; } - public int Width { get; } - public int Height { get; } - - public DisplayEngine(int width, int height, int scaling, Action onScreenTextureLoaded, Action requestUpdate) - { - this.Width = width; - this.Height = height; - this.Scaling = scaling; - this._onScreenTextureLoaded = onScreenTextureLoaded; - this._requestUpdate = requestUpdate; - - _graphics = new GraphicsDeviceManager(this); - Content.RootDirectory = "Content"; - IsMouseVisible = true; - } - - protected override void Initialize() - { - this._texture = new Texture2D(GraphicsDevice, Width, Height); - this._onScreenTextureLoaded?.Invoke(this._texture); - // set window size - _graphics.PreferredBackBufferWidth = Width * Scaling; - _graphics.PreferredBackBufferHeight = Height * Scaling; - _graphics.ApplyChanges(); - - base.Initialize(); - } - - protected override void LoadContent() - { - _spriteBatch = new SpriteBatch(GraphicsDevice); - } - - protected override void Update(GameTime gameTime) - { - var state = Keyboard.GetState(); - - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || state.IsKeyDown(Keys.Escape)) - Exit(); - - base.Update(gameTime); - } - - protected override void Draw(GameTime gameTime) - { - // GraphicsDevice.Clear(Color.CornflowerBlue); - - this._requestUpdate(); - - _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone); - // Draw the texture to the screen - _spriteBatch.Draw(_texture, new Rectangle(0, 0, Width * Scaling, Height * Scaling), Color.White); - - _spriteBatch.End(); - - base.Draw(gameTime); - } -} \ No newline at end of file -- cgit v1.3.1