#include #include #include #include #include namespace ia::iae::game { RefPtr scene; RefPtr g_player; VOID Game::Initialize() { scene = Engine::CreateScene(); scene->YSortingEnabled() = true; Engine::ChangeScene(scene); g_player = MakeRefPtr(); { const auto t = g_player->AddComponent(); t->AddAnimation({ .ShouldLoop = true, .Keys = { SpriteRendererComponent::AnimationKeyFrame { .Scale = {0.1f, 0.1f, 0.1f}, .Texture = Engine::CreateTexture(File::ReadToVector("Graphics/green.png")), } }, }); t->BakeAnimations(); } g_player->SetLocalPosition({200, 200, 0}); const auto obstacle = MakeRefPtr(); { const auto t = obstacle->AddComponent(); t->AddAnimation({ .ShouldLoop = true, .Keys = { SpriteRendererComponent::AnimationKeyFrame { .Scale = {0.25f, 0.25f, 0.1f}, .Texture = Engine::CreateTexture(File::ReadToVector("Graphics/red.png")), } }, }); t->BakeAnimations(); } obstacle->SortOffset() = 20; obstacle->SetLocalPosition({150, 100, 0}); scene->AddNode(g_player); scene->AddNode(obstacle); } VOID Game::Terminate() { } VOID Game::Update() { g_player->SetLocalPosition(g_player->GetLocalPosition() + glm::vec3{Input::GetDirectionalInput(), 0.0f}); } }