75 lines
3.3 KiB
C++
75 lines
3.3 KiB
C++
// 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/Scene.hpp>
|
|
|
|
namespace ia::iae
|
|
{
|
|
class IAEngine
|
|
{
|
|
public:
|
|
STATIC Handle CreateSprite(IN CONST String &path);
|
|
STATIC Handle CreateSprite(IN PCUINT8 rgbaData, IN INT32 width, IN INT32 height);
|
|
|
|
STATIC Handle CreateSpriteSheet(IN CONST Vector<Vector<Handle>> &animations);
|
|
STATIC Handle CreateSpriteSheet(IN CONST String &path, IN INT32 spriteWidth, IN INT32 spriteHeight,
|
|
IN CONST Vector<INT32> &frameCounts);
|
|
|
|
STATIC Handle CreateTileSheet(IN CONST String &path, IN INT32 tileWidth, IN INT32 tileHeight);
|
|
STATIC Handle CreateTileSheet(IN PCUINT8 rgbaData, IN INT32 width, IN INT32 height, IN INT32 tileWidth,
|
|
IN INT32 tileHeight);
|
|
|
|
STATIC VOID DestroyResource(IN Handle resource);
|
|
STATIC Handle GetResourceByName(IN CONST String &name);
|
|
STATIC VOID AssignResourceName(IN Handle resource, IN CONST String &name);
|
|
|
|
STATIC VOID LoadResources(IN CONST Vector<Handle> &resources);
|
|
|
|
public:
|
|
STATIC RefPtr<Scene> GetActiveScene();
|
|
STATIC RefPtr<Scene> CreateScene(IN IVec2 extent);
|
|
STATIC VOID ChangeActiveScene(IN RefPtr<Scene> scene);
|
|
|
|
public:
|
|
STATIC VOID DrawTile(IN Handle tileSheet, IN INT32 tileIndexX, IN INT32 tileIndexY, IN Vec2 position,
|
|
IN Vec2 scale = {1.0f, 1.0f}, IN FLOAT32 rotation = 0.0f, IN BOOL flipH = false,
|
|
IN BOOL flipV = false, IN Vec2 uvOffset = {});
|
|
|
|
STATIC VOID DrawSprite(IN Handle sprite, IN Vec2 position, IN Vec2 scale = {1.0f, 1.0f},
|
|
IN FLOAT32 rotation = 0.0f, IN BOOL flipH = false, IN BOOL flipV = false,
|
|
IN Vec2 uvOffset = {});
|
|
STATIC VOID DrawSprite(IN Handle spriteSheet, IN INT32 animationIndex, IN INT32 frameIndex, IN Vec2 position,
|
|
IN Vec2 scale = {1.0f, 1.0f}, IN FLOAT32 rotation = 0.0f, IN BOOL flipH = false,
|
|
IN BOOL flipV = false, IN Vec2 uvOffset = {});
|
|
|
|
private:
|
|
STATIC VOID Initialize();
|
|
STATIC VOID Terminate();
|
|
STATIC VOID Draw();
|
|
STATIC VOID Update();
|
|
STATIC VOID FixedUpdate();
|
|
STATIC VOID DebugDraw();
|
|
STATIC VOID ProcessEvent(IN PVOID event);
|
|
|
|
friend INT32 Run(IN CONST String &name, IN CONST String &packageName, IN CONST String &developerName,
|
|
IN CONST String &publisherName, IN IA_VERSION_TYPE version);
|
|
|
|
friend class Scene;
|
|
};
|
|
} // namespace ia::iae
|