Sample: RPG: Init
This commit is contained in:
92
Samples/SpaceCase/Src/Imp/CPP/Game.cpp
Normal file
92
Samples/SpaceCase/Src/Imp/CPP/Game.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <Game.hpp>
|
||||
|
||||
RefPtr<Node2D> backgroundNode;
|
||||
RefPtr<CameraNode> mainCamera;
|
||||
|
||||
TextureComponent *title;
|
||||
|
||||
C_DECL(IA_DLL_EXPORT GameRequestedConfig Game_GetConfigRequest())
|
||||
{
|
||||
return {600, 600};
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT VOID Game_OnInitialize())
|
||||
{
|
||||
mainCamera = MakeRefPtr<CameraNode>("MainCamera");
|
||||
Engine::SetActiveCamera(mainCamera->GetCameraComponent());
|
||||
|
||||
Engine::CreateImageFromFile("Background", "Resources/Sprites/bg.png");
|
||||
Engine::CreateImageFromFile("Stars-A", "Resources/Sprites/Stars-A.png");
|
||||
Engine::CreateImageFromFile("Stars-B", "Resources/Sprites/Stars-B.png");
|
||||
Engine::CreateImageFromFile("Title", "Resources/UI/Title.png");
|
||||
|
||||
//UI::SetHTML("<img src=\"Resources/UI/Title.png\" style=\"width: 100%; height: 100%;\"></img>");
|
||||
//backgroundNode = MakeRefPtr<Node2D>("BG");
|
||||
//backgroundNode->AddComponent<TextureComponent>()->SetTexture(Engine::GetImage("Background"));
|
||||
//title = backgroundNode->AddComponent<TextureComponent>();
|
||||
//title->PositionOffset() = {150, 100};
|
||||
//title->SetTexture(Engine::GetImage("Title"));
|
||||
//Engine::AddNodeToActiveScene(backgroundNode);
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT VOID Game_OnTerminate())
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT VOID Game_OnDebugDraw())
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT VOID Game_OnFixedUpdate())
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT VOID Game_OnUpdate(IN FLOAT32 deltaTime))
|
||||
{
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT VOID Game_OnResize(IN INT32 newWidth, IN INT32 newHeight))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetName())
|
||||
{
|
||||
return "Space Case";
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT UINT64 Game_GetVersion())
|
||||
{
|
||||
return IA_MAKE_VERSION(1, 0, 0);
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetPackageName())
|
||||
{
|
||||
return "com.iasoft.spacecase";
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetDeveloperName())
|
||||
{
|
||||
return "IASoft (PVT) LTD";
|
||||
}
|
||||
|
||||
C_DECL(IA_DLL_EXPORT PCCHAR Game_GetPublisherName())
|
||||
{
|
||||
return "IASoft (PVT) LTD";
|
||||
}
|
||||
20
Samples/SpaceCase/Src/Imp/HPP/Game.hpp
Normal file
20
Samples/SpaceCase/Src/Imp/HPP/Game.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <IAEngine/GameLibraryInterface.hpp>
|
||||
|
||||
Reference in New Issue
Block a user