summaryrefslogtreecommitdiff
path: root/DisplayEngine.cs
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-04 12:07:39 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-04 12:07:39 +1000
commit72f297a479b6749674ec80e91be53b8c482123d2 (patch)
tree05465784b2b5b5adbd695b50e8394c6f78e3a455 /DisplayEngine.cs
parent86452af2d48e2d1883dbfd67316e371f2a593bfe (diff)
crowbar
Diffstat (limited to 'DisplayEngine.cs')
-rw-r--r--DisplayEngine.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/DisplayEngine.cs b/DisplayEngine.cs
index f77598f..f983226 100644
--- a/DisplayEngine.cs
+++ b/DisplayEngine.cs
@@ -10,6 +10,7 @@ namespace Q1Emu;
public class DisplayEngine : Game
{
private readonly Action<Texture2D> _onScreenTextureLoaded;
+ private readonly Action _requestUpdate;
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
@@ -18,12 +19,13 @@ public class DisplayEngine : Game
public int Width { get; }
public int Height { get; }
- public DisplayEngine(int width, int height, int scaling, Action<Texture2D> onScreenTextureLoaded)
+ public DisplayEngine(int width, int height, int scaling, Action<Texture2D> 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";
@@ -61,6 +63,8 @@ public class DisplayEngine : Game
{
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);