From b5e7121cd4eb88ae89a0075110d2cf3f06cdc6de Mon Sep 17 00:00:00 2001 From: OusmBlueNinja <89956790+OusmBlueNinja@users.noreply.github.com> Date: Fri, 18 Apr 2025 20:35:52 -0500 Subject: [PATCH] removed box2d --- .gitmodules | 5 +- remake/build.log | 80 +++---------------------- src/src/Components/PhysicsComponent.cpp | 13 ++-- src/src/Components/PhysicsComponent.h | 5 +- src/vendor/box2d | 1 - 5 files changed, 18 insertions(+), 86 deletions(-) delete mode 160000 src/vendor/box2d diff --git a/.gitmodules b/.gitmodules index 18e26d5..af59c89 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "Remake"] path = Remake - url = https://dock-it.dev/GigabiteStudios/Remake.git -[submodule "src/vendor/box2d"] - path = src/vendor/box2d - url = https://dock-it.dev/GigabiteStudios/box2d.git + url = https://dock-it.dev/GigabiteStudios/Remake.git \ No newline at end of file diff --git a/remake/build.log b/remake/build.log index 8dab3f7..c340b3f 100644 --- a/remake/build.log +++ b/remake/build.log @@ -11,43 +11,6 @@ C:/msys64/mingw64/include/yaml-cpp/dll.h:22:65: note: '#pragma message: Defining src\src\Components\PhysicsComponent.h:13:21: error: 'b2World' has not been declared 13 | void CreateBody(b2World* world, const glm::vec2& position); | ^~~~~~~ -src\src\Components\PhysicsComponent.h:13:43: error: 'glm' does not name a type - 13 | void CreateBody(b2World* world, const glm::vec2& position); - | ^~~ -src\src\Components\PhysicsComponent.h:13:52: error: expected unqualified-id before '&' token - 13 | void CreateBody(b2World* world, const glm::vec2& position); - | ^ -src\src\Components\PhysicsComponent.h:13:52: error: expected ')' before '&' token - 13 | void CreateBody(b2World* world, const glm::vec2& position); - | ~ ^ - | ) -src\src\Components\PhysicsComponent.h:13:52: error: expected ';' at end of member declaration - 13 | void CreateBody(b2World* world, const glm::vec2& position); - | ^ - | ; -src\src\Components\PhysicsComponent.h:13:54: error: 'position' does not name a type - 13 | void CreateBody(b2World* world, const glm::vec2& position); - | ^~~~~~~~ -src\src\Components\PhysicsComponent.h:16:28: error: 'glm' does not name a type - 16 | void SetVelocity(const glm::vec2& vel); - | ^~~ -src\src\Components\PhysicsComponent.h:16:37: error: expected unqualified-id before '&' token - 16 | void SetVelocity(const glm::vec2& vel); - | ^ -src\src\Components\PhysicsComponent.h:16:37: error: expected ')' before '&' token - 16 | void SetVelocity(const glm::vec2& vel); - | ~ ^ - | ) -src\src\Components\PhysicsComponent.h:16:37: error: expected ';' at end of member declaration - 16 | void SetVelocity(const glm::vec2& vel); - | ^ - | ; -src\src\Components\PhysicsComponent.h:16:39: error: 'vel' does not name a type - 16 | void SetVelocity(const glm::vec2& vel); - | ^~~ -src\src\Components\PhysicsComponent.h:17:5: error: 'glm' does not name a type - 17 | glm::vec2 GetVelocity() const; - | ^~~ src\src\Components\PhysicsComponent.h:29:5: error: 'b2Body' does not name a type; did you mean 'b2BodyId'? 29 | b2Body* body = nullptr; | ^~~~~~ @@ -59,19 +22,6 @@ src\src\Components\PhysicsComponent.h:30:5: error: 'b2World' does not name a typ src\src\Components\PhysicsComponent.h:26:10: error: 'void PhysicsComponent::OnImGuiInspector()' marked 'override', but does not override 26 | void OnImGuiInspector() override; | ^~~~~~~~~~~~~~~~ -src\src\Components\PhysicsComponent.cpp: In constructor 'PhysicsComponent::PhysicsComponent(BodyType, float, float)': -src\src\Components\PhysicsComponent.cpp:6:46: error: no matching function for call to 'Component::Component()' - 6 | : type(type), width(width), height(height) {} - | ^ -src\src\Components\Component.h:13:5: note: candidate: 'Component::Component(Object*)' - 13 | Component(Object* owner) : owner(owner) {} - | ^~~~~~~~~ -src\src\Components\Component.h:13:5: note: candidate expects 1 argument, 0 provided -src\src\Components\Component.h:11:7: note: candidate: 'constexpr Component::Component(const Component&)' - 11 | class Component { - | ^~~~~~~~~ -src\src\Components\Component.h:11:7: note: candidate expects 1 argument, 0 provided -src\src\Components\PhysicsComponent.cpp: At global scope: src\src\Components\PhysicsComponent.cpp:12:6: error: variable or field 'CreateBody' declared void 12 | void PhysicsComponent::CreateBody(b2World* world, const glm::vec2& position) { | ^~~~~~~~~~~~~~~~ @@ -92,23 +42,14 @@ src\src\Components\PhysicsComponent.cpp:39:9: error: 'body' was not declared in src\src\Components\PhysicsComponent.cpp:39:17: error: 'world' was not declared in this scope 39 | if (body && world) { | ^~~~~ -src\src\Components\PhysicsComponent.cpp: At global scope: -src\src\Components\PhysicsComponent.cpp:45:6: error: no declaration matches 'void PhysicsComponent::SetVelocity(const glm::vec2&)' - 45 | void PhysicsComponent::SetVelocity(const glm::vec2& vel) { - | ^~~~~~~~~~~~~~~~ -src\src\Components\PhysicsComponent.h:16:10: note: candidate is: 'void PhysicsComponent::SetVelocity(...) &' - 16 | void SetVelocity(const glm::vec2& vel); - | ^~~~~~~~~~~ -src\src\Components\PhysicsComponent.h:6:7: note: 'class PhysicsComponent' defined here - 6 | class PhysicsComponent : public Component { - | ^~~~~~~~~~~~~~~~ -src\src\Components\PhysicsComponent.cpp:49:11: error: no declaration matches 'glm::vec2 PhysicsComponent::GetVelocity() const' - 49 | glm::vec2 PhysicsComponent::GetVelocity() const { - | ^~~~~~~~~~~~~~~~ -src\src\Components\PhysicsComponent.cpp:49:11: note: no functions named 'glm::vec2 PhysicsComponent::GetVelocity() const' -src\src\Components\PhysicsComponent.h:6:7: note: 'class PhysicsComponent' defined here - 6 | class PhysicsComponent : public Component { - | ^~~~~~~~~~~~~~~~ +src\src\Components\PhysicsComponent.cpp: In member function 'void PhysicsComponent::SetVelocity(const glm::vec2&)': +src\src\Components\PhysicsComponent.cpp:46:9: error: 'body' was not declared in this scope + 46 | if (body) body->SetLinearVelocity(b2Vec2(vel.x, vel.y)); + | ^~~~ +src\src\Components\PhysicsComponent.cpp: In member function 'glm::vec2 PhysicsComponent::GetVelocity() const': +src\src\Components\PhysicsComponent.cpp:50:9: error: 'body' was not declared in this scope + 50 | if (body) { + | ^~~~ src\src\Components\PhysicsComponent.cpp: In member function 'void PhysicsComponent::SetFriction(float)': src\src\Components\PhysicsComponent.cpp:59:9: error: 'body' was not declared in this scope 59 | if (body && body->GetFixtureList()) @@ -133,9 +74,4 @@ src\src\Components\PhysicsComponent.cpp:83:25: error: 'object' was not declared 83 | glm::vec2 pos = object->GetLocalPosition(); | ^~~~~~ | Object -src\src\Components\PhysicsComponent.cpp: In member function 'void PhysicsComponent::OnImGuiInspector()': -src\src\Components\PhysicsComponent.cpp:90:21: error: 'GetVelocity' was not declared in this scope; did you mean 'SetVelocity'? - 90 | glm::vec2 vel = GetVelocity(); - | ^~~~~~~~~~~ - | SetVelocity diff --git a/src/src/Components/PhysicsComponent.cpp b/src/src/Components/PhysicsComponent.cpp index 060e8e5..90a476f 100644 --- a/src/src/Components/PhysicsComponent.cpp +++ b/src/src/Components/PhysicsComponent.cpp @@ -2,8 +2,8 @@ #include "../Entitys/Object.h" #include "imgui.h" -PhysicsComponent::PhysicsComponent(BodyType type, float width, float height) - : type(type), width(width), height(height) {} +PhysicsComponent::PhysicsComponent(Object* owner, BodyType type, float width, float height) + : Component(owner), type(type), width(width), height(height) {} PhysicsComponent::~PhysicsComponent() { DestroyBody(); @@ -62,7 +62,7 @@ void PhysicsComponent::SetFriction(float f) { void PhysicsComponent::SetDensity(float d) { density = d; - // requires refixture for update + // Requires refixture to apply } void PhysicsComponent::SetFixedRotation(bool fixed) { @@ -86,10 +86,11 @@ void PhysicsComponent::SyncToPhysics() { } void PhysicsComponent::OnImGuiInspector() { - ImGui::Text("Physics Body"); + ImGui::Text("Physics Component"); + glm::vec2 vel = GetVelocity(); - ImGui::DragFloat2("Velocity", &vel.x); - SetVelocity(vel); + if (ImGui::DragFloat2("Velocity", &vel.x)) + SetVelocity(vel); if (ImGui::DragFloat("Friction", &friction, 0.01f, 0.0f, 1.0f)) SetFriction(friction); diff --git a/src/src/Components/PhysicsComponent.h b/src/src/Components/PhysicsComponent.h index 2c21925..59a5d43 100644 --- a/src/src/Components/PhysicsComponent.h +++ b/src/src/Components/PhysicsComponent.h @@ -1,14 +1,13 @@ #pragma once #include "Component.h" -#include "box2d/box2d.h" -#include +#include +#include class PhysicsComponent : public Component { public: enum class BodyType { Static, Dynamic, Kinematic }; PhysicsComponent(Object* owner, BodyType type = BodyType::Dynamic, float width = 1.0f, float height = 1.0f); - ~PhysicsComponent(); void CreateBody(b2World* world, const glm::vec2& position); diff --git a/src/vendor/box2d b/src/vendor/box2d deleted file mode 160000 index 3e96863..0000000 --- a/src/vendor/box2d +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3e968638a5d0b0ff7ff0dd5a1e8e88844927b2d2