|
@ -1,9 +1,9 @@ |
|
|
using Microsoft.Xna.Framework; |
|
|
using Microsoft.Xna.Framework; |
|
|
using Microsoft.Xna.Framework.Content; |
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics; |
|
|
using Microsoft.Xna.Framework.Graphics; |
|
|
|
|
|
using System; |
|
|
|
|
|
|
|
|
namespace SemiColinGames { |
|
|
namespace SemiColinGames { |
|
|
class Scene { |
|
|
|
|
|
|
|
|
class Scene : IDisposable { |
|
|
public bool Enabled = false; |
|
|
public bool Enabled = false; |
|
|
|
|
|
|
|
|
Color backgroundColor = Color.CornflowerBlue; |
|
|
Color backgroundColor = Color.CornflowerBlue; |
|
@ -14,7 +14,6 @@ namespace SemiColinGames { |
|
|
readonly RenderTarget2D sceneTarget; |
|
|
readonly RenderTarget2D sceneTarget; |
|
|
readonly RenderTarget2D lightingTarget; |
|
|
readonly RenderTarget2D lightingTarget; |
|
|
readonly BasicEffect lightingEffect; |
|
|
readonly BasicEffect lightingEffect; |
|
|
|
|
|
|
|
|
readonly SpriteBatch spriteBatch; |
|
|
readonly SpriteBatch spriteBatch; |
|
|
|
|
|
|
|
|
public Scene(GraphicsDevice graphics, Camera camera) { |
|
|
public Scene(GraphicsDevice graphics, Camera camera) { |
|
@ -37,6 +36,17 @@ namespace SemiColinGames { |
|
|
spriteBatch = new SpriteBatch(graphics); |
|
|
spriteBatch = new SpriteBatch(graphics); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
~Scene() { |
|
|
|
|
|
Dispose(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Dispose() { |
|
|
|
|
|
sceneTarget.Dispose(); |
|
|
|
|
|
lightingTarget.Dispose(); |
|
|
|
|
|
lightingEffect.Dispose(); |
|
|
|
|
|
spriteBatch.Dispose(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void Draw(World world, Player player, LinesOfSight linesOfSight) { |
|
|
public void Draw(World world, Player player, LinesOfSight linesOfSight) { |
|
|
graphics.SetRenderTarget(null); |
|
|
graphics.SetRenderTarget(null); |
|
|
graphics.Clear(backgroundColor); |
|
|
graphics.Clear(backgroundColor); |
|
|