panda-core/src/core/App.cpp
2024-11-06 16:44:07 +07:00

47 lines
769 B
C++
Executable File

#include "Panda.hpp"
#include <raylib.h>
void panda::App::CreateWindow(int w, int h, const char *str)
{
SetConfigFlags(
FLAG_MSAA_4X_HINT | FLAG_WINDOW_RESIZABLE);
#if PLATFORM_ANDROID
InitWindow(0, 0, str);
#elif PLATFORM_DESKTOP
InitWindow(w, h, str);
SetWindowMinSize(w*0.8f, h*0.8f);
#endif
SetExitKey(-1);
}
void panda::App::AppUpdate()
{
if (_scene_current != nullptr)
{
while (!_scene_current->preloaded)
{
_scene_current->preloaded = true;
_scene_current->Preload();
}
_scene_current->Update();
}
}
void panda::App::SetScene(Scene* scene)
{
if (_scene_current != nullptr)
{
delete _scene_current;
_scene_current = nullptr;
}
_scene_current = scene;
}
panda::Scene* panda::App::GetScene()
{
return _scene_current;
}