/// <summary> /// Draws the explosion across the screen. /// </summary> /// <param name="args"></param> public override void Draw(DrawingArgs args) { // Dark-screen everything Paint.FilledRectangle(0, 0, VideoManager.ScreenSize.Width, VideoManager.ScreenSize.Height, Color.FromArgb(222, 64, 0, 0)); // Get the saved text ThemeFont stf0 = ThemeManager.Theme.Fonts["end-of-game"]; ThemeFont stf1 = ThemeManager.Theme.Fonts["stats"]; float height = ((FreeTypeFont) stf1.Font).LineHeight; float middleY = VideoManager.ScreenSize.Height / 2; stf0.Font.Print("Game Over", Color.White, VideoManager.ScreenSize.Width / 2, 1 * VideoManager.ScreenSize.Height / 4, stf0.Alignment); stf1.Font.Print("Population Saved:", Color.White, VideoManager.ScreenSize.Width / 2, middleY, stf1.Alignment); stf1.Font.Print(State.Score.PopulationSaved.ToString("N0"), Color.White, VideoManager.ScreenSize.Width / 2, middleY + height, stf1.Alignment); }
/// <summary> /// Draws out the particle with the given drawable at the /// particle's position. /// </summary> public void Draw(IDrawable drawable, DrawingArgs args) { double ratio = secondsRemaining / Constants.MaxSwarmParticleLife; Color c = Color.FromArgb((int) (ratio * 255.0), Color.White); PointF p = new PointF(CurrentX, CurrentY); drawable.Draw(p, c, args.BackendDrawingArgs); }
/// <summary> /// Renders the universe currently loaded into the screen, /// then passes the rendering for the HUD to overlay it. /// </summary> /// <param name="args"></param> public override void DrawViewport( DrawingArgs args, RectangleF bounds) { // Set the player point screenPoint.X = bounds.X + bounds.Width / 2; screenPoint.Y = bounds.Y + 3 * bounds.Height / 4; // Adjust for the player's angle playerPoint = State.Player.Point; // If we need it, draw the outline of the physics object //RenderJunctions(); RenderJunctionShape(); // Render all the mobiles foreach (Mobile m in State.Physics.Mobiles) Render(m); // See if we need to add any physics objects foreach (Mobile m in State.JunctionManager.Junction.Mobiles) { if (!State.Physics.Mobiles.Contains(m)) { // Add this mobile to the physics State.Physics.Mobiles.Add(m); } } }
/// <summary> /// Draws out all the swarms on the screen. /// </summary> private void DrawSwarms(DrawingArgs args) { // Draw the hearts if we have something if (heartSwarm.Count > 0) { // Get the drawable IDrawable id = AssetLoader.Instance .CreateDrawable(Constants.MiniHeartName); // Draw out the swarm foreach (SwarmParticle sp in heartSwarm) { sp.Draw(id, args); } } // Draw the hearts if we have something if (starSwarm.Count > 0) { // Get the drawable IDrawable id = AssetLoader.Instance .CreateDrawable(Constants.MiniStarName); // Draw out the swarm foreach (SwarmParticle sp in starSwarm) { sp.Draw(id, args); } } }
/// <summary> /// Renders the stuff intended for the foreground. /// </summary> public void DrawForeground(DrawingArgs args) { // Add the night tint if (night > 0) { int nightAlpha = (int)(night * 255 * 0.25); args.Backend.DrawFilledRectangle( new RectangleF(PointF.Empty, size), Color.FromArgb(nightAlpha, Color.Black)); } // Add the dusk tint if (dusk > 0) { int duskAlpha = (int)(dusk * 255 * 0.25); args.Backend.DrawFilledRectangle( new RectangleF(PointF.Empty, size), Color.FromArgb(duskAlpha, Color.DarkOrange)); } // Add the dawn tint if (dawn > 0) { int dawnAlpha = (int)(dawn * 255 * 0.25); args.Backend.DrawFilledRectangle( new RectangleF(PointF.Empty, size), Color.FromArgb(dawnAlpha, Color.Pink)); } }
/// <summary> /// Draws out the particle with the given drawable at the /// particle's position. /// </summary> public void Draw(IDrawable drawable, DrawingArgs args) { double ratio = secondsRemaining / Constants.MaxSwarmParticleLife; Color c = Color.FromArgb((int)(ratio * 255.0), Color.White); PointF p = new PointF(CurrentX, CurrentY); drawable.Draw(p, c, args.BackendDrawingArgs); }
/// <summary> /// Sets and renders the viewport, then adds the HUD data on /// top of it. /// </summary> /// <param name="args"></param> public override void Draw(DrawingArgs args) { // Reset our clear color BooGame.Core.ClearColor = new BooGame.Video.ColorF((float) State.Score.Stress / 2, 0, 0); // Get the theme and render using it Theme theme = ThemeManager.Theme; theme.Render(Theme.UniverseLayout, this, args); }
/// <summary> /// Renders the screen by passing it ot the theme engine. /// </summary> /// <param name="args"></param> public override void Draw(DrawingArgs args) { // Dark-screen everything Paint.FilledRectangle(0, 0, VideoManager.ScreenSize.Width, VideoManager.ScreenSize.Height, Color.FromArgb(222, 0, 0, 0)); // Get the theme and render using it Theme theme = ThemeManager.Theme; theme.Render(Theme.TitleLayout, this, args); }
/// <summary> /// Overrides the drawing routines. /// </summary> /// <param name="args"></param> public override void Draw(DrawingArgs args) { // Save our coordinate screenPoint = new PointF( prayerViewport.Point.X + args.ScreenOffsetX, prayerViewport.Point.Y + args.ScreenOffsetY); // Update the prayer data UpdatePrayers(); // Perform the basic drawing base.Draw(args); }
/// <summary> /// Indicates to the loaded game mode that it should /// perform any drawing routines. /// </summary> /// <param name="args"></param> public static void Draw() { // Set the backend DrawingArgs args = new DrawingArgs(); args.Backend = backend; // Check for game mode if (gameMode != null) { gameMode.Draw(args); } }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { // Center the texture float x = (screenSize.Width - texture.Width) / 2; float y = (screenSize.Height - texture.Height) / 2; // Build up the tint color Color c = Color.FromArgb(255, (int)(255 * fade), (int)(255 * fade), (int)(255 * fade)); // Draw the texture texture.Draw(x, y, c); }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { // Draw out the viewport environment.DrawBackground(args); viewport.Draw(args); environment.DrawForeground(args); // Add a dark screen to obscure it slightly args.Backend.DrawFilledRectangle( new RectangleF(sprites.Point, sprites.Size), Color.FromArgb(192, Color.Black)); // Draw out the sprites sprites.Draw(args); }
/// <summary> /// Renders the stuff intended for the background. /// </summary> public void DrawBackground(DrawingArgs args) { // Draw the background sprites sprites[0].Draw(args); // Figure out the day colors if (day > 0) { int dayAlpha = (int)Math.Min(255, day * 255); Color day1 = Color.FromArgb(dayAlpha, Color.DarkBlue); Color day2 = Color.FromArgb(dayAlpha, Color.SkyBlue); args.Backend.DrawGradientRectangle( new RectangleF(PointF.Empty, size), day1, day1, day2, day2); } // Add the dusk if (dusk > 0) { int duskAlpha = (int)(dusk * 255 * 0.5); Color dusk1 = Color.FromArgb(duskAlpha, Color.Red); Color dusk2 = Color.FromArgb(duskAlpha, Color.Orange); args.Backend.DrawGradientRectangle( new RectangleF(PointF.Empty, size), dusk1, dusk1, dusk2, dusk2); } // Add the dawn if (dawn > 0) { int dawnAlpha = (int)(dawn * 255 * 0.5); Color dawn1 = Color.FromArgb(dawnAlpha, Color.Pink); Color dawn2 = Color.FromArgb(dawnAlpha, Color.Gray); args.Backend.DrawGradientRectangle( new RectangleF(PointF.Empty, size), dawn1, dawn1, dawn2, dawn2); } // Draw the background sprites sprites[1].Draw(args); }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { // Draw the background environment.DrawBackground(args); // See if we have a minor mode bool hasMinorMode = minorMode != null; // Check for a stack if (!hasMinorMode && currentStack != null) { // Add the grab stack AddGrabStack(); } // Pass it on to the sprites MoveSpeechSprites(args); sprites.Draw(args); // Clear out the minor mode stuff if (!hasMinorMode) { // Remove it RemoveGrabStack(); } // If we have a minor mode, first screen out everything if (hasMinorMode) { // Draw a rectangle args.Backend.DrawFilledRectangle( new RectangleF(sprites.Point, sprites.Size), minorMode.BackgroundColor); // Draw the backend mode minorMode.Draw(args); } // Draw the swarms DrawSwarms(args); environment.DrawForeground(args); }
/// <summary> /// Moves the speech sprites appropriately for drawing. /// </summary> /// <param name="args"></param> private void MoveSpeechSprites(DrawingArgs args) { foreach (Prayer prayer in Game.State.Prayers) { // Ignore if we don't have it if (!speechSprites.Contains(prayer)) { continue; } // Move the sprite PrayerSpeechSprite pss = speechSprites[prayer]; PointF p = blockViewport.ToPoint( prayer.X, prayer.Y, prayer.BottomPosition); p.X += blockViewport.BlockWidth - blockViewport.BlockWidth / 3; p.Y -= 2 * blockViewport.BlockOffsetZ; pss.Point = p; } }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public virtual void Draw(DrawingArgs args) { // Draw the sprites sprites.Draw(args); }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public virtual void Draw(DrawingArgs args) { // Draw the sprites sprites.Draw(args); }
/// <summary> /// Renders out the screen, using the callback to fill in the /// gaps. /// </summary> public void Render( string layout, IThemeCallback callback, DrawingArgs args) { // Get the layout if (!layouts.Contains(layout)) throw new Exception("Theme does not have the " + layout + " layout"); // Set up the context ThemeContext context = new ThemeContext(); context.DrawingArgs = args; context.Callback = callback; context.ScreenSize = VideoManager.ScreenSize; context.Theme = this; context["width"] = context.ScreenSize.Width; context["height"] = context.ScreenSize.Height; if (State.Score != null) { context["distance"] = State.Score.Distance; context["countdown"] = State.Score.CountdownString; context["popsaved"] = State.Score.PopulationSaved; context["popkilled"] = State.Score.PopulationKilled; context["percentpopsaved"] = State.Score.PercentageSavedString; context["speed"] = State.Score.Speed; context["maxspeed"] = State.Score.MaximumSpeed; context["speedfmt"] = State.Score.SpeedString; context["maxspeedfmt"] = State.Score.MaximumSpeedString; } // Get it ThemeLayout tl = layouts[layout]; tl.Render(context); }
/// <summary> /// Internal function to display the contents of the viewport. /// </summary> public void DrawViewport(DrawingArgs args, RectangleF bounds) { // Figure out the center of our viewport PointF center = new PointF( (bounds.Left + bounds.Right) / 2, (bounds.Top + bounds.Bottom) / 2); // Put the current one right in the middle ThemeFont tf = ThemeManager.Theme.Fonts["menu"]; float height = ((BooGame.Video.FreeTypeFont) tf.Font).LineHeight; tf.Font.Print(items[index], Color.White, center.X, center.Y, tf.Alignment); // Add the item above and below it ThemeFont stf = ThemeManager.Theme.Fonts["smallmenu"]; stf.Font.Print(items[GetIndex(index - 1)], Color.FromArgb(128, 255, 255, 255), center.X, center.Y - 55, stf.Alignment); stf.Font.Print(items[GetIndex(index + 1)], Color.FromArgb(128, 255, 255, 255), center.X, center.Y + height, stf.Alignment); }
public override void Draw(DrawingArgs args) { // Draw the heart if we haven't been accepted if (!Prayer.IsAccepted) { // Start by drawing the speech bubble base.Draw(args); // Get the heart drawable, large if the mouse is over it if (isMouseOver) { IDrawable hd = AssetLoader.Instance.CreateDrawable("Heart"); PointF point = new PointF( Point.X + args.ScreenOffsetX + 1, Point.Y + args.ScreenOffsetY + 20); hd.Draw(point, Color.White, args.BackendDrawingArgs); } else { // Show the mini heart IDrawable hd = AssetLoader.Instance .CreateDrawable("Half Heart"); PointF point = new PointF( Point.X + args.ScreenOffsetX + 15, Point.Y + args.ScreenOffsetY + 45); hd.Draw(point, Color.White, args.BackendDrawingArgs); } } else { // See if we have no more seconds if (secondsLeft < 0) { topDown = null; return; } // Figure out the alpha channel stuff double delta = secondsLeft / Constants.PrayerSpeechFade; Color c = Color.FromArgb((int) (delta * 255), 255, 255, 255); // Start by drawing the speech bubble base.Draw(args, c); // See if we have a viewport to accept if (topDown == null) { // Create the top-down element topDown = new TopDownViewport(Prayer.Board); topDown.BlockFilter = IndicatorsViewport.FilterConstruction; // Set up the initial point PointF point = new PointF( Point.X + args.ScreenOffsetX + 13, Point.Y + args.ScreenOffsetY + 73); topDown.Point = point; // Scale the viewport to fit int cols = prayer.Board.Columns; int rows = prayer.Board.Rows; float width = 80 - topDown.Margin * 2 - topDown.Padding * (cols - 1); float height = 80 - topDown.Margin * 2 - topDown.Padding * (rows - 1); width = Math.Min(width, height); topDown.BlockWidth = width / (float) cols; topDown.BlockHeight = width / (float) rows; } // Perform the drawing topDown.Draw(args, delta); } }
public void Draw(DrawingArgs args) { sprites.Draw(args); }
/// <summary> /// Moves the speech sprites appropriately for drawing. /// </summary> /// <param name="args"></param> private void MoveSpeechSprites(DrawingArgs args) { foreach (Prayer prayer in Game.State.Prayers) { // Ignore if we don't have it if (!speechSprites.Contains(prayer)) continue; // Move the sprite PrayerSpeechSprite pss = speechSprites[prayer]; PointF p = blockViewport.ToPoint( prayer.X, prayer.Y, prayer.BottomPosition); p.X += blockViewport.BlockWidth - blockViewport.BlockWidth / 3; p.Y -= 2 * blockViewport.BlockOffsetZ; pss.Point = p; } }
public void Draw(DrawingArgs args) { sprites.Draw(args); }
/// <summary> /// Internal function to display the contents of the viewport. /// </summary> public void DrawViewport(DrawingArgs args, RectangleF bounds) { // See if we have our line heights calculated if (!hasCalculatedLineHeights) CalculateLineHeights(ThemeManager.Theme); // Set the rendering rate so lineRate lines advance every // second. screenRate = ((BooGame.Video.FreeTypeFont) ThemeManager.Theme.Fonts["p"] .Font).LineHeight * lineRate; // Figure out what the top line would be, assuming the // position is at the bottom of the screen since we scroll // up. float topPosition = position - bounds.Height; // Render out all the text bool displayedLines = false; foreach (TextScrollLine tsl in lines) { // See if the line would be visible if (tsl.Position + tsl.Height < topPosition) // Above the screen continue; if (tsl.Position > position) // Below the screen continue; // Display the font displayedLines = true; tsl.Font.Font.Print(tsl.Line, Color.White, bounds.X, tsl.Position - topPosition, tsl.Font.Alignment); } // If we haven't displayed a line, we are done if (!displayedLines && position > lines.Count * 10) SwitchToNext(); }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { // Center the texture float x = (screenSize.Width - texture.Width) / 2; float y = (screenSize.Height - texture.Height) / 2; // Build up the tint color Color c = Color.FromArgb(255, (int) (255 * fade), (int) (255 * fade), (int) (255 * fade)); // Draw the texture texture.Draw(x, y, c); }
/// <summary> /// Renders the universe currently loaded into the screen, /// then passes the rendering for the HUD to overlay it. /// </summary> /// <param name="args"></param> public override void DrawViewport( DrawingArgs args, RectangleF bounds) { BooGame.Video.Paint.FilledRectangle(bounds, Color.DarkGray); }
/// <summary> /// Internal function to display the contents of the viewport. /// </summary> public abstract void DrawViewport( DrawingArgs args, RectangleF bounds);
public static void Draw(Object sender, DrawingArgs e) { }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { // Draw the background environment.DrawBackground(args); // See if we have a minor mode bool hasMinorMode = minorMode != null; // Check for a stack if (!hasMinorMode && currentStack != null) { // Add the grab stack AddGrabStack(); } // Pass it on to the sprites MoveSpeechSprites(args); sprites.Draw(args); // Clear out the minor mode stuff if (!hasMinorMode) { // Remove it RemoveGrabStack(); } // If we have a minor mode, first screen out everything if (hasMinorMode) { // Draw a rectangle args.Backend.DrawFilledRectangle( new RectangleF(sprites.Point, sprites.Size), minorMode.BackgroundColor); // Draw the backend mode minorMode.Draw(args); } // Draw the swarms DrawSwarms(args); environment.DrawForeground(args); }
public override void Draw(DrawingArgs args) { // Draw the heart if we haven't been accepted if (!Prayer.IsAccepted) { // Start by drawing the speech bubble base.Draw(args); // Get the heart drawable, large if the mouse is over it if (isMouseOver) { IDrawable hd = AssetLoader.Instance.CreateDrawable("Heart"); PointF point = new PointF( Point.X + args.ScreenOffsetX + 1, Point.Y + args.ScreenOffsetY + 20); hd.Draw(point, Color.White, args.BackendDrawingArgs); } else { // Show the mini heart IDrawable hd = AssetLoader.Instance .CreateDrawable("Half Heart"); PointF point = new PointF( Point.X + args.ScreenOffsetX + 15, Point.Y + args.ScreenOffsetY + 45); hd.Draw(point, Color.White, args.BackendDrawingArgs); } } else { // See if we have no more seconds if (secondsLeft < 0) { topDown = null; return; } // Figure out the alpha channel stuff double delta = secondsLeft / Constants.PrayerSpeechFade; Color c = Color.FromArgb((int)(delta * 255), 255, 255, 255); // Start by drawing the speech bubble base.Draw(args, c); // See if we have a viewport to accept if (topDown == null) { // Create the top-down element topDown = new TopDownViewport(Prayer.Board); topDown.BlockFilter = IndicatorsViewport.FilterConstruction; // Set up the initial point PointF point = new PointF( Point.X + args.ScreenOffsetX + 13, Point.Y + args.ScreenOffsetY + 73); topDown.Point = point; // Scale the viewport to fit int cols = prayer.Board.Columns; int rows = prayer.Board.Rows; float width = 80 - topDown.Margin * 2 - topDown.Padding * (cols - 1); float height = 80 - topDown.Margin * 2 - topDown.Padding * (rows - 1); width = Math.Min(width, height); topDown.BlockWidth = width / (float)cols; topDown.BlockHeight = width / (float)rows; } // Perform the drawing topDown.Draw(args, delta); } }
/// <summary> /// Draws out all the swarms on the screen. /// </summary> private void DrawSwarms(DrawingArgs args) { // Draw the hearts if we have something if (heartSwarm.Count > 0) { // Get the drawable IDrawable id = AssetLoader.Instance .CreateDrawable(Constants.MiniHeartName); // Draw out the swarm foreach (SwarmParticle sp in heartSwarm) { sp.Draw(id, args); } } // Draw the hearts if we have something if (starSwarm.Count > 0) { // Get the drawable IDrawable id = AssetLoader.Instance .CreateDrawable(Constants.MiniStarName); // Draw out the swarm foreach (SwarmParticle sp in starSwarm) { sp.Draw(id, args); } } }
/// <summary> /// Overrides the drawing routines. /// </summary> /// <param name="args"></param> public override void Draw(DrawingArgs args) { // Save our coordinate screenPoint = new PointF( prayerViewport.Point.X + args.ScreenOffsetX, prayerViewport.Point.Y + args.ScreenOffsetY); // Update the prayer data UpdatePrayers(); // Perform the basic drawing base.Draw(args); }
/// <summary> /// Indicates to the loaded game mode that it should /// perform any drawing routines. /// </summary> /// <param name="args"></param> public static void Draw() { // Set the backend DrawingArgs args = new DrawingArgs(); args.Backend = backend; // Check for game mode if (gameMode != null) gameMode.Draw(args); }
/// <summary> /// Renders the stuff intended for the foreground. /// </summary> public void DrawForeground(DrawingArgs args) { // Add the night tint if (night > 0) { int nightAlpha = (int) (night * 255 * 0.25); args.Backend.DrawFilledRectangle( new RectangleF(PointF.Empty, size), Color.FromArgb(nightAlpha, Color.Black)); } // Add the dusk tint if (dusk > 0) { int duskAlpha = (int) (dusk * 255 * 0.25); args.Backend.DrawFilledRectangle( new RectangleF(PointF.Empty, size), Color.FromArgb(duskAlpha, Color.DarkOrange)); } // Add the dawn tint if (dawn > 0) { int dawnAlpha = (int) (dawn * 255 * 0.25); args.Backend.DrawFilledRectangle( new RectangleF(PointF.Empty, size), Color.FromArgb(dawnAlpha, Color.Pink)); } }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { }
/// <summary> /// Renders the stuff intended for the background. /// </summary> public void DrawBackground(DrawingArgs args) { // Draw the background sprites sprites[0].Draw(args); // Figure out the day colors if (day > 0) { int dayAlpha = (int) Math.Min(255, day * 255); Color day1 = Color.FromArgb(dayAlpha, Color.DarkBlue); Color day2 = Color.FromArgb(dayAlpha, Color.SkyBlue); args.Backend.DrawGradientRectangle( new RectangleF(PointF.Empty, size), day1, day1, day2, day2); } // Add the dusk if (dusk > 0) { int duskAlpha = (int) (dusk * 255 * 0.5); Color dusk1 = Color.FromArgb(duskAlpha, Color.Red); Color dusk2 = Color.FromArgb(duskAlpha, Color.Orange); args.Backend.DrawGradientRectangle( new RectangleF(PointF.Empty, size), dusk1, dusk1, dusk2, dusk2); } // Add the dawn if (dawn > 0) { int dawnAlpha = (int) (dawn * 255 * 0.5); Color dawn1 = Color.FromArgb(dawnAlpha, Color.Pink); Color dawn2 = Color.FromArgb(dawnAlpha, Color.Gray); args.Backend.DrawGradientRectangle( new RectangleF(PointF.Empty, size), dawn1, dawn1, dawn2, dawn2); } // Draw the background sprites sprites[1].Draw(args); }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { }
/// <summary> /// Triggers a rendering of the game mode. /// </summary> /// <param name="args"></param> public void Draw(DrawingArgs args) { // Draw out the viewport environment.DrawBackground(args); viewport.Draw(args); environment.DrawForeground(args); // Add a dark screen to obscure it slightly args.Backend.DrawFilledRectangle( new RectangleF(sprites.Point, sprites.Size), Color.FromArgb(192, Color.Black)); // Draw out the sprites sprites.Draw(args); }