Engine & Game Library Interface Update

This commit is contained in:
Isuru Samarathunga
2025-10-05 01:51:48 +05:30
parent 5408f07e97
commit f8b41a0d61
48 changed files with 2423 additions and 193 deletions

View File

@ -16,24 +16,24 @@
#pragma once
#include <IACore/Exception.hpp>
#include <IACore/Logger.hpp>
#include <IACore/Vector.hpp>
#include <IACore/Memory.hpp>
#include <IACore/String.hpp>
#include <IACore/Exception.hpp>
#include <IACore/Vector.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/ext/scalar_constants.hpp>
#include <glm/mat4x4.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#define IAE_LOG_TAG "[IAE]: "
#define IAE_LOG_INFO(...) ia::Logger::Info(IAE_LOG_TAG, __VA_ARGS__)
#define IAE_LOG_WARN(...) ia::Logger::Warn(IAE_LOG_TAG, __VA_ARGS__)
#define IAE_LOG_INFO(...) ia::Logger::Info(IAE_LOG_TAG, __VA_ARGS__)
#define IAE_LOG_WARN(...) ia::Logger::Warn(IAE_LOG_TAG, __VA_ARGS__)
#define IAE_LOG_ERROR(...) ia::Logger::Error(IAE_LOG_TAG, __VA_ARGS__)
namespace ia::iae
@ -44,6 +44,34 @@ namespace ia::iae
using Vec2 = glm::vec2;
using Vec3 = glm::vec3;
using Vec4 = glm::vec4;
using IVec2 = glm::ivec2;
using IVec3 = glm::ivec3;
using IVec4 = glm::ivec4;
using Mat4 = glm::mat4;
struct TimePeriod
{
};
struct ImageView
{
Handle Image{};
Vec4 Scissor{};
};
struct SoundView
{
Handle Sound{};
INT32 LoopTimes{};
TimePeriod LoopDelay{};
};
struct GeometryVertex
{
Vec2 Position{};
Vec2 TexCoord{};
Vec4 Color{};
};
struct Color
{
@ -51,7 +79,235 @@ namespace ia::iae
UINT8 G{0xFF};
UINT8 B{0xFF};
UINT8 A{0xFF};
};
/* Adopted from SDL3 */
enum class InputKey : UINT8
{
UNKNOWN = 0,
A = 4,
B = 5,
C = 6,
D = 7,
E = 8,
F = 9,
G = 10,
H = 11,
I = 12,
J = 13,
K = 14,
L = 15,
M = 16,
N = 17,
O = 18,
P = 19,
Q = 20,
R = 21,
S = 22,
T = 23,
U = 24,
V = 25,
W = 26,
X = 27,
Y = 28,
Z = 29,
N1 = 30,
N2 = 31,
N3 = 32,
N4 = 33,
N5 = 34,
N6 = 35,
N7 = 36,
N8 = 37,
N9 = 38,
N0 = 39,
RETURN = 40,
ESCAPE = 41,
BACKSPACE = 42,
TAB = 43,
SPACE = 44,
MINUS = 45,
EQUALS = 46,
LEFTBRACKET = 47,
RIGHTBRACKET = 48,
BACKSLASH = 49,
NONUSHASH = 50,
SEMICOLON = 51,
APOSTROPHE = 52,
GRAVE = 53,
COMMA = 54,
PERIOD = 55,
SLASH = 56,
CAPSLOCK = 57,
F1 = 58,
F2 = 59,
F3 = 60,
F4 = 61,
F5 = 62,
F6 = 63,
F7 = 64,
F8 = 65,
F9 = 66,
F10 = 67,
F11 = 68,
F12 = 69,
K_PRINTSCREEN = 70,
K_SCROLLLOCK = 71,
K_PAUSE = 72,
K_INSERT = 73,
K_HOME = 74,
K_PAGEUP = 75,
K_DELETE = 76,
K_END = 77,
K_PAGEDOWN = 78,
K_RIGHT = 79,
K_LEFT = 80,
K_DOWN = 81,
K_UP = 82,
NUMLOCKCLEAR = 83,
KP_DIVIDE = 84,
KP_MULTIPLY = 85,
KP_MINUS = 86,
KP_PLUS = 87,
KP_ENTER = 88,
KP_1 = 89,
KP_2 = 90,
KP_3 = 91,
KP_4 = 92,
KP_5 = 93,
KP_6 = 94,
KP_7 = 95,
KP_8 = 96,
KP_9 = 97,
KP_0 = 98,
KP_PERIOD = 99,
NONUSBACKSLASH = 100,
APPLICATION = 101,
POWER = 102,
KP_EQUALS = 103,
F13 = 104,
F14 = 105,
F15 = 106,
F16 = 107,
F17 = 108,
F18 = 109,
F19 = 110,
F20 = 111,
F21 = 112,
F22 = 113,
F23 = 114,
F24 = 115,
EXECUTE = 116,
HELP = 117,
MENU = 118,
SELECT = 119,
STOP = 120,
AGAIN = 121,
UNDO = 122,
CUT = 123,
COPY = 124,
PASTE = 125,
FIND = 126,
MUTE = 127,
VOLUMEUP = 128,
VOLUMEDOWN = 129,
KP_COMMA = 133,
KP_EQUALSAS400 = 134,
INTERNATIONAL1 = 135,
INTERNATIONAL2 = 136,
INTERNATIONAL3 = 137,
INTERNATIONAL4 = 138,
INTERNATIONAL5 = 139,
INTERNATIONAL6 = 140,
INTERNATIONAL7 = 141,
INTERNATIONAL8 = 142,
INTERNATIONAL9 = 143,
LANG1 = 144,
LANG2 = 145,
LANG3 = 146,
LANG4 = 147,
LANG5 = 148,
LANG6 = 149,
LANG7 = 150,
LANG8 = 151,
LANG9 = 152,
ALTERASE = 153,
SYSREQ = 154,
CANCEL = 155,
CLEAR = 156,
PRIOR = 157,
RETURN2 = 158,
SEPARATOR = 159,
OPER = 161,
CLEARAGAIN = 162,
CRSEL = 163,
EXSEL = 164,
KP_00 = 176,
KP_000 = 177,
THOUSANDSSEPARATOR = 178,
DECIMALSEPARATOR = 179,
CURRENCYUNIT = 180,
CURRENCYSUBUNIT = 181,
KP_LEFTPAREN = 182,
KP_RIGHTPAREN = 183,
KP_LEFTBRACE = 184,
KP_RIGHTBRACE = 185,
KP_TAB = 186,
KP_BACKSPACE = 187,
KP_A = 188,
KP_B = 189,
KP_C = 190,
KP_D = 191,
KP_E = 192,
KP_F = 193,
KP_XOR = 194,
KP_POWER = 195,
KP_PERCENT = 196,
KP_LESS = 197,
KP_GREATER = 198,
KP_AMPERSAND = 199,
KP_DBLAMPERSAND = 200,
KP_VERTICALBAR = 201,
KP_DBLVERTICALBAR = 202,
KP_COLON = 203,
KP_HASH = 204,
KP_SPACE = 205,
KP_AT = 206,
KP_EXCLAM = 207,
KP_MEMSTORE = 208,
KP_MEMRECALL = 209,
KP_MEMCLEAR = 210,
KP_MEMADD = 211,
KP_MEMSUBTRACT = 212,
KP_MEMMULTIPLY = 213,
KP_MEMDIVIDE = 214,
KP_PLUSMINUS = 215,
KP_CLEAR = 216,
KP_CLEARENTRY = 217,
KP_BINARY = 218,
KP_OCTAL = 219,
KP_DECIMAL = 220,
KP_HEXADECIMAL = 221,
LCTRL = 224,
LSHIFT = 225,
LALT = 226,
LGUI = 227,
RCTRL = 228,
RSHIFT = 229,
RALT = 230,
RGUI = 231,
};
} // namespace ia::iae

