using AlienAttack.MonoGame.View; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; namespace AlienAttack.MonoGame.GameLoops; internal abstract class GameLoopBase(AlienAttackGame game) : IGameLoop { protected readonly AlienAttackGame Game = game; protected readonly ContentManager Content = game.Content; protected readonly SpriteBatch SpriteBatch = game.SpriteBatch; protected readonly ViewTransform ViewTransform = game.ViewTransform; public void Draw() { SpriteBatch.Begin(transformMatrix: ViewTransform.ViewMatrix); OnDraw(); SpriteBatch.End(); } public void Update(GameTime gameTime) { OnUpdate(gameTime); } public abstract void OnDraw(); public abstract void OnUpdate(GameTime gameTime); }