removed box2d

This commit is contained in:
OusmBlueNinja 2025-04-18 20:35:52 -05:00
parent 5d1672ed8f
commit b5e7121cd4
5 changed files with 18 additions and 86 deletions

3
.gitmodules vendored
View File

@ -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

View File

@ -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

View File

@ -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,9 +86,10 @@ void PhysicsComponent::SyncToPhysics() {
}
void PhysicsComponent::OnImGuiInspector() {
ImGui::Text("Physics Body");
ImGui::Text("Physics Component");
glm::vec2 vel = GetVelocity();
ImGui::DragFloat2("Velocity", &vel.x);
if (ImGui::DragFloat2("Velocity", &vel.x))
SetVelocity(vel);
if (ImGui::DragFloat("Friction", &friction, 0.01f, 0.0f, 1.0f))

View File

@ -1,14 +1,13 @@
#pragma once
#include "Component.h"
#include "box2d/box2d.h"
#include <memory>
#include <box2d.h>
#include <glm/glm.hpp>
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);

1
src/vendor/box2d vendored

@ -1 +0,0 @@
Subproject commit 3e968638a5d0b0ff7ff0dd5a1e8e88844927b2d2