/// <summary> /// Initializes a new instance of the <see cref="BaseGame"/> class. /// </summary> /// <param name="worldBounds">The bounds of the world (if null, {-1000, -1000} to {1000, 1000} is used)</param> public BaseGame(RectangleF worldBounds = null) { if (worldBounds == null) { worldBounds = new RectangleF(-1000, -1000, 2000, 2000); } this.graphicsDeviceManager = new GraphicsDeviceManager(this); this.gameWorld = new World(this, worldBounds); this.gameCamera = new Camera(this.gameWorld); this.renderSystem = new DeferredRenderSystem(this, this.gameWorld, this.gameCamera); this.inputManager = new InputManager(this); this.exContent = new ExtendedContentManager(this); base.Content = this.exContent; this.inputManager.UpdateOrder = -40; this.gameCamera.UpdateOrder = -30; this.gameWorld.UpdateOrder = -20; this.renderSystem.UpdateOrder = -10; }
/// <summary> /// Initializes a new instance of the <see cref="IntelligentSpriteBatch"/> class. /// </summary> /// <param name="renderSystem">The render system.</param> public IntelligentSpriteBatch(DeferredRenderSystem renderSystem) { this.renderSystem = renderSystem; this.spriteBatch = new SpriteBatch(renderSystem.GraphicsDevice); }
/// <summary> /// Initializes a new instance of the <see cref="ScreenSpriteBatch"/> class. /// </summary> /// <param name="renderSystem">The render system.</param> public ScreenSpriteBatch(DeferredRenderSystem renderSystem) { this.renderSystem = renderSystem; this.spriteBatch = new SpriteBatch(renderSystem.GraphicsDevice); }
/// <summary> /// Requests that each sprite render its options map. /// </summary> /// <param name="gameTime">The game time.</param> /// <param name="renderSystem">The render system to render with.</param> internal void DrawSpriteOptions(IEnumerable <SpriteBase> sprites, GameTime gameTime, DeferredRenderSystem renderSystem) { foreach (SpriteBase curr in sprites) { if (curr.IsVisible) { curr.DrawOptionsMap(gameTime, renderSystem); } } }
/// <summary> /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its options map. /// Override this method with component-specific drawing code. /// </summary> /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param> /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param> public abstract void DrawOptionsMap(GameTime gameTime, DeferredRenderSystem renderSystem);
/// <summary> /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its normal map. /// Override this method with component-specific drawing code. /// </summary> /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param> /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param> public abstract void DrawNormalMap(GameTime gameTime, DeferredRenderSystem renderSystem);
/// <summary> /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its color map. /// Override this method with component-specific drawing code. /// </summary> /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param> /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param> public abstract void DrawColorMap(GameTime gameTime, DeferredRenderSystem renderSystem);