From aa70d99e31d284e01f909385d6f55f7c89e986c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Mon, 14 Feb 2022 20:36:48 +0100 Subject: [PATCH] Fin --- Sandbox/BeefProj.toml | 3 +++ Sandbox/content/RocketGame/RocketIcon.ico | Bin 0 -> 5694 bytes Sandbox/src/GameLayer.bf | 25 ++++++++++++++++------ Sandbox/src/Obstacle.bf | 6 +++--- Sandbox/src/Rocket.bf | 4 ++-- Sandbox/src/SandboxApp.bf | 3 +++ 6 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 Sandbox/content/RocketGame/RocketIcon.ico 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 0000000000000000000000000000000000000000..018e7551528661ea493913b0c11495ca5189b121 GIT binary patch literal 5694 zcmeI0YfKbZ6vzL&EW_^dUfwJe1>_-)6yzx_+Lo3_ffi^%@kK#eluGf{meK_jrDEkF z_yFmHQk#&dZ8hrt9~$PLSn3v)aVBjQ51yp{=bA=&#ps_OB^)?(f5yGiMMI5`vw(cH^ht$8q7(Z@6*e2C}oW zF+4nsM~@!i;>C;jdF)R-c<=xT2?^M-V+UelVsL2mM+^-Op`oDx5fKqMdiD}JJ3DdW z#0lKGbqi0PJVASVJ5HZIjjLC$qN}S5$B!S!{rmTkl$3-E7cO98VgeNv6=-g5MoLNw z>gwtc8X5|Je}9yfmErd7+h}QNL3ejIPMtc1lP6DNbaWJzm6f=D{W@xE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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