View File

@ -0,0 +1,27 @@
// 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/Components/IComponent.hpp>
namespace ia::iae
{
struct ICameraComponent: public IComponent
{
PURE_VIRTUAL(Mat4* GetMatrix() CONST);
};
}

View File

@ -0,0 +1,29 @@
// 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/Base.hpp>
namespace ia::iae
{
class INode;
struct IComponent
{
INode* Node{};
};
}

View File

@ -16,52 +16,11 @@
#pragma once
#include <IAEngine/Base.hpp>
#include <IAEngine/Nodes/INode.hpp>
#include <IAEngine/Components/CameraComponent.hpp>
namespace ia::iae
{
using InputKey = UINT8;
struct TimePeriod
{
};
struct INode
{
String Name{};
};
struct IComponent
{
};
struct ICameraComponent: public IComponent
{
};
struct ImageView
{
Handle Image{};
Vec4 Scissor{};
};
struct SoundView
{
Handle Sound{};
INT32 LoopTimes{};
TimePeriod LoopDelay{};
};
struct GeometryVertex
{
Vec2 Position{};
Vec2 TexCoord{};
Vec4 Color{};
};
class Engine
{
public:
@ -85,13 +44,12 @@ namespace ia::iae
STATIC VOID ResizeDisplay(IN INT32 newWidth, IN INT32 newHeight);
// Renderer State Functions
STATIC VOID SetRenderState_Scissor(IN Vec4 rect);
STATIC VOID SetRenderState_Scissor(IN IVec4 rect);
STATIC VOID SetRenderState_FlippedH(IN BOOL value);
STATIC VOID SetRenderState_FlippedV(IN BOOL value);
STATIC VOID SetRenderState_TextureOffset(IN Vec2 off);
STATIC VOID SetRenderState_ColorOverlay(IN Color color);
STATIC VOID SetRenderState_CameraRelative(IN BOOL value);
STATIC VOID SetRenderState_ScissorEnabled(IN BOOL value);
STATIC VOID SetRenderState_Texture(IN Handle image);
STATIC VOID SetRenderState_Transform(IN Vec2 position, IN Vec2 scale, IN FLOAT32 rotation, IN UINT8 layer, IN INT16 sortIndex);
@ -151,5 +109,8 @@ namespace ia::iae
STATIC INT64 GetUnixSecond();
STATIC INT64 GetUnixMillisecond();
STATIC FLOAT32 GetFrameDeltaTime();
// Engine Functions
STATIC BOOL IsDebugMode();
};
}

