diff --git a/Sandbox/BeefProj.toml b/Sandbox/BeefProj.toml index 7551d14..5aa6328 100644 --- a/Sandbox/BeefProj.toml +++ b/Sandbox/BeefProj.toml @@ -6,3 +6,6 @@ Name = "Sandbox" TargetType = "BeefGUIApplication" StartupObject = "GlitchyEngine.Program" ProcessorMacros = ["NOT_GAMMA_TEST", "SANDBOX_2D"] + +[Platform.Windows] +IconFile = "$(ProjectDir)/content/RocketGame/RocketIcon.ico" diff --git a/Sandbox/content/RocketGame/RocketIcon.ico b/Sandbox/content/RocketGame/RocketIcon.ico new file mode 100644 index 0000000..018e755 Binary files /dev/null and b/Sandbox/content/RocketGame/RocketIcon.ico differ diff --git a/Sandbox/src/GameLayer.bf b/Sandbox/src/GameLayer.bf index 4b06dea..9116add 100644 --- a/Sandbox/src/GameLayer.bf +++ b/Sandbox/src/GameLayer.bf @@ -35,6 +35,8 @@ namespace Sandbox FontRenderer.PreparedText pressSpaceToStart ~ _.ReleaseRef(); FontRenderer.PreparedText pressSpaceToRestart ~ _.ReleaseRef(); + ColorHSV worldColor = .(0, 0.5f, 1.0f); + [AllowAppend] public this() : base("Example") { @@ -88,7 +90,7 @@ namespace Sandbox Vector4 v = .(); v.X = startRandom.Next(-1000, 1000) / 2000f * _camera.Width; v.Y = startRandom.Next(-1000, 1000) / 2000f * _camera.Height; - v.Z = startRandom.Next(0, 999) / 1000.0f; + v.Z = startRandom.Next(0, 1000) / 2000.0f; v.W = startRandom.Next(1000, 3000) / 1000.0f; points[i] = v; @@ -98,7 +100,12 @@ namespace Sandbox private float lastObstacle = 0.0f; public override void Update(GameTime gameTime) - { + { + worldColor.H += gameTime.DeltaTime * 18 * _rocket.FlightSpeed; + worldColor.H %= 360.0f; + + ColorRGBA wColor = .((ColorRGB)worldColor, 1.0f); + float screenWidth = _camera.Width; Obstacle.ScreenWidth = screenWidth / 2.0f; @@ -147,19 +154,23 @@ namespace Sandbox Renderer2D.BeginScene(_camera, .BackToFront); - Renderer2D.DrawQuad(Vector3(0, 2.75f, 1), Vector2(screenWidth, 1), 0, .White); + Renderer2D.DrawQuad(Vector3(0, 2.75f, 1), Vector2(screenWidth, 1), 0, wColor); - Renderer2D.DrawQuad(Vector3(0, -2.75f, 1), Vector2(screenWidth, 1), 0, .White); + Renderer2D.DrawQuad(Vector3(0, -2.75f, 1), Vector2(screenWidth, 1), 0, wColor); for (Obstacle obs in _obstacles) { - obs.Draw(); + obs.Draw(wColor); } _rocket.Draw(); - FontRenderer.DrawText(_font, scope $"{_rocket.Score}", 0, 1.5f, 1, .Black); - FontRenderer.DrawText(_font, scope $"{_rocket.Score}", 0.1f, 1.6f, 1, .(230, 230, 230)); + var scorePrep = FontRenderer.PrepareText(_font, scope $"{_rocket.Score}", 1.0f); + + FontRenderer.DrawText(scorePrep, -scorePrep.AdvanceX / 2, 1.5f, .Black); + FontRenderer.DrawText(scorePrep, -scorePrep.AdvanceX / 2 + 0.1f, 1.6f, .(230, 230, 230)); + + scorePrep.ReleaseRef(); if (!_rocket.Started) { diff --git a/Sandbox/src/Obstacle.bf b/Sandbox/src/Obstacle.bf index c1656df..2d3ada1 100644 --- a/Sandbox/src/Obstacle.bf +++ b/Sandbox/src/Obstacle.bf @@ -31,16 +31,16 @@ namespace Sandbox static Matrix mat = Matrix.Scaling(2.5f, 5, 1) * Matrix.RotationZ(MathHelper.PiOverFour); - public void Draw() + public void Draw(ColorRGBA color) { Matrix matty = mat; matty.Translation.X = Position.X; matty.Translation.Y = Position.Y - HoleSize; - Renderer2D.DrawQuad(matty, Color.White); + Renderer2D.DrawQuad(matty, color); matty.Translation.Y = Position.Y + HoleSize; - Renderer2D.DrawQuad(matty, Color.White); + Renderer2D.DrawQuad(matty, color); } } } \ No newline at end of file diff --git a/Sandbox/src/Rocket.bf b/Sandbox/src/Rocket.bf index 9174917..9de04b1 100644 --- a/Sandbox/src/Rocket.bf +++ b/Sandbox/src/Rocket.bf @@ -138,11 +138,11 @@ namespace Sandbox _speed = newSpeed; _position = newPosition; - float ang = Math.Atan2(_speed.Y, 10) - MathHelper.PiOverTwo; + float ang = Math.Atan2(_speed.Y, 5) - MathHelper.PiOverTwo; _rotation = ang; - _direction = Vector2.Normalize(_speed + .(10, 0)); + _direction = Vector2.Normalize(_speed + .(5, 0)); _rocketLine = .(_position - _direction / 2.8f, _position + _direction / 2.4f); } diff --git a/Sandbox/src/SandboxApp.bf b/Sandbox/src/SandboxApp.bf index 8e8ecbb..cf82f1d 100644 --- a/Sandbox/src/SandboxApp.bf +++ b/Sandbox/src/SandboxApp.bf @@ -18,6 +18,9 @@ namespace Sandbox { public this() { + Window.Title = "Single Stage to Highscore"; + Window.SetIcon("content/RocketGame/RocketIcon.ico"); + /*#if GAMMA_TEST PushLayer(new GammaTestLayer()); #elif SANDBOX_2D