// 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 . #include #include #include #include namespace ia::iae { VOID View_Scene::Initialize() { SetName("Scene"); SetIcon(ICON_FA_HASHTAG); IAEngine::__Initialize(SCENE_EDITOR_RESOULTION, Editor::Instance().GetActiveProject()->AssetDirectory()); m_gamePreviewTexture = new RDC_Texture(RDC_Texture::EType::SAMPLED, SCENE_EDITOR_RESOULTION.x, SCENE_EDITOR_RESOULTION.y); } VOID View_Scene::Terminate() { delete m_gamePreviewTexture; } VOID View_Scene::Render() { PreRender(); ImGui::Image(m_gamePreviewTexture->GetHandle(), {SCENE_EDITOR_RESOULTION.x, SCENE_EDITOR_RESOULTION.y}); PostRender(); } VOID View_Scene::Update() { STATIC INT32 frameCounter{0}; IAEngine::__Update(); frameCounter++; if (frameCounter >= 60) { frameCounter = 0; IAEngine::__FixedUpdate(); } IAEngine::__RenderToTexture(m_gamePreviewTexture->GetHandle()); } VOID View_Scene::OnEvent(IN SDL_Event *event) { IAEngine::__ProcessEvent(event); } } // namespace ia::iae C_DECL(GameRequestedConfig *Game_GetConfigRequest()) { return nullptr; } C_DECL(VOID Game_OnInitialize()) { } C_DECL(VOID Game_OnTerminate()) { } C_DECL(VOID Game_OnDebugDraw()) { } C_DECL(VOID Game_OnFixedUpdate()) { } C_DECL(VOID Game_OnUpdate(IN FLOAT32 deltaTime)) { } C_DECL(VOID Game_OnResize(IN INT32 newWidth, IN INT32 newHeight)) { }