Hot Fixes
This commit is contained in:
2
Dependencies/IACore
vendored
2
Dependencies/IACore
vendored
Submodule Dependencies/IACore updated: ada777c758...8e2e118dd5
0
Src/IAEngine/imp/cpp/Components/Collider.cpp
Normal file
0
Src/IAEngine/imp/cpp/Components/Collider.cpp
Normal file
@ -12,12 +12,6 @@ namespace ia::iae
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle SpriteRendererComponent::AddTexture(IN RefPtr<Texture> texture)
|
|
||||||
{
|
|
||||||
m_textures.pushBack(texture);
|
|
||||||
return m_textures.size() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle SpriteRendererComponent::AddAnimation(IN CONST Animation &animation)
|
Handle SpriteRendererComponent::AddAnimation(IN CONST Animation &animation)
|
||||||
{
|
{
|
||||||
IA_RELEASE_ASSERT(!animation.Keys.empty());
|
IA_RELEASE_ASSERT(!animation.Keys.empty());
|
||||||
@ -25,26 +19,6 @@ namespace ia::iae
|
|||||||
return m_animations.size() - 1;
|
return m_animations.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle SpriteRendererComponent::AddAnimation(IN initializer_list<INT32> frames, IN INT32 frameDuration,
|
|
||||||
IN BOOL shouldLoop)
|
|
||||||
{
|
|
||||||
Animation anim;
|
|
||||||
anim.ShouldLoop = shouldLoop;
|
|
||||||
for (const auto &idx : frames)
|
|
||||||
anim.Keys.pushBack(AnimationKeyFrame{.Duration = frameDuration, .TextureHandle = idx});
|
|
||||||
return AddAnimation(anim);
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle SpriteRendererComponent::AddAnimation(IN INT32 startFrame, IN INT32 endFrame, IN INT32 frameDuration,
|
|
||||||
IN BOOL shouldLoop)
|
|
||||||
{
|
|
||||||
Animation anim;
|
|
||||||
anim.ShouldLoop = shouldLoop;
|
|
||||||
for (INT32 i = startFrame; i < endFrame; i++)
|
|
||||||
anim.Keys.pushBack(AnimationKeyFrame{.Duration = frameDuration, .TextureHandle = i});
|
|
||||||
return AddAnimation(anim);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID SpriteRendererComponent::BakeAnimations()
|
VOID SpriteRendererComponent::BakeAnimations()
|
||||||
{
|
{
|
||||||
for (auto &anim : m_animations)
|
for (auto &anim : m_animations)
|
||||||
@ -55,14 +29,6 @@ namespace ia::iae
|
|||||||
}
|
}
|
||||||
if (m_animations.size())
|
if (m_animations.size())
|
||||||
SetActiveAnimation(0);
|
SetActiveAnimation(0);
|
||||||
else
|
|
||||||
SetActiveTexture(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID SpriteRendererComponent::SetActiveTexture(IN Handle texture)
|
|
||||||
{
|
|
||||||
IA_RELEASE_ASSERT((texture != INVALID_HANDLE) && (texture < m_textures.size()));
|
|
||||||
m_currentAnimationState.TextureHandle = texture;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID SpriteRendererComponent::SetActiveAnimation(IN Handle animation)
|
VOID SpriteRendererComponent::SetActiveAnimation(IN Handle animation)
|
||||||
@ -85,9 +51,7 @@ namespace ia::iae
|
|||||||
VOID SpriteRendererComponent::Draw()
|
VOID SpriteRendererComponent::Draw()
|
||||||
{
|
{
|
||||||
const auto &animFrame = m_currentAnimationState;
|
const auto &animFrame = m_currentAnimationState;
|
||||||
if (animFrame.TextureHandle == INVALID_HANDLE)
|
animFrame.Texture->Draw(
|
||||||
return;
|
|
||||||
m_textures[animFrame.TextureHandle]->Draw(
|
|
||||||
m_node->GetPosition() + animFrame.Position, m_node->GetScale() * animFrame.Scale,
|
m_node->GetPosition() + animFrame.Position, m_node->GetScale() * animFrame.Scale,
|
||||||
m_node->GetRotation().Z + animFrame.Rotation.Z, m_isFlippedH, m_isFlippedV, animFrame.ColorOverlay);
|
m_node->GetRotation().Z + animFrame.Rotation.Z, m_isFlippedH, m_isFlippedV, animFrame.ColorOverlay);
|
||||||
}
|
}
|
||||||
|
|||||||
0
Src/IAEngine/imp/cpp/Components/StackedCollider.cpp
Normal file
0
Src/IAEngine/imp/cpp/Components/StackedCollider.cpp
Normal file
@ -1,7 +1,7 @@
|
|||||||
#include <IAEngine/Audio.hpp>
|
#include <IAEngine/Audio.hpp>
|
||||||
#include <IAEngine/IAEngine.hpp>
|
#include <IAEngine/IAEngine.hpp>
|
||||||
#include <IAEngine/Random.hpp>
|
|
||||||
#include <IAEngine/Input.hpp>
|
#include <IAEngine/Input.hpp>
|
||||||
|
#include <IAEngine/Random.hpp>
|
||||||
#include <IAEngine/Time.hpp>
|
#include <IAEngine/Time.hpp>
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|||||||
0
Src/IAEngine/inc/IAEngine/Components/Collider.hpp
Normal file
0
Src/IAEngine/inc/IAEngine/Components/Collider.hpp
Normal file
@ -32,7 +32,7 @@ namespace ia::iae
|
|||||||
iam::Vec3f Scale{1.0f, 1.0f, 1.0f};
|
iam::Vec3f Scale{1.0f, 1.0f, 1.0f};
|
||||||
iam::Vec4f ColorOverlay{1.0f, 1.0f, 1.0f, 1.0f};
|
iam::Vec4f ColorOverlay{1.0f, 1.0f, 1.0f, 1.0f};
|
||||||
BOOL ShouldInterpolate{};
|
BOOL ShouldInterpolate{};
|
||||||
INT32 TextureHandle{INVALID_HANDLE};
|
RefPtr<Texture> Texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Animation
|
struct Animation
|
||||||
@ -44,14 +44,10 @@ namespace ia::iae
|
|||||||
public:
|
public:
|
||||||
SpriteRendererComponent(IN Node *node);
|
SpriteRendererComponent(IN Node *node);
|
||||||
|
|
||||||
Handle AddTexture(IN RefPtr<Texture> texture);
|
|
||||||
Handle AddAnimation(IN CONST Animation &animation);
|
Handle AddAnimation(IN CONST Animation &animation);
|
||||||
Handle AddAnimation(IN initializer_list<INT32> frames, IN INT32 frameDuration, IN BOOL shouldLoop);
|
|
||||||
Handle AddAnimation(IN INT32 startFrame, IN INT32 endFrame, IN INT32 frameDuration, IN BOOL shouldLoop);
|
|
||||||
|
|
||||||
VOID BakeAnimations();
|
VOID BakeAnimations();
|
||||||
|
|
||||||
VOID SetActiveTexture(IN Handle texture);
|
|
||||||
VOID SetActiveAnimation(IN Handle animation);
|
VOID SetActiveAnimation(IN Handle animation);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -68,7 +64,6 @@ namespace ia::iae
|
|||||||
Animation m_activeAnimation{};
|
Animation m_activeAnimation{};
|
||||||
Handle m_activeAnimationHandle{INVALID_HANDLE};
|
Handle m_activeAnimationHandle{INVALID_HANDLE};
|
||||||
Vector<Animation> m_animations;
|
Vector<Animation> m_animations;
|
||||||
Vector<RefPtr<Texture>> m_textures;
|
|
||||||
AnimationKeyFrame m_currentAnimationState{};
|
AnimationKeyFrame m_currentAnimationState{};
|
||||||
AnimationKeyFrame m_nextAnimationKeyFrame{};
|
AnimationKeyFrame m_nextAnimationKeyFrame{};
|
||||||
AnimationKeyFrame m_prevAnimationKeyFrame{};
|
AnimationKeyFrame m_prevAnimationKeyFrame{};
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#include <IAEngine/Nodes/Node.hpp>
|
#include <IAEngine/Nodes/Node.hpp>
|
||||||
#include <IAEngine/Scene.hpp>
|
#include <IAEngine/Scene.hpp>
|
||||||
#include <IAEngine/Texture.hpp>
|
#include <IAEngine/Texture.hpp>
|
||||||
|
#include <IAEngine/ResourceManager.hpp>
|
||||||
|
|
||||||
namespace ia::iae
|
namespace ia::iae
|
||||||
{
|
{
|
||||||
@ -45,6 +46,9 @@ namespace ia::iae
|
|||||||
VOID EndFrame();
|
VOID EndFrame();
|
||||||
BOOL ShouldClose();
|
BOOL ShouldClose();
|
||||||
|
|
||||||
|
template<typename _class_type>
|
||||||
|
_class_type* RegisterResourceManager();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RefPtr<Scene> CreateScene();
|
RefPtr<Scene> CreateScene();
|
||||||
|
|
||||||
@ -63,5 +67,13 @@ namespace ia::iae
|
|||||||
FLOAT32 m_updateTimer{};
|
FLOAT32 m_updateTimer{};
|
||||||
RefPtr<Scene> m_activeScene{};
|
RefPtr<Scene> m_activeScene{};
|
||||||
CONST RefPtr<EngineContext> m_context;
|
CONST RefPtr<EngineContext> m_context;
|
||||||
|
RefPtr<ResourceManager> m_resourceManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename _class_type>
|
||||||
|
_class_type* Engine::RegisterResourceManager()
|
||||||
|
{
|
||||||
|
m_resourceManager = MakeRefPtr<_class_type>(this);
|
||||||
|
return (_class_type*)m_resourceManager.get();
|
||||||
|
}
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
@ -44,9 +44,7 @@ namespace ia::iae
|
|||||||
protected:
|
protected:
|
||||||
Engine *CONST m_engine;
|
Engine *CONST m_engine;
|
||||||
|
|
||||||
private:
|
|
||||||
ResourceManager(IN Engine *engine);
|
ResourceManager(IN Engine *engine);
|
||||||
|
|
||||||
friend class Engine;
|
friend class Engine;
|
||||||
};
|
};
|
||||||
} // namespace ia::iae
|
} // namespace ia::iae
|
||||||
Reference in New Issue
Block a user