public GameConsoleComponent(GameConsole console, Game game, SpriteBatch spriteBatch) : base(game) { this.console = console; this.spriteBatch = spriteBatch; inputProcesser = new InputProcessor(new CommandProcesser()); inputProcesser.Open += (s, e) => renderer.Open(); inputProcesser.Close += (s, e) => renderer.Close(); renderer = new Renderer(game, spriteBatch, inputProcesser); }
/// <summary> /// Adds game-components. /// </summary> private void AddComponents() { this.Rasterizer = new Rasterizer(); this.Game.Components.Add(new InputManager(this.Game)); this.Game.Components.Add(new AssetManager(this.Game)); #if XNA //this.Game.Components.Add(new Sky(this.Game)); #endif this.Game.Components.Add(new NewSky(this.Game)); this.Game.Components.Add(new Fogger(this.Game)); var chunkStorage = new ChunkStorage(this.Game); this.Game.Components.Add(chunkStorage); var vertexBuilder = new VertexBuilder(this.Game); this.Game.Components.Add(vertexBuilder); var chunkCache = new ChunkCache(this.Game); this.Game.Components.Add(chunkCache); var blockStorage = new BlockStorage(this.Game); this.Game.Components.Add(blockStorage); var world = new World(this.Game, chunkStorage, chunkCache); this.Game.Components.Add(world); this.Game.Components.Add(new Player(this.Game, world)); this.Game.Components.Add(new Camera(this.Game)); this.Game.Components.Add(new UserInterface(this.Game)); this.Game.Components.Add(new InGameDebugger(this.Game)); this.Game.Components.Add(new DebugBar(this.Game)); this.Game.Components.Add(new GraphManager(this.Game)); #if XNA this.Game.Components.Add(new AudioManager(this.Game)); #endif var spriteBatch = new SpriteBatch(this.Game.GraphicsDevice); Console = new GameConsole(this.Game, spriteBatch, new GameConsoleOptions { Font = Game.Content.Load<SpriteFont>(@"Fonts/Verdana"), FontColor = Color.LawnGreen, Prompt = ">", PromptColor = Color.Crimson, CursorColor = Color.OrangeRed, BackgroundColor = Color.Black*0.8f, PastCommandOutputColor = Color.Aqua, BufferColor = Color.Gold }); }