Compare commits

..

2 Commits

Author SHA1 Message Date
811df57950 Make new IWorld interface. 2020-07-15 11:33:59 -04:00
800909394c Camera: use 1920x1080 / 4 explicitly. 2020-07-15 11:20:29 -04:00
6 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,7 @@ using System;
namespace SemiColinGames {
public class Camera {
// Screen size in pixels is 1920x1080 divided by 4.
private Rectangle bbox = new Rectangle(0, 0, 480, 270);
private Rectangle bbox = new Rectangle(0, 0, 1920 / 4, 1080 / 4);
public int Width { get => bbox.Width; }
public int Height { get => bbox.Height; }
public int Left { get => bbox.Left; }

8
Shared/IWorld.cs Normal file
View File

@ -0,0 +1,8 @@
using System;
namespace SemiColinGames {
public interface IWorld : IDisposable {
void Update(float modelTime, History<Input> input);
Camera Camera { get; }
}
}

View File

@ -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);

View File

@ -12,6 +12,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Camera.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ExtensionMethods.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FSM.cs" />
<Compile Include="$(MSBuildThisFileDirectory)IWorld.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NPC.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ProfilingList.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SoundEffects.cs" />

View File

@ -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 +

View File

@ -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;