From 811df579509b02eba7b6af697ce0d4ffb3e055c6 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Wed, 15 Jul 2020 11:33:59 -0400 Subject: [PATCH] Make new IWorld interface. --- Shared/IWorld.cs | 8 ++++++++ Shared/Scene.cs | 3 ++- Shared/Shared.projitems | 1 + Shared/SneakGame.cs | 2 +- Shared/World.cs | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 Shared/IWorld.cs diff --git a/Shared/IWorld.cs b/Shared/IWorld.cs new file mode 100644 index 0000000..9776d06 --- /dev/null +++ b/Shared/IWorld.cs @@ -0,0 +1,8 @@ +using System; + +namespace SemiColinGames { + public interface IWorld : IDisposable { + void Update(float modelTime, History input); + Camera Camera { get; } + } +} diff --git a/Shared/Scene.cs b/Shared/Scene.cs index 4e929f7..39fec6c 100644 --- a/Shared/Scene.cs +++ b/Shared/Scene.cs @@ -56,7 +56,8 @@ namespace SemiColinGames { GC.SuppressFinalize(this); } - public void Draw(bool isRunningSlowly, World world, bool paused) { + public void Draw(bool isRunningSlowly, IWorld iworld, bool paused) { + World world = (World) iworld; graphics.SetRenderTarget(null); graphics.Clear(backgroundColor); diff --git a/Shared/Shared.projitems b/Shared/Shared.projitems index 7e6c612..591a9ce 100644 --- a/Shared/Shared.projitems +++ b/Shared/Shared.projitems @@ -12,6 +12,7 @@ + diff --git a/Shared/SneakGame.cs b/Shared/SneakGame.cs index f3dc04a..c6b5b3d 100644 --- a/Shared/SneakGame.cs +++ b/Shared/SneakGame.cs @@ -22,7 +22,7 @@ namespace SemiColinGames { readonly Timer drawTimer = new Timer(TARGET_FRAME_TIME / 2.0, "DrawTimer"); Scene scene; - World world; + IWorld world; public SneakGame() { Debug.WriteLine("MonoGame platform: " + PlatformInfo.MonoGamePlatform + diff --git a/Shared/World.cs b/Shared/World.cs index e52fc2e..e1bb2f5 100644 --- a/Shared/World.cs +++ b/Shared/World.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace SemiColinGames { - public sealed class World : IDisposable { + public sealed class World : IWorld { // Size of World in terms of tile grid. private int gridWidth;