combine with desktop project

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-04-10 23:20:19 +02:00
parent b6fb4eb65c
commit b3bf03999b
72 changed files with 65538 additions and 132 deletions

23
src/Common.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include "Common.h"
#include <SDL3/SDL.h>
auto createWindow(const char *title, const int width, const int height) -> Window * {
constexpr uint32_t window_flag = SDL_WINDOW_HIDDEN;
const auto window = SDL_CreateWindow(title, width, height, window_flag);
if (window == nullptr) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window", SDL_GetError(), nullptr);
return nullptr;
}
const SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetPointerProperty(props, SDL_PROP_RENDERER_CREATE_WINDOW_POINTER, window);
SDL_SetNumberProperty(props, SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER, SDL_COLORSPACE_SRGB_LINEAR);
if (const auto renderer = SDL_CreateRendererWithProperties(props); renderer == nullptr) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create renderer", SDL_GetError(), nullptr);
return nullptr;
}
return new Window(window);
}