Fixes
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
set(SRC_FILES
|
||||
"Src/Imp/CPP/UI.cpp"
|
||||
"Src/Imp/CPP/Time.cpp"
|
||||
"Src/Imp/CPP/Utils.cpp"
|
||||
"Src/Imp/CPP/Scene.cpp"
|
||||
"Src/Imp/CPP/Random.cpp"
|
||||
"Src/Imp/CPP/Engine.cpp"
|
||||
"Src/Imp/CPP/Utils.cpp"
|
||||
"Src/Imp/CPP/Physics.cpp"
|
||||
"Src/Imp/CPP/InternalEngine.cpp"
|
||||
|
||||
"Src/Imp/CPP/InputManager.cpp"
|
||||
|
||||
@ -46,7 +46,7 @@ namespace ia::iae
|
||||
|
||||
VOID CameraComponent::Update()
|
||||
{
|
||||
const auto pos = m_node->GetPosition();
|
||||
const auto pos = m_node->GetPosition() + m_positionOffset;
|
||||
m_viewMatrix = glm::lookAtLH(glm::vec3{pos, -2.0f}, {pos, 0.0f}, {0.0f, 1.0f, 0.0f});
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@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/>.
|
||||
|
||||
#include <Physics.hpp>
|
||||
#include <IAEngine/Nodes/Node2D.hpp>
|
||||
#include <IAEngine/Components/PhysicsComponent.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
PhysicsComponent::PhysicsComponent(IN Node2D *node) : IComponent(node)
|
||||
{
|
||||
m_physicsHandle = Physics::RegisterComponent(this);
|
||||
}
|
||||
|
||||
VOID PhysicsComponent::Draw()
|
||||
{
|
||||
}
|
||||
|
||||
VOID PhysicsComponent::DebugDraw()
|
||||
{
|
||||
}
|
||||
|
||||
VOID PhysicsComponent::Update()
|
||||
{
|
||||
m_velocity = {};
|
||||
}
|
||||
|
||||
VOID PhysicsComponent::FixedUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
Handle PhysicsComponent::CreateCollider()
|
||||
{
|
||||
m_colliders.pushBack({});
|
||||
return m_colliders.size() - 1;
|
||||
}
|
||||
|
||||
Handle PhysicsComponent::AddCollider(IN Collider collider)
|
||||
{
|
||||
m_colliders.pushBack(collider);
|
||||
return m_colliders.size() - 1;
|
||||
}
|
||||
|
||||
PhysicsComponent::Collider &PhysicsComponent::GetCollider(IN Handle handle)
|
||||
{
|
||||
return m_colliders[handle];
|
||||
}
|
||||
|
||||
VOID PhysicsComponent::Move(IN glm::vec2 direction)
|
||||
{
|
||||
IA_ASSERT(m_isDynamic);
|
||||
const auto v = direction * m_movementSpeed;
|
||||
m_velocity += v;
|
||||
for(const auto& t: m_colliders)
|
||||
{
|
||||
if(!Physics::CanMove(m_physicsHandle, t, v))
|
||||
return;
|
||||
}
|
||||
m_node->SetLocalPosition(m_node->GetLocalPosition() + v);
|
||||
}
|
||||
|
||||
VOID PhysicsComponent::Jump(IN FLOAT32 force)
|
||||
{
|
||||
}
|
||||
|
||||
VOID PhysicsComponent::OnCollision(IN PhysicsComponent *other)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ia::iae
|
||||
@ -37,6 +37,20 @@ namespace ia::iae
|
||||
#endif
|
||||
}
|
||||
|
||||
Direction Engine::GetVectorPointingDirection(IN Vec2 v)
|
||||
{
|
||||
STATIC CONSTEXPR Direction DIRECTION_MAP[] = {Direction::RIGHT, Direction::DOWN_RIGHT, Direction::DOWN, Direction::DOWN_LEFT,
|
||||
Direction::LEFT, Direction::UP_LEFT, Direction::UP, Direction::UP_RIGHT};
|
||||
if ((abs(v.x) <= FLOAT32_EPSILON) && (abs(v.y) <= FLOAT32_EPSILON))
|
||||
return Direction::NONE;
|
||||
|
||||
auto angle = glm::degrees(atan2(v.y, v.x));
|
||||
if (angle < 0)
|
||||
angle += 360;
|
||||
|
||||
return DIRECTION_MAP[INT32((angle + 22.5) / 45) % 8];
|
||||
}
|
||||
|
||||
VOID Engine::ResizeDisplay(IN INT32 newWidth, IN INT32 newHeight)
|
||||
{
|
||||
Renderer::WaitForGPUIdle();
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <Renderer/Renderer.hpp>
|
||||
#include <ResourceManager.hpp>
|
||||
#include <Time.hpp>
|
||||
#include <Physics.hpp>
|
||||
#include <WorldManager.hpp>
|
||||
|
||||
#include <IAEngine/Engine.hpp>
|
||||
@ -64,6 +65,7 @@ namespace ia::iae
|
||||
ResourceManager::Initialize();
|
||||
WorldManager::Initialize();
|
||||
UI::Initialize();
|
||||
Physics::Initialize();
|
||||
|
||||
g_gameFunctions.OnInitialize();
|
||||
}
|
||||
@ -72,6 +74,7 @@ namespace ia::iae
|
||||
{
|
||||
g_gameFunctions.OnTerminate();
|
||||
|
||||
Physics::Terminate();
|
||||
UI::Terminate();
|
||||
WorldManager::Terminate();
|
||||
ResourceManager::Terminate();
|
||||
@ -90,6 +93,7 @@ namespace ia::iae
|
||||
VOID __Internal_Engine::Iterate()
|
||||
{
|
||||
UI::Update();
|
||||
Physics::Update();
|
||||
WorldManager::Update();
|
||||
WorldManager::FixedUpdate();
|
||||
g_gameFunctions.OnUpdate(Time::GetFrameDeltaTime());
|
||||
|
||||
95
Engine/Src/Imp/CPP/Physics.cpp
Normal file
95
Engine/Src/Imp/CPP/Physics.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@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/>.
|
||||
|
||||
#include <IAEngine/Engine.hpp>
|
||||
#include <Physics.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
BOOL g_physicsDebugDrawEnabled = false;
|
||||
|
||||
Vector<PhysicsComponent *> g_physicsComponents;
|
||||
|
||||
VOID Physics::Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
VOID Physics::Terminate()
|
||||
{
|
||||
}
|
||||
|
||||
VOID Physics::Update()
|
||||
{
|
||||
if(Engine::WasInputKeyPressed(InputKey::F6))
|
||||
g_physicsDebugDrawEnabled = !g_physicsDebugDrawEnabled;
|
||||
}
|
||||
|
||||
VOID Physics::DebugDraw()
|
||||
{
|
||||
if (!g_physicsDebugDrawEnabled)
|
||||
return;
|
||||
|
||||
for (const auto &t : g_physicsComponents)
|
||||
{
|
||||
for (const auto &c : t->Colliders())
|
||||
{
|
||||
auto color = Color{192, 0, 0, 0xFF};
|
||||
if (c.IsTrigger)
|
||||
color = {64, 96, 192, 192};
|
||||
Engine::DebugDraw_SetColor(color);
|
||||
Engine::DebugDraw_SetStrokeWidth(2);
|
||||
Engine::DebugDraw_StrokeRect(t->GetNode()->GetPosition() + c.Position -
|
||||
Engine::GetActiveCamera()->GetNode()->GetPosition(),
|
||||
c.Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Handle Physics::RegisterComponent(IN PhysicsComponent *component)
|
||||
{
|
||||
g_physicsComponents.pushBack(component);
|
||||
return g_physicsComponents.size() - 1;
|
||||
}
|
||||
|
||||
BOOL Physics::CanMove(IN Handle handle, IN CONST PhysicsComponent::Collider &collider, IN glm::vec2 movement)
|
||||
{
|
||||
const auto comp = g_physicsComponents[handle];
|
||||
const auto pos = comp->GetNode()->GetPosition() + movement + collider.Position;
|
||||
for (const auto &t : g_physicsComponents)
|
||||
{
|
||||
if (t == comp)
|
||||
continue;
|
||||
for (const auto &tc : t->Colliders())
|
||||
{
|
||||
const auto tPos = t->GetNode()->GetPosition() + tc.Position;
|
||||
const auto xColliding = ((pos.x + collider.Size.x) >= tPos.x) && ((tPos.x + tc.Size.x) >= pos.x);
|
||||
const auto yColliding = ((pos.y + collider.Size.y) >= tPos.y) && ((tPos.y + tc.Size.y) >= pos.y);
|
||||
if (xColliding && yColliding)
|
||||
{
|
||||
// Collision callback
|
||||
comp->OnCollision(t);
|
||||
t->OnCollision(comp);
|
||||
|
||||
// Overlap block
|
||||
if (tc.IsTrigger)
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace ia::iae
|
||||
@ -18,6 +18,7 @@
|
||||
#include <Renderer/Renderer.hpp>
|
||||
#include <Renderer/DebugDraw.hpp>
|
||||
|
||||
#include <Physics.hpp>
|
||||
#include <WorldManager.hpp>
|
||||
|
||||
#include <IAEngine/imgui/backends/imgui_impl_sdl3.h>
|
||||
@ -69,6 +70,7 @@ namespace ia::iae
|
||||
ImGui_ImplSDL3_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
Physics::DebugDraw();
|
||||
WorldManager::DebugDraw();
|
||||
g_gameFunctions.OnDebugDraw();
|
||||
|
||||
@ -89,7 +91,7 @@ namespace ia::iae
|
||||
g_debugDrawState.ActiveColor = IM_COL32(color.R, color.G, color.B, color.A);
|
||||
}
|
||||
|
||||
VOID Engine::DebugDraw_StrokeWidth(IN FLOAT32 width)
|
||||
VOID Engine::DebugDraw_SetStrokeWidth(IN FLOAT32 width)
|
||||
{
|
||||
g_debugDrawState.ActiveStrokeWidth = width;
|
||||
}
|
||||
|
||||
@ -239,7 +239,8 @@ namespace ia::iae
|
||||
const auto sceneExtent = activeScene->Extent();
|
||||
s_state.SceneScaleFactor = {(FLOAT32) newWidth / (FLOAT32) sceneExtent.x,
|
||||
(FLOAT32) newHeight / (FLOAT32) sceneExtent.y};
|
||||
IAE_LOG_INFO("Updated Scene Scale Factor: (", s_state.SceneScaleFactor.x, ", ", s_state.SceneScaleFactor.y, ")");
|
||||
IAE_LOG_INFO("Updated Scene Scale Factor: (", s_state.SceneScaleFactor.x, ", ", s_state.SceneScaleFactor.y,
|
||||
")");
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,6 +320,11 @@ namespace ia::iae
|
||||
Renderer::OnScreenResize(Renderer::s_screenWidth, Renderer::s_screenHeight);
|
||||
}
|
||||
|
||||
CameraComponent *Engine::GetActiveCamera()
|
||||
{
|
||||
return Renderer::s_state.ActiveCamera;
|
||||
}
|
||||
|
||||
Handle Engine::CreateGeometry(IN CONST Vector<GeometryVertex> &vertices, IN CONST Vector<INT32> &indices)
|
||||
{
|
||||
return (Handle) Renderer::CreateGeometry(vertices, indices);
|
||||
|
||||
@ -52,10 +52,71 @@ namespace ia::iae
|
||||
{
|
||||
}
|
||||
|
||||
VOID ProcessEvent(IN Rml::Event &event)
|
||||
VOID AddClickListener(IN Rml::Element *element, IN std::function<VOID()> callback)
|
||||
{
|
||||
element->AddEventListener("click", this);
|
||||
m_clickCallbacks[element->GetId().c_str()] = callback;
|
||||
}
|
||||
|
||||
// VOID AddHoverEnterListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||
//{
|
||||
// m_document->GetElementById(elementId)->AddEventListener("mouseover", this);
|
||||
// m_hoverEnterCallbacks[elementId] = callback;
|
||||
// }
|
||||
//
|
||||
// VOID AddHoverExitListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||
//{
|
||||
// m_document->GetElementById(elementId)->AddEventListener("mouseout", this);
|
||||
// m_hoverExitCallbacks[elementId] = callback;
|
||||
//}
|
||||
//
|
||||
// VOID AddPointerDownListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||
//{
|
||||
// m_document->GetElementById(elementId)->AddEventListener("mousedown", this);
|
||||
// m_pointerDownCallbacks[elementId] = callback;
|
||||
//}
|
||||
//
|
||||
// VOID AddPointerUpListener(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||
//{
|
||||
// m_document->GetElementById(elementId)->AddEventListener("mouseup", this);
|
||||
// m_pointerUpCallbacks[elementId] = callback;
|
||||
//}
|
||||
|
||||
VOID ProcessEvent(IN Rml::Event &event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case Rml::EventId::Click:
|
||||
m_clickCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||
break;
|
||||
|
||||
case Rml::EventId::Mouseover:
|
||||
m_hoverEnterCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||
break;
|
||||
|
||||
case Rml::EventId::Mouseout:
|
||||
m_hoverExitCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||
break;
|
||||
|
||||
case Rml::EventId::Mousedown:
|
||||
m_pointerDownCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||
break;
|
||||
|
||||
case Rml::EventId::Mouseup:
|
||||
m_pointerUpCallbacks[event.GetTargetElement()->GetId().c_str()]();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Map<String, std::function<VOID()>> m_clickCallbacks;
|
||||
Map<String, std::function<VOID()>> m_hoverEnterCallbacks;
|
||||
Map<String, std::function<VOID()>> m_hoverExitCallbacks;
|
||||
Map<String, std::function<VOID()>> m_pointerDownCallbacks;
|
||||
Map<String, std::function<VOID()>> m_pointerUpCallbacks;
|
||||
} g_eventListener{};
|
||||
|
||||
/* Taken from https://github.com/mikke89/RmlUi/blob/master/Backends/RmlUi_Platform_SDL.cpp */
|
||||
@ -396,6 +457,11 @@ namespace ia::iae
|
||||
g_document->SetInnerRML(
|
||||
BuildString("<body style=\"display: block; width: 100%; height: 100%;\">", source, "</body>").c_str());
|
||||
}
|
||||
|
||||
VOID UI::AddClickEvent(IN PCCHAR elementId, IN std::function<VOID()> callback)
|
||||
{
|
||||
g_eventListener.AddClickListener(g_document->GetElementById(elementId), callback);
|
||||
}
|
||||
} // namespace ia::iae
|
||||
|
||||
namespace ia::iae
|
||||
|
||||
40
Engine/Src/Imp/HPP/Physics.hpp
Normal file
40
Engine/Src/Imp/HPP/Physics.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@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/PhysicsComponent.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
class Physics
|
||||
{
|
||||
public:
|
||||
STATIC Handle RegisterComponent(IN PhysicsComponent* component);
|
||||
|
||||
STATIC BOOL CanMove(IN Handle handle, IN CONST PhysicsComponent::Collider& collider, IN glm::vec2 movement);
|
||||
|
||||
private:
|
||||
STATIC VOID Initialize();
|
||||
STATIC VOID Terminate();
|
||||
|
||||
STATIC VOID Update();
|
||||
STATIC VOID DebugDraw();
|
||||
|
||||
friend class DebugDraw;
|
||||
friend class __Internal_Engine;
|
||||
};
|
||||
}
|
||||
@ -102,6 +102,18 @@ namespace ia::iae
|
||||
Vec4 Color{};
|
||||
};
|
||||
|
||||
enum class Direction : UINT8 {
|
||||
NONE = 255,
|
||||
DOWN = 0,
|
||||
DOWN_LEFT,
|
||||
LEFT,
|
||||
UP_LEFT,
|
||||
UP,
|
||||
UP_RIGHT,
|
||||
RIGHT,
|
||||
DOWN_RIGHT
|
||||
};
|
||||
|
||||
struct Color
|
||||
{
|
||||
UINT8 R{0xFF};
|
||||
|
||||
@ -35,6 +35,11 @@ namespace ia::iae
|
||||
public:
|
||||
VOID SetViewport(IN INT32 width, IN INT32 height);
|
||||
|
||||
Vec2& PositionOffset()
|
||||
{
|
||||
return m_positionOffset;
|
||||
}
|
||||
|
||||
Vec4 GetViewport() CONST
|
||||
{
|
||||
return m_viewport;
|
||||
@ -53,6 +58,7 @@ namespace ia::iae
|
||||
private:
|
||||
Vec4 m_viewport{};
|
||||
Mat4 m_viewMatrix{1.0f};
|
||||
Vec2 m_positionOffset{};
|
||||
Mat4 m_projectionMatrix{1.0f};
|
||||
};
|
||||
} // namespace ia::iae
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@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/IComponent.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
class PhysicsComponent : public IComponent
|
||||
{
|
||||
public:
|
||||
struct Collider
|
||||
{
|
||||
BOOL IsTrigger{false};
|
||||
Vec2 Position{};
|
||||
Vec2 Size{};
|
||||
};
|
||||
|
||||
public:
|
||||
PhysicsComponent(IN Node2D *node);
|
||||
|
||||
Handle CreateCollider();
|
||||
Handle AddCollider(IN Collider collider);
|
||||
Collider &GetCollider(IN Handle handle);
|
||||
|
||||
VOID Move(IN glm::vec2 direction);
|
||||
|
||||
VOID Jump(IN FLOAT32 force);
|
||||
|
||||
public:
|
||||
BOOL &IsDynamic()
|
||||
{
|
||||
return m_isDynamic;
|
||||
}
|
||||
|
||||
FLOAT32 &MovementSpeed()
|
||||
{
|
||||
return m_movementSpeed;
|
||||
}
|
||||
|
||||
Vector<Collider> &Colliders()
|
||||
{
|
||||
return m_colliders;
|
||||
}
|
||||
|
||||
CONST Vec2 &GetVelocity() CONST
|
||||
{
|
||||
return m_velocity;
|
||||
}
|
||||
|
||||
private:
|
||||
Vec2 m_velocity{};
|
||||
BOOL m_isDynamic{false};
|
||||
Vector<Collider> m_colliders;
|
||||
FLOAT32 m_movementSpeed{1.0f};
|
||||
Handle m_physicsHandle{INVALID_HANDLE};
|
||||
|
||||
VOID OnCollision(IN PhysicsComponent *other);
|
||||
|
||||
friend class Physics;
|
||||
|
||||
public:
|
||||
VIRTUAL VOID Draw();
|
||||
VIRTUAL VOID DebugDraw();
|
||||
|
||||
VIRTUAL VOID Update();
|
||||
VIRTUAL VOID FixedUpdate();
|
||||
};
|
||||
} // namespace ia::iae
|
||||
@ -24,8 +24,8 @@
|
||||
#include <IAEngine/Components/CameraComponent.hpp>
|
||||
#include <IAEngine/Components/SoundEmitterComponent.hpp>
|
||||
|
||||
#include <IAEngine/UI.hpp>
|
||||
#include <IAEngine/Scene.hpp>
|
||||
#include <IAEngine/UI.hpp>
|
||||
#include <IAEngine/Utils.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
@ -44,8 +44,7 @@ namespace ia::iae
|
||||
|
||||
// Renderer Functions
|
||||
STATIC Handle GetGeometry_Quad();
|
||||
STATIC Handle CreateGeometry(IN CONST Vector<GeometryVertex> &vertices,
|
||||
IN CONST Vector<INT32> &indices);
|
||||
STATIC Handle CreateGeometry(IN CONST Vector<GeometryVertex> &vertices, IN CONST Vector<INT32> &indices);
|
||||
STATIC VOID DestroyGeometry(IN Handle geometry);
|
||||
STATIC VOID DrawGeometry(IN Handle handle);
|
||||
STATIC IVec2 GetDisplayExtent();
|
||||
@ -60,23 +59,22 @@ namespace ia::iae
|
||||
STATIC VOID SetRenderState_ColorOverlay(IN Color color);
|
||||
STATIC VOID SetRenderState_CameraRelative(IN BOOL value);
|
||||
STATIC VOID SetRenderState_Texture(IN Handle image);
|
||||
STATIC VOID SetRenderState_Transform(IN Vec2 position, IN Vec2 scale, IN FLOAT32 rotation,
|
||||
IN UINT8 layer, IN INT16 sortIndex);
|
||||
STATIC VOID SetRenderState_Transform(IN Vec2 position, IN Vec2 scale, IN FLOAT32 rotation, IN UINT8 layer,
|
||||
IN INT16 sortIndex);
|
||||
|
||||
// Debug Draw Functions
|
||||
STATIC VOID DebugDraw_SetColor(IN Color color);
|
||||
STATIC VOID DebugDraw_StrokeWidth(IN FLOAT32 width);
|
||||
STATIC VOID DebugDraw_SetStrokeWidth(IN FLOAT32 width);
|
||||
STATIC VOID DebugDraw_Line(IN Vec2 from, IN Vec2 to);
|
||||
STATIC VOID DebugDraw_FillRect(IN Vec2 position, IN Vec2 size);
|
||||
STATIC VOID DebugDraw_StrokeRect(IN Vec2 position, IN Vec2 size);
|
||||
|
||||
// Resource Functions
|
||||
STATIC Handle CreateSoundFromFile(IN CONST String &name, IN CONST String &path);
|
||||
STATIC Handle CreateImageFromFile(IN CONST String &name, IN CONST String &path,
|
||||
IN INT32 resizeToWidth = 0, IN INT32 resizeToHeight = 0);
|
||||
STATIC Handle CreateImageFromFile(IN CONST String &name, IN CONST String &path, IN INT32 resizeToWidth = 0,
|
||||
IN INT32 resizeToHeight = 0);
|
||||
STATIC Handle CreateImage(IN CONST String &name, IN PCUINT8 encodedData, IN SIZE_T encodedDataSize);
|
||||
STATIC Handle CreateImage(IN CONST String &name, IN PCUINT8 rgbaData, IN INT32 width,
|
||||
IN INT32 height);
|
||||
STATIC Handle CreateImage(IN CONST String &name, IN PCUINT8 rgbaData, IN INT32 width, IN INT32 height);
|
||||
STATIC Handle CreateSound(IN CONST String &name, IN PCUINT8 encodedData, IN SIZE_T encodedDataSize);
|
||||
STATIC Handle GetImage(IN CONST String &name);
|
||||
STATIC Handle GetSound(IN CONST String &name);
|
||||
@ -86,12 +84,13 @@ namespace ia::iae
|
||||
STATIC Handle ResizeImage(IN Handle image, IN INT32 newWidth, IN INT32 newHeight);
|
||||
STATIC Handle ResizeImage(IN CONST String &name, IN INT32 newWidth, IN INT32 newHeight);
|
||||
STATIC VOID RescaleAllImages(IN FLOAT32 factorX, IN FLOAT32 factorY);
|
||||
STATIC Handle CombineImages(IN CONST Vector<Handle> &images, IN INT32 unitWidth,
|
||||
IN INT32 unitHeight, IN INT32 unitCountX, IN INT32 unitCountY);
|
||||
STATIC Handle CombineImages(IN CONST Vector<Handle> &images, IN INT32 unitWidth, IN INT32 unitHeight,
|
||||
IN INT32 unitCountX, IN INT32 unitCountY);
|
||||
|
||||
// Game Functions
|
||||
STATIC VOID SetTimeScale(IN FLOAT32 scale);
|
||||
STATIC VOID SetActiveCamera(IN CameraComponent *cameraComponent);
|
||||
STATIC CameraComponent *GetActiveCamera();
|
||||
|
||||
// Scene Functions
|
||||
STATIC RefPtr<Scene> CreateSceneFromFile(IN CONST String &path);
|
||||
@ -116,8 +115,10 @@ namespace ia::iae
|
||||
STATIC BOOL WasInputActionPressed(IN CONST String &action);
|
||||
STATIC BOOL WasInputActionReleased(IN CONST String &action);
|
||||
STATIC Handle BindInputAction(IN CONST String &name, IN InputKey key);
|
||||
STATIC VOID BindInputAxis(IN InputKey upKey, IN InputKey downKey, IN InputKey leftKey,
|
||||
IN InputKey rightKey);
|
||||
STATIC VOID BindInputAxis(IN InputKey upKey, IN InputKey downKey, IN InputKey leftKey, IN InputKey rightKey);
|
||||
|
||||
// Utility Functions
|
||||
STATIC Direction GetVectorPointingDirection(IN Vec2 v);
|
||||
|
||||
// Random Functions
|
||||
STATIC FLOAT32 GetRandomFloat();
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <IAEngine/Nodes/SpriteNode.hpp>
|
||||
#include <IAEngine/Components/PhysicsComponent.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <IAEngine/Nodes/TextureNode.hpp>
|
||||
#include <IAEngine/Components/PhysicsComponent.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
|
||||
@ -27,6 +27,8 @@ namespace ia::iae
|
||||
|
||||
STATIC VOID SetHTML(IN CONST String &source);
|
||||
|
||||
STATIC VOID AddClickEvent(IN PCCHAR elementId, IN std::function<VOID()> callback);
|
||||
|
||||
public:
|
||||
STATIC VOID Initialize();
|
||||
STATIC VOID Terminate();
|
||||
@ -37,4 +39,4 @@ namespace ia::iae
|
||||
STATIC VOID OnSDLEvent(IN PVOID event);
|
||||
STATIC VOID OnScreenResize(IN INT32 newWidth, IN INT32 newHeight);
|
||||
};
|
||||
}
|
||||
} // namespace ia::iae
|
||||
2
Vendor/IACore
vendored
2
Vendor/IACore
vendored
Submodule Vendor/IACore updated: 5c02010ae1...07638ea7b3
Reference in New Issue
Block a user