/// <summary> /// Render /// </summary> /// <param name="spriteBatch">sb</param> public void render(SpriteBatch spriteBatch) { _FPS[_curFPS] = (int)(1f / FlxG.elapsed); if (++_curFPS >= _FPS.Length) { _curFPS = 0; } _fpsUpdate = !_fpsUpdate; if (_fpsUpdate) { int fps = 0; for (int i = 0; i < _FPS.Length; i++) { fps += _FPS[i]; } _consoleFPS.text = ((int)Math.Floor((double)(fps / _FPS.Length))).ToString() + " fps"; } spriteBatch.Draw(FlxG.XnaSheet, _consoleRect, _srcRect, _consoleColor); spriteBatch.Draw(FlxG.XnaSheet, _titleSafeRect, _srcRect, notTitleSafeColor); _consoleText.render(spriteBatch); _consoleFPS.render(spriteBatch); _consoleCommand.render(spriteBatch); vcr.render(spriteBatch); if (canTypeCheat) { _consoleCheatActivated.render(spriteBatch); } }
public override void render(SpriteBatch spriteBatch) { openSprite.render(spriteBatch); pauseSprite.render(spriteBatch); playSprite.render(spriteBatch); recordSprite.render(spriteBatch); restartSprite.render(spriteBatch); stopSprite.render(spriteBatch); infoText.render(spriteBatch); base.render(spriteBatch); }
override public void render(SpriteBatch spriteBatch) { if (visible) { if (_border) { outline.render(spriteBatch); } emptyBar.render(spriteBatch); filledBar.render(spriteBatch); _text.render(spriteBatch); } }
/// <summary> /// Render all the elements. /// </summary> /// <param name="spriteBatch"></param> public void render(SpriteBatch spriteBatch) { spriteBatch.Draw(FlxG.XnaSheet, _consoleRect, _srcRect, _consoleColor); hudGroup.render(spriteBatch); p1HudText.render(spriteBatch); p2HudText.render(spriteBatch); p3HudText.render(spriteBatch); p4HudText.render(spriteBatch); keyboardButton.render(spriteBatch); ouyaButton.render(spriteBatch); xboxButton.render(spriteBatch); keyboardDirection.render(spriteBatch); ouyaDirection.render(spriteBatch); xboxDirection.render(spriteBatch); }
public void render(SpriteBatch spriteBatch) { spriteBatch.Draw(FlxG.XnaSheet, _pauseRect, new Rectangle(1, 1, 1, 1), _pauseColor); _pauseText.render(spriteBatch); spriteBatch.Draw(_imgKeyX, _posKeyX, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyX, new Vector2(_posKeyX.X + (14 * _pauseScale), _posKeyX.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKeyC, _posKeyC, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyC, new Vector2(_posKeyC.X + (14 * _pauseScale), _posKeyC.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); #if !XBOX360 spriteBatch.Draw(_imgKeyMouse, _posKeyMouse, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyMouse, new Vector2(_posKeyMouse.X + (14 * _pauseScale), _posKeyMouse.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); #endif spriteBatch.Draw(_imgKeysArrows, _posKeysArrows, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeysArrows, new Vector2(_posKeysArrows.X + (43 * _pauseScale), _posKeysArrows.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKeyMinus, _posKeyMinus, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyMinus, new Vector2(_posKeyMinus.X + (14 * _pauseScale), _posKeyMinus.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKeyPlus, _posKeyPlus, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyPlus, new Vector2(_posKeyPlus.X + (14 * _pauseScale), _posKeyPlus.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKey0, _posKey0, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKey0, new Vector2(_posKey0.X + (14 * _pauseScale), _posKey0.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKey1, _posKey1, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKey1, new Vector2(_posKey1.X + (14 * _pauseScale), _posKey1.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); }
/// <summary> /// Render /// </summary> /// <param name="spriteBatch"></param> override public void render(SpriteBatch spriteBatch) { base.render(spriteBatch); if ((_off != null) && _off.exists && _off.visible) { _off.render(spriteBatch); } if ((_on != null) && _on.exists && _on.visible) { _on.render(spriteBatch); } if (_offT != null) { if ((_offT != null) && _offT.exists && _offT.visible) { _offT.render(spriteBatch); } if ((_onT != null) && _onT.exists && _onT.visible) { _onT.render(spriteBatch); } } }
//Rendering public override void Draw(GameTime gameTime) { //Render the screen to our internal game-sized back buffer. GraphicsDevice.SetRenderTarget(backRender); if (FlxG.state != null) { FlxG.state.preProcess(FlxG.spriteBatch); FlxG.state.render(FlxG.spriteBatch); FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); if (FlxG.flash.exists) { FlxG.flash.render(FlxG.spriteBatch); } if (FlxG.fade.exists) { FlxG.fade.render(FlxG.spriteBatch); } if (FlxG.mouse.cursor.visible) { FlxG.mouse.cursor.render(FlxG.spriteBatch); } FlxG.spriteBatch.End(); FlxG.state.postProcess(FlxG.spriteBatch); } //Render sound tray if necessary if (_soundTrayVisible || _paused) { FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); //GraphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MipFilter = TextureFilter.Point; if (_soundTrayVisible) { FlxG.spriteBatch.Draw(FlxG.XnaSheet, _soundTrayRect, new Rectangle(1, 1, 1, 1), _console.color); _soundCaption.render(FlxG.spriteBatch); for (int i = 0; i < _soundTrayBars.Length; i++) { _soundTrayBars[i].render(FlxG.spriteBatch); } } if (_paused) { _pausePanel.render(FlxG.spriteBatch); } FlxG.spriteBatch.End(); } GraphicsDevice.SetRenderTarget(null); //Copy the result to the screen, scaled to fit GraphicsDevice.Clear(FlxG.backColor); FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); //GraphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MipFilter = TextureFilter.Point; FlxG.spriteBatch.Draw(backRender, new Rectangle(targetLeft + _quakeOffset.X, _quakeOffset.Y, targetWidth, GraphicsDevice.Viewport.Height), Color.White); //Render console if necessary if (_console.visible) { _console.render(FlxG.spriteBatch); } FlxG.spriteBatch.End(); }
public void render(SpriteBatch spriteBatch) { spriteBatch.Draw(FlxG.XnaSheet, _pauseRect, new Rectangle(1, 1, 1, 1), _pauseColor); _pauseText.render(spriteBatch); #if __ANDROID__ spriteBatch.DrawString(FlxG.Font, "Press Y To Exit", new Vector2(_posKeyX.X + (14 * _pauseScale), _posKeyX.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); #endif #if !__ANDROID__ string game = "slf"; if (game == "slf") { spriteBatch.Draw(_imgKeysArrows, _posKeysArrows, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeysArrows, new Vector2(_posKeysArrows.X + (43 * _pauseScale), _posKeysArrows.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.DrawString(FlxG.Font, "X = Jump", new Vector2(_posKeyX.X + (14 * _pauseScale), _posKeyX.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.DrawString(FlxG.Font, "Down+C = Pick Up Crate", new Vector2(_posKeyC.X + (14 * _pauseScale), _posKeyC.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.DrawString(FlxG.Font, "C = Throw Crate", new Vector2(_posKeyMinus.X + (14 * _pauseScale), _posKeyMinus.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.DrawString(FlxG.Font, "V = Switch Characters", new Vector2(_posKeyPlus.X + (14 * _pauseScale), _posKeyPlus.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.DrawString(FlxG.Font, "B = End Piggyback", new Vector2(_posKey0.X + (14 * _pauseScale), _posKey0.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.DrawString(FlxG.Font, "ESC = Return to Menu", new Vector2(_posKey1.X + (14 * _pauseScale), _posKey1.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); } if (game == "mode") { spriteBatch.Draw(_imgKeyX, _posKeyX, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyX, new Vector2(_posKeyX.X + (14 * _pauseScale), _posKeyX.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKeyC, _posKeyC, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyC, new Vector2(_posKeyC.X + (14 * _pauseScale), _posKeyC.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); #if !XBOX360 spriteBatch.Draw(_imgKeyMouse, _posKeyMouse, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyMouse, new Vector2(_posKeyMouse.X + (14 * _pauseScale), _posKeyMouse.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); #endif spriteBatch.Draw(_imgKeysArrows, _posKeysArrows, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeysArrows, new Vector2(_posKeysArrows.X + (43 * _pauseScale), _posKeysArrows.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKeyMinus, _posKeyMinus, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyMinus, new Vector2(_posKeyMinus.X + (14 * _pauseScale), _posKeyMinus.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKeyPlus, _posKeyPlus, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKeyPlus, new Vector2(_posKeyPlus.X + (14 * _pauseScale), _posKeyPlus.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKey0, _posKey0, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKey0, new Vector2(_posKey0.X + (14 * _pauseScale), _posKey0.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); spriteBatch.Draw(_imgKey1, _posKey1, null, Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0f); spriteBatch.DrawString(FlxG.Font, _strKey1, new Vector2(_posKey1.X + (14 * _pauseScale), _posKey1.Y), Color.White, 0, Vector2.Zero, _pauseScale, SpriteEffects.None, 0); } #endif }
/// <summary> /// The Main Rendering part. /// Uses two different SpriteBatches, /// To Do: Have Bloom effect both spritebatches. /// </summary> /// <param name="gameTime">Game time.</param> public override void Draw(GameTime gameTime) { //Render the screen to our internal game-sized back buffer. GraphicsDevice.SetRenderTarget(backRender); if (FlxG.state != null) { FlxG.state.preProcess(FlxG.spriteBatch); FlxG.state.render(FlxG.spriteBatch); FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); if (FlxG.flash.exists) { FlxG.flash.render(FlxG.spriteBatch); } if (FlxG.fade.exists) { FlxG.fade.render(FlxG.spriteBatch); } if (FlxG.mouse.cursor.visible) { FlxG.mouse.cursor.render(FlxG.spriteBatch); } FlxG.spriteBatch.End(); FlxG.state.postProcess(FlxG.spriteBatch); } //Render sound tray if necessary if (_soundTrayVisible || _paused) { FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); //GraphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MipFilter = TextureFilter.Point; if (_soundTrayVisible) { FlxG.spriteBatch.Draw(FlxG.XnaSheet, _soundTrayRect, new Rectangle(1, 1, 1, 1), _console.color); _soundCaption.render(FlxG.spriteBatch); for (int i = 0; i < _soundTrayBars.Length; i++) { _soundTrayBars[i].render(FlxG.spriteBatch); } } if (_paused) { _pausePanel.render(FlxG.spriteBatch); } FlxG.spriteBatch.End(); } //FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive); //var new_pos = new Vector2(50,50); //FlxG.spriteBatch.Draw(lightmask, new_pos, Color.White); //FlxG.spriteBatch.Draw(lightmask, new Vector2(10,100), Color.White); //FlxG.spriteBatch.End(); GraphicsDevice.SetRenderTarget(null); //Copy the result to the screen, scaled to fit GraphicsDevice.Clear(FlxG.backColor); FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); //GraphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Point; //GraphicsDevice.SamplerStates[0].MipFilter = TextureFilter.Point; // This was the original spritebatch.Draw //FlxG.spriteBatch.Draw(backRender, // new Rectangle(targetLeft + _quakeOffset.X, _quakeOffset.Y, targetWidth, GraphicsDevice.Viewport.Height), // Color.White); // If there are no cameras in the array, render the normal spriteBatch. if (FlxG.cameras.Count == 0) { // This is the new SpriteBatch.Draw the draws with the FlxG.angle // Adjust a full screen /* * 60 + targetLeft + _quakeOffset.X + FlxG.width, * 40 + _quakeOffset.Y + FlxG.height, */ FlxG.spriteBatch.Draw(backRender, new Rectangle( FlxG.borderWidth + targetLeft + _quakeOffset.X + FlxG.width, FlxG.borderHeight + _quakeOffset.Y + FlxG.height, targetWidth, GraphicsDevice.Viewport.Height), null, _color, FlxG.angle, new Vector2(FlxG.width / FlxG.zoom, FlxG.height / FlxG.zoom), SpriteEffects.None, 0f); } // if there are cameras in the FlxG.cameras array, render them here. else { /* * foreach (Viewport vp in viewports) * { * Rectangle r2 = new Rectangle(0,0,GraphicsDevice.Viewport.Width * 2,GraphicsDevice.Viewport.Height * 2); * * FlxG.spriteBatch.GraphicsDevice.Viewport = vp; * FlxG.spriteBatch.Draw(backRender, r2, Color.White); * } */ /* * foreach (FlxCamera cam in FlxG.cameras) * { * Rectangle r2 = new Rectangle( * (targetLeft + _quakeOffset.X + FlxG.width) + (int)cam.x * FlxG.zoom, * (_quakeOffset.Y + FlxG.height) + (int)cam.y * FlxG.zoom, * targetWidth, * GraphicsDevice.Viewport.Height); * * FlxG.spriteBatch.Draw(backRender, * r2, * null, * cam.color, * cam.angle, * new Vector2(FlxG.width / FlxG.zoom, FlxG.height / FlxG.zoom), * SpriteEffects.None, * 0f); * } */ } // Add cameras here. /* * FlxG.spriteBatch.Draw(backRender, * new Rectangle((targetLeft + _quakeOffset.X + FlxG.width)/2, (_quakeOffset.Y + FlxG.height)/2, (targetWidth)/2, (GraphicsDevice.Viewport.Height)/2), * null, * _color, * FlxG.angle, * new Vector2(FlxG.width / FlxG.zoom, FlxG.height / FlxG.zoom), * SpriteEffects.None, * 0f); */ //Render console if necessary if (_console.visible) { _console.render(FlxG.spriteBatch); } // Render hud if neccessary. if (hud.visible) { hud.render(FlxG.spriteBatch); } // Render transition if neccessary, and render on this layer above everything. if (FlxG.transition.exists) { FlxG.transition.render(FlxG.spriteBatch); } FlxG.spriteBatch.End(); }