61 lines
1.8 KiB
C++
61 lines
1.8 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/>.
|
|
|
|
#include <SDL3/SDL.h>
|
|
#include <RenderCore/RenderCore.hpp>
|
|
|
|
namespace ia::iae
|
|
{
|
|
SDL_Window* g_windowHandle{};
|
|
|
|
INT32 Run(IN INT32 argc, IN PCCHAR argv[])
|
|
{
|
|
IVec2 windowExtent{800, 600};
|
|
|
|
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD))
|
|
THROW_UNKNOWN("Failed to intialize SDL: ", SDL_GetError());
|
|
|
|
if (!(g_windowHandle = SDL_CreateWindow("IAEngine", windowExtent.x, windowExtent.y,
|
|
SDL_WINDOW_RESIZABLE)))
|
|
THROW_UNKNOWN("Failed to create the SDL window: ", SDL_GetError());
|
|
|
|
RDC::Initialize(windowExtent, g_windowHandle, true);
|
|
|
|
|
|
|
|
SDL_Event event{};
|
|
while (true)
|
|
{
|
|
SDL_PollEvent(&event);
|
|
if (event.type == SDL_EVENT_QUIT)
|
|
break;
|
|
|
|
//RDC::DrawSpriteTopLeft(0, 0, 0, {100.0f, 100.0f}, {1.0f, 1.0f}, 0.0f);
|
|
RDC::RenderToWindow();
|
|
}
|
|
|
|
RDC::Terminate();
|
|
|
|
SDL_DestroyWindow(g_windowHandle);
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
return ia::iae::Run(argc, (const char**)argv);
|
|
} |