View File

@ -16,7 +16,7 @@
#pragma once
#include <IAEngine/GameInterface.hpp>
#include <IAEngine/GameLibraryInterface.hpp>
#if defined(__BUILDING_IAENGINE) && (__BUILDING_IAENGINE)
#define IAE_DLL_API IA_DLL_EXPORT
@ -24,7 +24,4 @@
#define IAE_DLL_API IA_DLL_IMPORT
#endif
C_DECL(IAE_DLL_API ia::BOOL IAEngine_OnInitialize(IN GameFunctionTable gameFunctionTable));
C_DECL(IAE_DLL_API ia::VOID IAEngine_OnTerminate());
C_DECL(IAE_DLL_API ia::BOOL IAEngine_OnIterate());
C_DECL(IAE_DLL_API ia::VOID IAEngine_OnEvent(IN PVOID event));
C_DECL(IAE_DLL_API INT32 IAEngine_Run(IN GameFunctionTable gameFunctionTable));

View File

@ -0,0 +1,27 @@
// 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/Base.hpp>
namespace ia::iae
{
struct INode
{
String Name{};
};
}

View File

@ -0,0 +1,24 @@
// 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/Nodes/INode.hpp>
namespace ia::iae
{
}

View File

@ -0,0 +1,24 @@
// 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/Nodes/INode.hpp>
namespace ia::iae
{
}

View File

@ -0,0 +1,24 @@
// 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/Nodes/INode.hpp>
namespace ia::iae
{
}

View File

@ -0,0 +1,24 @@
// 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/Nodes/INode.hpp>
namespace ia::iae
{
}

View File

@ -0,0 +1,24 @@
// 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/Nodes/INode.hpp>
namespace ia::iae
{
}

View File

@ -0,0 +1,24 @@
// 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/Nodes/INode.hpp>
namespace ia::iae
{
}