Compare commits

..

No commits in common. "56bc1abe06cc7e881cc999342cc6a287f8f2aed7" and "9b25a8a6e0c45669b51dc932a85cfb9786f49181" have entirely different histories.

7 changed files with 11 additions and 55 deletions

View File

@ -3,5 +3,6 @@
namespace SemiColinGames {
public interface IWorld : IDisposable {
void Update(float modelTime, History<Input> input);
Camera Camera { get; }
}
}

View File

@ -7,20 +7,20 @@ namespace SemiColinGames {
public sealed class Scene : IScene {
const float DESIRED_ASPECT_RATIO = 1920.0f / 1080.0f;
private readonly Color backgroundColor = Color.CornflowerBlue;
Color backgroundColor = Color.CornflowerBlue;
private readonly GraphicsDevice graphics;
private readonly Camera camera;
readonly GraphicsDevice graphics;
readonly Camera camera;
private readonly RenderTarget2D sceneTarget;
private readonly BasicEffect basicEffect;
private readonly SpriteBatch spriteBatch;
private readonly SoundEffectInstance music;
readonly RenderTarget2D sceneTarget;
readonly BasicEffect basicEffect;
readonly SpriteBatch spriteBatch;
readonly SoundEffectInstance music;
// Draw() needs to be called without IsRunningSlowly this many times before we actually
// attempt to draw the scene. This is a workaround for the fact that otherwise the first few
// frames can be really slow to draw.
private int framesToSuppress = 2;
int framesToSuppress = 2;
public Scene(GraphicsDevice graphics, Camera camera) {
this.graphics = graphics;

View File

@ -34,8 +34,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Scene.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SneakGame.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Timer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TreeScene.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TreeWorld.cs" />
<Compile Include="$(MSBuildThisFileDirectory)World.cs" />
</ItemGroup>
</Project>

View File

@ -64,11 +64,9 @@ namespace SemiColinGames {
private void LoadLevel() {
world?.Dispose();
// world = new World(GraphicsDevice, Content.LoadString("levels/demo.json"));
world = new TreeWorld();
world = new World(GraphicsDevice, Content.LoadString("levels/demo.json"));
scene?.Dispose();
// scene = new Scene(GraphicsDevice, ((World) world).Camera);
scene = new TreeScene(GraphicsDevice);
scene = new Scene(GraphicsDevice, world.Camera);
GC.Collect();
GC.WaitForPendingFinalizers();

View File

@ -1,25 +0,0 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using System;
namespace SemiColinGames {
public sealed class TreeScene : IScene {
readonly Color backgroundColor = Color.SkyBlue;
readonly GraphicsDevice graphics;
public TreeScene(GraphicsDevice graphics) {
this.graphics = graphics;
}
public void Dispose() {
GC.SuppressFinalize(this);
}
public void Draw(bool isRunningSlowly, IWorld iworld, bool paused) {
graphics.Clear(backgroundColor);
}
}
}

View File

@ -1,15 +0,0 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
namespace SemiColinGames {
public sealed class TreeWorld : IWorld {
public void Dispose() {
GC.SuppressFinalize(this);
}
public void Update(float modelTime, History<Input> input) {
}
}
}

View File

@ -26,7 +26,6 @@ namespace SemiColinGames {
public readonly int Width;
public readonly int Height;
// TODO: it seems weird that World takes in a GraphicsDevice. Remove it?
public World(GraphicsDevice graphics, string json) {
Camera = new Camera();
LinesOfSight = new LinesOfSight(graphics);