Restructure

This commit is contained in:
Isuru Samarathunga
2025-09-20 10:03:52 +05:30
parent 7eecf8f968
commit ece65b18da
27 changed files with 437 additions and 259 deletions

View File

@ -6,6 +6,7 @@
#include <IACore/File.hpp>
namespace ia::iae::game
{
RefPtr<Scene> scene;
@ -25,14 +26,14 @@ namespace ia::iae::game
.ShouldLoop = true,
.Keys = {
SpriteRendererComponent::AnimationKeyFrame {
.Scale = {0.1f, 0.1f, 0.1f},
.Texture = Engine::CreateTexture(File::ReadToVector("Graphics/green.png")),
.Scale = {0.1f, 0.1f},
}
},
});
t->BakeAnimations();
}
g_player->SetLocalPosition({200, 200, 0});
g_player->SetLocalPosition({200, 200});
const auto obstacle = MakeRefPtr<Node>();
{
@ -41,15 +42,15 @@ namespace ia::iae::game
.ShouldLoop = true,
.Keys = {
SpriteRendererComponent::AnimationKeyFrame {
.Scale = {0.25f, 0.25f, 0.1f},
.Texture = Engine::CreateTexture(File::ReadToVector("Graphics/red.png")),
.Scale = {0.25f, 0.25f},
}
},
});
t->BakeAnimations();
}
obstacle->SortOffset() = 20;
obstacle->SetLocalPosition({150, 100, 0});
obstacle->SetLocalSortIndex(20);
obstacle->SetLocalPosition({150, 100});
scene->AddNode(g_player);
scene->AddNode(obstacle);
@ -61,6 +62,6 @@ namespace ia::iae::game
VOID Game::Update()
{
g_player->SetLocalPosition(g_player->GetLocalPosition() + glm::vec3{Input::GetDirectionalInput(), 0.0f});
g_player->SetLocalPosition(g_player->GetLocalPosition() + Input::GetDirectionalInput());
}
}