This commit is contained in:
Simon Lübeß
2022-02-14 20:36:48 +01:00
parent c8cc2f442a
commit aa70d99e31
6 changed files with 29 additions and 12 deletions
+3
View File
@@ -6,3 +6,6 @@ Name = "Sandbox"
TargetType = "BeefGUIApplication" TargetType = "BeefGUIApplication"
StartupObject = "GlitchyEngine.Program" StartupObject = "GlitchyEngine.Program"
ProcessorMacros = ["NOT_GAMMA_TEST", "SANDBOX_2D"] ProcessorMacros = ["NOT_GAMMA_TEST", "SANDBOX_2D"]
[Platform.Windows]
IconFile = "$(ProjectDir)/content/RocketGame/RocketIcon.ico"
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

+17 -6
View File
@@ -35,6 +35,8 @@ namespace Sandbox
FontRenderer.PreparedText pressSpaceToStart ~ _.ReleaseRef(); FontRenderer.PreparedText pressSpaceToStart ~ _.ReleaseRef();
FontRenderer.PreparedText pressSpaceToRestart ~ _.ReleaseRef(); FontRenderer.PreparedText pressSpaceToRestart ~ _.ReleaseRef();
ColorHSV worldColor = .(0, 0.5f, 1.0f);
[AllowAppend] [AllowAppend]
public this() : base("Example") public this() : base("Example")
{ {
@@ -88,7 +90,7 @@ namespace Sandbox
Vector4 v = .(); Vector4 v = .();
v.X = startRandom.Next(-1000, 1000) / 2000f * _camera.Width; v.X = startRandom.Next(-1000, 1000) / 2000f * _camera.Width;
v.Y = startRandom.Next(-1000, 1000) / 2000f * _camera.Height; 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; v.W = startRandom.Next(1000, 3000) / 1000.0f;
points[i] = v; points[i] = v;
@@ -99,6 +101,11 @@ namespace Sandbox
public override void Update(GameTime gameTime) 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; float screenWidth = _camera.Width;
Obstacle.ScreenWidth = screenWidth / 2.0f; Obstacle.ScreenWidth = screenWidth / 2.0f;
@@ -147,19 +154,23 @@ namespace Sandbox
Renderer2D.BeginScene(_camera, .BackToFront); 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) for (Obstacle obs in _obstacles)
{ {
obs.Draw(); obs.Draw(wColor);
} }
_rocket.Draw(); _rocket.Draw();
FontRenderer.DrawText(_font, scope $"{_rocket.Score}", 0, 1.5f, 1, .Black); var scorePrep = FontRenderer.PrepareText(_font, scope $"{_rocket.Score}", 1.0f);
FontRenderer.DrawText(_font, scope $"{_rocket.Score}", 0.1f, 1.6f, 1, .(230, 230, 230));
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) if (!_rocket.Started)
{ {
+3 -3
View File
@@ -31,16 +31,16 @@ namespace Sandbox
static Matrix mat = Matrix.Scaling(2.5f, 5, 1) * Matrix.RotationZ(MathHelper.PiOverFour); static Matrix mat = Matrix.Scaling(2.5f, 5, 1) * Matrix.RotationZ(MathHelper.PiOverFour);
public void Draw() public void Draw(ColorRGBA color)
{ {
Matrix matty = mat; Matrix matty = mat;
matty.Translation.X = Position.X; matty.Translation.X = Position.X;
matty.Translation.Y = Position.Y - HoleSize; matty.Translation.Y = Position.Y - HoleSize;
Renderer2D.DrawQuad(matty, Color.White); Renderer2D.DrawQuad(matty, color);
matty.Translation.Y = Position.Y + HoleSize; matty.Translation.Y = Position.Y + HoleSize;
Renderer2D.DrawQuad(matty, Color.White); Renderer2D.DrawQuad(matty, color);
} }
} }
} }
+2 -2
View File
@@ -138,11 +138,11 @@ namespace Sandbox
_speed = newSpeed; _speed = newSpeed;
_position = newPosition; _position = newPosition;
float ang = Math.Atan2(_speed.Y, 10) - MathHelper.PiOverTwo; float ang = Math.Atan2(_speed.Y, 5) - MathHelper.PiOverTwo;
_rotation = ang; _rotation = ang;
_direction = Vector2.Normalize(_speed + .(10, 0)); _direction = Vector2.Normalize(_speed + .(5, 0));
_rocketLine = .(_position - _direction / 2.8f, _position + _direction / 2.4f); _rocketLine = .(_position - _direction / 2.8f, _position + _direction / 2.4f);
} }
+3
View File
@@ -18,6 +18,9 @@ namespace Sandbox
{ {
public this() public this()
{ {
Window.Title = "Single Stage to Highscore";
Window.SetIcon("content/RocketGame/RocketIcon.ico");
/*#if GAMMA_TEST /*#if GAMMA_TEST
PushLayer(new GammaTestLayer()); PushLayer(new GammaTestLayer());
#elif SANDBOX_2D #elif SANDBOX_2D