public void late_repeatedly_execute_always() { if (IsGamePaused()) { return; } if (!Cars[0].IsInit) { return; } if (DisplayDebugInfo) { String s1 = StringFormatAGS("Accel: %.2f; Power: %.2f; Brake: %.2f; Drive force: %.2f; Impact: %.2f[", Cars[0].Accelerator, Cars[0].EnginePower, Cars[0].brakePower, Cars[0].driveWheelForce, Cars[0].infoImpact.length()); String s2 = StringFormatAGS("Pos: %.2f, %.2f; Dir: (%.2f) %.2f, %.2f; Velocity: (%.2f) %.2f, %.2f[", Cars[0].position.x, Cars[0].position.y, Cars[0].direction.angle(), Cars[0].direction.x, Cars[0].direction.y, Cars[0].velocity.length(), Cars[0].velocity.x, Cars[0].velocity.y); String s3 = StringFormatAGS("Grip: %.2f; AirRes: %.2f; SlideFrict: %.2f; RollFrict: %.2f; CustomTerRes: %.2f; Antiroll: %.2f, Antislide: %.2f[", Cars[0].driveWheelGrip, Track.AirResistance, Cars[0].envSlideFriction, Cars[0].envRollFriction, Cars[0].envResistance, Cars[0].infoRollAntiforce, Cars[0].infoSlideAntiforce); String s4 = StringFormatAGS("Steer angle: %.2f, Angular velocity: %.2f, Turning accel: (%.2f) %.2f, %.2f", Cars[0].steeringWheelAngle, Cars[0].angularVelocity, Cars[0].turningAccel.length(), Cars[0].turningAccel.x, Cars[0].turningAccel.y); lblCarPos.Text = s1.Append(s2); lblCarPos.Text = lblCarPos.Text.Append(s3); lblCarPos.Text = lblCarPos.Text.Append(s4); } if (DisplayDebugOverlay) { int xoff = -GetViewportX(); int yoff = -GetViewportY(); DrawingSurface ds = debugOver.GetDrawingSurface(); ds.Clear(COLOR_TRANSPARENT); int i = 0; for (i = 0; i < MAX_RACING_CARS; i += 1) { if (!Cars[i].IsInit) { continue; } ds.DrawingColor = Game.GetColorFromRGB(255, 0, 255); float dirx = Cars[i].direction.x * 100.0f; float diry = Cars[i].direction.y * 100.0f; ds.DrawLine(Cars[i].c.x + xoff, Cars[i].c.y + yoff, Cars[i].c.x + FloatToInt(dirx, eRoundNearest) + xoff, Cars[i].c.y + FloatToInt(diry, eRoundNearest) + yoff); ds.DrawingColor = Game.GetColorFromRGB(0, 255, 255); dirx = Cars[i].velocity.x * 0.4f; diry = Cars[i].velocity.y * 0.4f; ds.DrawLine(Cars[i].c.x + xoff, Cars[i].c.y + yoff, Cars[i].c.x + FloatToInt(dirx, eRoundNearest) + xoff, Cars[i].c.y + FloatToInt(diry, eRoundNearest) + yoff); ds.DrawingColor = Game.GetColorFromRGB(255, 0, 0); ds.DrawLine(FloatToInt(Cars[i].collPoint[0].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[0].y, eRoundNearest) + yoff, FloatToInt(Cars[i].collPoint[1].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[1].y, eRoundNearest) + yoff); ds.DrawLine(FloatToInt(Cars[i].collPoint[1].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[1].y, eRoundNearest) + yoff, FloatToInt(Cars[i].collPoint[2].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[2].y, eRoundNearest) + yoff); ds.DrawLine(FloatToInt(Cars[i].collPoint[2].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[2].y, eRoundNearest) + yoff, FloatToInt(Cars[i].collPoint[3].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[3].y, eRoundNearest) + yoff); ds.DrawLine(FloatToInt(Cars[i].collPoint[3].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[3].y, eRoundNearest) + yoff, FloatToInt(Cars[i].collPoint[0].x, eRoundNearest) + xoff, FloatToInt(Cars[i].collPoint[0].y, eRoundNearest) + yoff); } ds.Release(); } if (DisplayDebugAI) { UpdateDebugAI(); } else if (DisplayDebugRace) { UpdateDebugRace(); } LastViewportX = GetViewportX(); LastViewportY = GetViewportY(); }
public void Create(float perc) { this.Remove(); float sys_w = IntToFloat(system.ViewportWidth); float sys_h = IntToFloat(system.ViewportHeight); this.Width2 = (sys_w * perc / 100.0f) / 2.0f; float w = sys_w * perc / 100.0f; float h = sys_h * perc / 100.0f; this.Width2 = w / 2.0f; this.Height2 = h / 2.0f; float x = CameraData.CameraX - this.Width2; float y = CameraData.CameraY - this.Height2; this.Rect = DynamicSprite.Create(FloatToInt(w), FloatToInt(h), false); DrawingSurface ds = this.Rect.GetDrawingSurface(); ds.Clear(); ds.DrawingColor = Game.GetColorFromRGB(0, 50, 200); ds.DrawFrame(0, 0, ds.Width - 1, ds.Height - 1); ds.DrawString(2, 2, eFontNotalot35Regular12, StringFormatAGS("Zoom: %0.1f%%", perc)); ds.Release(); this.O = Overlay.CreateGraphical(FloatToInt(x, eRoundNearest) - GetViewportX(), FloatToInt(y, eRoundNearest) - GetViewportY(), this.Rect.Graphic, true); }
public void UpdateDebugAI() { DrawingSurface ds = debugAI.GetDrawingSurface(); ds.Clear(); if (ActiveAIType == eAIPaths) { UpdateDebugAIPaths(ds); } else if (ActiveAIType == eAIRegions) { UpdateDebugAIRegions(ds); } ds.Release(); }
public void UpdateDebugRace() { DrawingSurface ds = debugAI.GetDrawingSurface(); ds.Clear(); if (CheckptCount == 0) { return; } int from = 0; int to = 0; from = 0; to = MAX_CHECKPOINTS; int i = 0; for (i = from; i < to; i += 1) { if (Checkpoints[i].pt == null) { continue; } VectorF pt = Checkpoints[i].pt; int x = FloatToInt(pt.x, eRoundNearest) - GetViewportX(); int y = FloatToInt(pt.y, eRoundNearest) - GetViewportY(); if (x >= 0 && x <= system.ViewportWidth && y >= 0 && y <= system.ViewportHeight) { if (SelectedPathNode == i) { ds.DrawingColor = Game.GetColorFromRGB(0, 255, 255); } else { ds.DrawingColor = Game.GetColorFromRGB(0, 0, 255); } ds.DrawCircle(x, y, DEBUG_AI_NODE_RADIUS); } int prev = Checkpoints[i].prev; if (prev >= 0) { VectorF ptprev = Checkpoints[prev].pt; ds.DrawingColor = Game.GetColorFromRGB(0, 0, 255); ds.DrawLine(x, y, FloatToInt(ptprev.x, eRoundNearest) - GetViewportX(), FloatToInt(ptprev.y, eRoundNearest) - GetViewportY()); } if (x >= 0 && x <= system.ViewportWidth && y >= 0 && y <= system.ViewportHeight) { ds.DrawingColor = Game.GetColorFromRGB(225, 225, 225); ds.DrawString(x + 10, y, eFontNotalot35Regular12, StringFormatAGS("#%d: %.2f,%.2f", i, pt.x, pt.y)); ds.DrawString(x + 10, y + GetFontLineSpacing(eFontNotalot35Regular12), eFontNotalot35Regular12, StringFormatAGS("Order: %d", Checkpoints[i].order)); } } if (FirstCheckpt != LastCheckpt) { ds.DrawingColor = Game.GetColorFromRGB(255, 255, 0); int x1 = FloatToInt(Checkpoints[FirstCheckpt].pt.x, eRoundNearest) - GetViewportX(); int y1 = FloatToInt(Checkpoints[FirstCheckpt].pt.y, eRoundNearest) - GetViewportY(); int x2 = FloatToInt(Checkpoints[LastCheckpt].pt.x, eRoundNearest) - GetViewportX(); int y2 = FloatToInt(Checkpoints[LastCheckpt].pt.y, eRoundNearest) - GetViewportY(); ds.DrawLine(x1, y1, x2, y2); } ds.DrawingColor = Game.GetColorFromRGB(200, 200, 200); for (i = 0; i < MAX_RACING_CARS; i += 1) { if (!Cars[i].IsInit || !Racers[i].IsActive) { continue; } VectorF pos = Cars[i].position; VectorF target = Checkpoints[Racers[i].CurRaceNode].pt; if (pos == null || target == null) { continue; } int x1 = FloatToInt(pos.x, eRoundNearest) - GetViewportX(); int y1 = FloatToInt(pos.y, eRoundNearest) - GetViewportY(); int x2 = FloatToInt(target.x, eRoundNearest) - GetViewportX(); int y2 = FloatToInt(target.y, eRoundNearest) - GetViewportY(); ds.DrawLine(x1, y1, x2, y2); } ds.Release(); }
private void PrintName() { nameTitle.Clear(); nameTitle.Print(0, 0, "Name", Settings.Green); nameTitle.Print(0, 1, entity.Name, Settings.Blue); }
public void ArrangeMenu() { if (SprOptions == null) { SprOptions = DynamicSprite.Create(gGameMenu.Width, gGameMenu.Height); } DrawingSurface ds = SprOptions.GetDrawingSurface(); ds.Clear(); int y = 0; switch (MenuType) { case eMenuLogin: if (PlatformService.IsSigningIn) { SilverFont.DrawTextCentered($"Signing into {PlatformService.ServiceName}", ds, 0, STARTMENU_OPTION_POS_TOP, 640); } else { if (System.OperatingSystem == eOSXboxUWP) { SilverFont.DrawTextCentered("Press A", ds, 0, STARTMENU_OPTION_POS_TOP, 640); } else { SilverFont.DrawTextCentered("Press Any Key", ds, 0, STARTMENU_OPTION_POS_TOP, 640); } MMOptionCount = 1; } break; case eMenuStart: SilverFont.DrawText("Start", ds, STARTMENU_OPTION_X, STARTMENU_OPTION_POS_TOP); SilverFont.DrawText("Credits", ds, STARTMENU_OPTION_X, STARTMENU_OPTION_POS_TOP + STARTMENU_OPTION_SPACING); SilverFont.DrawText("Quit", ds, STARTMENU_OPTION_X, STARTMENU_OPTION_POS_TOP + STARTMENU_OPTION_SPACING * 2); MMOptionCount = 3; if (PlatformService.IsSignedIn) { PurpleItalicFont.DrawTextCentered(PlatformService.GamerTag, ds, 0, STARTMENU_OPTION_POS_TOP - 20, 640); } break; case eMenuMain: SilverFont.DrawText("Race", ds, OPTION_X, OPTION_POS_TOP); SilverFont.DrawText("Watch Demo", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING); SilverFont.DrawText("Music", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 2); SilverFont.DrawText("Quit", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 3); MMOptionCount = 4; break; case eMenuMainInGame: SilverFont.DrawText("Continue", ds, OPTION_X, OPTION_POS_TOP); SilverFont.DrawText("Restart", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING); SilverFont.DrawText("Music", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 2); SilverFont.DrawText("Quit", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 3); MMOptionCount = 4; break; case eMenuSetupRace: SilverFont.DrawText("Go!", ds, OPTION_X, OPTION_POS_TOP); SilverFont.DrawText("Driver", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING); SilverFont.DrawText("Laps", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 2); SilverFont.DrawText("Opponents", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 3); SilverFont.DrawText("Physics", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 4); SilverFont.DrawText("Collisions", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 5); SilverFont.DrawText("Back", ds, OPTION_X, OPTION_POS_TOP + OPTION_SPACING * 6); MMOptionCount = 7; break; case eMenuCredits: ds.DrawingColor = Game.GetColorFromRGB(11, 15, 54); ds.DrawRectangle(0, 0, 640, 400); y = 40; PurpleItalicFont.DrawTextCentered("CODE", ds, 0, y, ds.Width); y += PurpleItalicFont.Height + 10; AzureItalicFont.DrawTextCentered("Crimson Wizard", ds, 0, y, ds.Width); y += 40; PurpleItalicFont.DrawTextCentered("ART & TECH IDEAS", ds, 0, y, ds.Width); y += PurpleItalicFont.Height + 10; AzureItalicFont.DrawTextCentered("Jim Reed", ds, 0, y, ds.Width); y += 40; PurpleItalicFont.DrawTextCentered("MUSIC", ds, 0, y, ds.Width); y += PurpleItalicFont.Height + 10; AzureItalicFont.DrawTextCentered("\"Car Theft 101\" by Eric Matyas", ds, 0, y, ds.Width); y += AzureItalicFont.Height; AzureItalicFont.DrawTextCentered("www.soundimage.org", ds, 0, y, ds.Width); y += AzureItalicFont.Height + 10; AzureItalicFont.DrawTextCentered("\"Welcome to the Show\" by Kevin MacLeod", ds, 0, y, ds.Width); y += AzureItalicFont.Height; AzureItalicFont.DrawTextCentered("incompetech.com", ds, 0, y, ds.Width); y += AzureItalicFont.Height + 40; PurpleItalicFont.DrawTextCentered("PORT TO C# / XAGE", ds, 0, y, ds.Width); y += PurpleItalicFont.Height + 10; AzureItalicFont.DrawTextCentered("Dan Alexander", ds, 0, y, ds.Width); y += 40; PurpleItalicFont.DrawTextCentered("Press any key to continue", ds, 0, STARTMENU_OPTION_POS_TOP + STARTMENU_OPTION_SPACING * 2, ds.Width); break; } ds.Release(); if (MenuType != eMenuCredits) { UpdateOptionValues(); } btnMenuOptions.NormalGraphic = SprOptions.Graphic; btnMenuOptions.Visible = true; if (MenuType == eMenuLogin) { btnMMSelector.Visible = false; btnMMVrStrip.Visible = false; gUnderlay.Visible = false; } else if (MenuType == eMenuStart) { btnMMSelector.NormalGraphic = 1; btnMMSelector.Visible = true; btnMMVrStrip.Visible = false; gUnderlay.Visible = false; } else if (MenuType == eMenuCredits) { btnMMSelector.Visible = false; btnMMVrStrip.Visible = false; gUnderlay.Visible = false; } else { btnMMSelector.NormalGraphic = 4; btnMMSelector.Visible = true; btnMMVrStrip.Visible = true; gUnderlay.Visible = true; } }