refactor: Removed Unnecessary Lines

This commit is contained in:
Syntriax 2024-01-22 11:21:27 +03:00
parent dd9950d6c5
commit 0e922bb600
2 changed files with 11 additions and 7 deletions

7
Game/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"cSpell.words": [
"AABB",
"DAABB",
"Syntriax"
]
}

View File

@ -1,5 +1,5 @@
using System; using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
@ -9,7 +9,6 @@ using Pong.Behaviours;
using Syntriax.Engine.Core; using Syntriax.Engine.Core;
using Syntriax.Engine.Core.Abstract; using Syntriax.Engine.Core.Abstract;
using Syntriax.Engine.Graphics.TwoDimensional; using Syntriax.Engine.Graphics.TwoDimensional;
using Syntriax.Engine.Input;
using Syntriax.Engine.Physics2D; using Syntriax.Engine.Physics2D;
using Syntriax.Engine.Physics2D.Primitives; using Syntriax.Engine.Physics2D.Primitives;
@ -25,6 +24,8 @@ public class Game1 : Game
public Game1() public Game1()
{ {
engine = new PhysicsEngine2D();
_graphics = new GraphicsDeviceManager(this) _graphics = new GraphicsDeviceManager(this)
{ {
PreferredBackBufferWidth = 1024, PreferredBackBufferWidth = 1024,
@ -47,7 +48,6 @@ public class Game1 : Game
protected override void LoadContent() protected override void LoadContent()
{ {
engine = new PhysicsEngine2D();
_spriteBatch = new SpriteBatch(GraphicsDevice); _spriteBatch = new SpriteBatch(GraphicsDevice);
spriteBox = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Pixel") }; spriteBox = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Pixel") };
@ -60,7 +60,7 @@ public class Game1 : Game
gameManager.Camera = gameObjectCamera.BehaviourController.AddBehaviour<CameraBehaviour>(); gameManager.Camera = gameObjectCamera.BehaviourController.AddBehaviour<CameraBehaviour>();
gameManager.Camera.Viewport = GraphicsDevice.Viewport; gameManager.Camera.Viewport = GraphicsDevice.Viewport;
gameObjectBall = gameManager.InstantiateGameObject<GameObject>(); GameObject gameObjectBall = gameManager.InstantiateGameObject<GameObject>();
gameObjectBall.Name = "Ball"; gameObjectBall.Name = "Ball";
gameObjectBall.Transform.Position = Vector2.Zero; gameObjectBall.Transform.Position = Vector2.Zero;
gameObjectBall.Transform.Scale = new Vector2(1f / 51.2f, 1f / 51.2f); gameObjectBall.Transform.Scale = new Vector2(1f / 51.2f, 1f / 51.2f);
@ -171,7 +171,6 @@ public class Game1 : Game
{ {
physicsTimer += 0.01f; physicsTimer += 0.01f;
engine.Step(.01f); engine.Step(.01f);
Console.WriteLine($"{physicsTimer} -> {gameObjectBall.Transform.Position}");
} }
} }
if (Keyboard.GetState().IsKeyDown(Keys.M)) if (Keyboard.GetState().IsKeyDown(Keys.M))
@ -181,7 +180,6 @@ public class Game1 : Game
{ {
physicsTimer -= 0.01f; physicsTimer -= 0.01f;
engine.Step(-.01f); engine.Step(-.01f);
Console.WriteLine($"{physicsTimer} -> {gameObjectBall.Transform.Position}");
} }
} }
if (Keyboard.GetState().IsKeyDown(Keys.Space)) if (Keyboard.GetState().IsKeyDown(Keys.Space))
@ -217,7 +215,6 @@ public class Game1 : Game
} }
static float physicsTimer = 0f; static float physicsTimer = 0f;
static float seconds = 0f; static float seconds = 0f;
private GameObject gameObjectBall;
protected override void Draw(GameTime gameTime) protected override void Draw(GameTime gameTime)
{ {