public FlxRecord() { vcrGroup = new FlxGroup(); // Customizable things filename = "File"; controller = PlayerIndex.One; //int xPos = 150; int yPos = 30; openSprite = new FlxSprite(130, yPos); openSprite.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/vcr/open")); openSprite.setScrollFactors(0, 0); openSprite.debugName = "open"; vcrGroup.add(openSprite); openSprite.boundingBoxOverride = false; pauseSprite = new FlxSprite(230, yPos); pauseSprite.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/vcr/pause")); pauseSprite.setScrollFactors(0, 0); pauseSprite.debugName = "pause"; vcrGroup.add(pauseSprite); pauseSprite.boundingBoxOverride = false; playSprite = new FlxSprite(330, yPos); playSprite.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/vcr/play")); playSprite.setScrollFactors(0, 0); playSprite.debugName = "play"; vcrGroup.add(playSprite); playSprite.boundingBoxOverride = false; recordSprite = new FlxSprite(430, yPos); recordSprite.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/vcr/record_on")); recordSprite.setScrollFactors(0, 0); recordSprite.debugName = "record"; vcrGroup.add(recordSprite); recordSprite.boundingBoxOverride = false; restartSprite = new FlxSprite(530, yPos); restartSprite.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/vcr/restart")); restartSprite.setScrollFactors(0, 0); restartSprite.debugName = "restart"; vcrGroup.add(restartSprite); restartSprite.boundingBoxOverride = false; stopSprite = new FlxSprite(630, yPos); stopSprite.loadGraphic(FlxG.Content.Load <Texture2D>("flixel/vcr/stop")); stopSprite.setScrollFactors(0, 0); stopSprite.debugName = "stop"; vcrGroup.add(stopSprite); stopSprite.boundingBoxOverride = false; infoText = new FlxText(360, yPos, FlxG.width); infoText.boundingBoxOverride = false; }
/// <summary> /// Initialize the console. /// </summary> /// <param name="targetLeft">Target Left</param> /// <param name="targetWidth">Target Width</param> public FlxConsole(int targetLeft, int targetWidth) { visible = false; _FPS = new int[8]; _consoleRect = new Rectangle(FlxG.spriteBatch.GraphicsDevice.Viewport.X, 0, FlxG.spriteBatch.GraphicsDevice.Viewport.Width, FlxG.spriteBatch.GraphicsDevice.Viewport.Height); width = FlxG.spriteBatch.GraphicsDevice.Viewport.Width; height = FlxG.spriteBatch.GraphicsDevice.Viewport.Height; dx = (int)(width * 0.05); dy = (int)(height * 0.05); _titleSafeRect = new Rectangle(dx * 2, dy * 2, width - 4 * dx, height - 4 * dy); _consoleColor = new Color(0, 0, 0, 0x7F); _consoleText = new FlxText(targetLeft + (dx * 2), -800, targetWidth, "").setFormat(null, 1, Color.White, FlxJustification.Left, Color.White); _consoleText.height = FlxG.height; //FlxG.spriteBatch.GraphicsDevice.Viewport.Height; _consoleText.boundingBoxOverride = false; _consoleCommand = new FlxText(targetLeft + (dx * 2) + 50, -800, targetWidth, "").setFormat(null, 1, Color.HotPink, FlxJustification.Left, Color.Black); _consoleCommand.text = ""; _consoleCommand.boundingBoxOverride = false; _consoleCheatActivated = new FlxSprite(targetLeft + (dx * 2), -800, FlxG.Content.Load <Texture2D>("flixel/vcr/cheat_on")); _consoleCheatActivated.setScrollFactors(0, 0); _consoleCheatActivated.boundingBoxOverride = false; _consoleFPS = new FlxText(targetLeft + targetWidth - (dx * 3), -800, 30, "").setFormat(null, 2, Color.White, FlxJustification.Right, Color.White); _consoleFPS.boundingBoxOverride = false; _consoleLines = new List <string>(); MAX_CONSOLE_LINES = (FlxG.spriteBatch.GraphicsDevice.Viewport.Height / (int)(_consoleText.font.MeasureString("Qq").Y)) - 1; vcr = new FlxRecord(); }
private void renderWithOffset(SpriteBatch spriteBatch, FlxSprite obj, float localX, float localY, float localScale) { float oldX = obj.x; float oldY = obj.y; float oldScale = obj.scale; float oldScrollX = obj.scrollFactor.X; float oldScrollY = obj.scrollFactor.Y; obj.setScrollFactors(0, 0); obj.x = localX; obj.y = localY; obj.scale = localScale; obj.render(spriteBatch); obj.setScrollFactors(oldScrollX, oldScrollY); obj.x = oldX; obj.y = oldY; obj.scale = oldScale; }