Partial Physics
This commit is contained in:
@ -10,6 +10,8 @@ set(IAEngine_Sources
|
||||
|
||||
imp/cpp/ResourceManager.cpp
|
||||
|
||||
imp/cpp/Physics/Physics.cpp
|
||||
|
||||
imp/cpp/Events/Event.cpp
|
||||
|
||||
imp/cpp/Nodes/Transform.cpp
|
||||
@ -18,9 +20,8 @@ set(IAEngine_Sources
|
||||
imp/cpp/Components/AtlasRenderer.cpp
|
||||
imp/cpp/Components/SpriteRenderer.cpp
|
||||
imp/cpp/Components/SoundEmitter.cpp
|
||||
imp/cpp/Components/Collider.cpp
|
||||
imp/cpp/Components/ParticleEmitter.cpp
|
||||
imp/cpp/Components/StackedCollider.cpp
|
||||
imp/cpp/Components/PhysicsBody.cpp
|
||||
)
|
||||
|
||||
add_library(IAEngine STATIC ${IAEngine_Sources})
|
||||
|
||||
6
Src/IAEngine/imp/cpp/Components/PhysicsBody.cpp
Normal file
6
Src/IAEngine/imp/cpp/Components/PhysicsBody.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <IAEngine/Components/PhysicsBody.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@
|
||||
#include <IAEngine/Input.hpp>
|
||||
#include <IAEngine/Random.hpp>
|
||||
#include <IAEngine/Time.hpp>
|
||||
#include <IAEngine/Physics/Physics.hpp>
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
@ -77,6 +78,7 @@ namespace ia::iae
|
||||
Random::Initialize();
|
||||
Input::Initialize();
|
||||
Audio::Initialize();
|
||||
Physics::Initialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -85,6 +87,7 @@ namespace ia::iae
|
||||
{
|
||||
IAE_LOG_INFO("Shutting down IAEngine");
|
||||
|
||||
Physics::Terminate();
|
||||
Audio::Terminate();
|
||||
|
||||
ImGui_ImplSDLRenderer3_Shutdown();
|
||||
@ -145,6 +148,8 @@ namespace ia::iae
|
||||
|
||||
VOID Engine::UpdateGame()
|
||||
{
|
||||
Physics::Update();
|
||||
|
||||
if B_LIKELY (m_activeScene)
|
||||
m_activeScene->Update();
|
||||
}
|
||||
|
||||
37
Src/IAEngine/imp/cpp/Physics/Physics.cpp
Normal file
37
Src/IAEngine/imp/cpp/Physics/Physics.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <IAEngine/Physics/Physics.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
|
||||
|
||||
VOID Physics::Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
VOID Physics::Terminate()
|
||||
{
|
||||
}
|
||||
|
||||
VOID Physics::Update()
|
||||
{
|
||||
}
|
||||
|
||||
Handle Physics::CreateStaticBody(IN iam::Vec3f position)
|
||||
{
|
||||
return INVALID_HANDLE;
|
||||
}
|
||||
|
||||
Handle Physics::CreateDynamicBody(IN iam::Vec3f position)
|
||||
{
|
||||
return INVALID_HANDLE;
|
||||
}
|
||||
|
||||
VOID Physics::AddBoxCollider(IN Handle body, IN iam::Vec3f size)
|
||||
{
|
||||
}
|
||||
|
||||
iam::Vec3f Physics::GetBodyPosition(IN Handle body)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
} // namespace ia::iae
|
||||
24
Src/IAEngine/inc/IAEngine/Components/PhysicsBody.hpp
Normal file
24
Src/IAEngine/inc/IAEngine/Components/PhysicsBody.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IAS (ias@iasoft.dev)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <IAEngine/Components/Component.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
|
||||
}
|
||||
37
Src/IAEngine/inc/IAEngine/Physics/Physics.hpp
Normal file
37
Src/IAEngine/inc/IAEngine/Physics/Physics.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IAS (ias@iasoft.dev)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <IAEngine/Base.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
class Physics
|
||||
{
|
||||
public:
|
||||
STATIC VOID Initialize();
|
||||
STATIC VOID Terminate();
|
||||
|
||||
STATIC VOID Update();
|
||||
|
||||
STATIC Handle CreateStaticBody(IN iam::Vec3f position);
|
||||
STATIC Handle CreateDynamicBody(IN iam::Vec3f position);
|
||||
STATIC VOID AddBoxCollider(IN Handle body, IN iam::Vec3f size);
|
||||
|
||||
STATIC iam::Vec3f GetBodyPosition(IN Handle body);
|
||||
};
|
||||
}
|
||||
@ -26,6 +26,8 @@ namespace ia::iae
|
||||
class ResourceManager
|
||||
{
|
||||
public:
|
||||
ResourceManager(IN Engine *engine);
|
||||
|
||||
RefPtr<Texture> CreateTexture(IN CONST Span<CONST UINT8> &encodedData);
|
||||
RefPtr<Texture> CreateTexture(IN PCUINT8 encodedData, IN SIZE_T encodedDataSize);
|
||||
RefPtr<Texture> CreateTexture(IN PCUINT8 rgbaData, IN INT32 width, IN INT32 height);
|
||||
@ -44,7 +46,6 @@ namespace ia::iae
|
||||
protected:
|
||||
Engine *CONST m_engine;
|
||||
|
||||
ResourceManager(IN Engine *engine);
|
||||
friend class Engine;
|
||||
};
|
||||
} // namespace ia::iae
|
||||
Reference in New Issue
Block a user