Skip to content

Commit

Permalink
ChunkStorage and InputManager is no more singleton now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hüseyin Uslu committed Jan 15, 2013
1 parent e6b7e79 commit 87ffdbd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
11 changes: 0 additions & 11 deletions src/Engine/Chunks/ChunkStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public class ChunkStorage : GameComponent, IChunkStorage
public ChunkStorage(Game game)
: base(game)
{
_instance = this;
this.Game.Services.AddService(typeof (IChunkStorage), this); // export service.
}

Expand Down Expand Up @@ -129,15 +128,5 @@ public IEnumerable<Chunk> Values
{
get { return this._dictionary.Values; }
}

private static ChunkStorage _instance; // The memory instance of ChunkStorage.

/// <summary>
/// The memory instance of ChunkStorage.
/// </summary>
public static ChunkStorage Instance
{
get { return _instance; }
}
}
}
5 changes: 4 additions & 1 deletion src/Engine/Debugging/Console/InputProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Input;
using VoxeliqEngine.Core;
using VoxeliqEngine.Input;

namespace VoxeliqEngine.Debugging.Console
Expand Down Expand Up @@ -39,7 +40,9 @@ public InputProcessor(CommandProcesser commandProcesser)
CommandHistory = new CommandHistory();
Out = new List<OutputLine>();
Buffer = new OutputLine("", OutputLineType.Command);
InputManager.Instance.KeyDown += new InputManager.KeyEventHandler(OnKeyDown);

var inputManager = (IInputManager)Engine.Instance.Game.Services.GetService(typeof(IInputManager));
inputManager.KeyDown += new InputManager.KeyEventHandler(OnKeyDown);
}

public void AddToBuffer(string text)
Expand Down
13 changes: 2 additions & 11 deletions src/Engine/Input/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public interface IInputManager
/// Should the mouse cursor centered on screen?
/// </summary>
bool CursorCentered { get; }

event InputManager.KeyEventHandler KeyDown;
}

/// <summary>
Expand Down Expand Up @@ -69,7 +71,6 @@ public InputManager(Game game)
: base(game)
{
this.Game.Services.AddService(typeof (IInputManager), this); // export service.
_instance = this;

this.CaptureMouse = true; // capture the mouse by default.
this.CursorCentered = true; // center the mouse by default.
Expand Down Expand Up @@ -206,15 +207,5 @@ private void CenterCursor()
public delegate void KeyEventHandler(object sender, KeyEventArgs e);

public event KeyEventHandler KeyDown;

private static InputManager _instance; // the instance.

/// <summary>
/// Returns the memory instance of AssetManager.
/// </summary>
public static InputManager Instance
{
get { return _instance; }
}
}
}

0 comments on commit 87ffdbd

Please sign in to comment.