This basically wrap SDL3 naturally OO looking concepts into proper C++ classes and objects, trying to as straightforward as possible. It was inspired on SDL2pp, with the addition of flexible memory management and wrappers for string and callbacks.
#include <iostream>
#include <SDL3pp/SDL3pp.h>
#include <SDL3pp/SDL3pp_main.h>
using namespace std::chrono_literals;
int main(int argc, char** argv)
{
{128, 128});
bool running = true;
while (running) {
}
renderer.SetDrawColorFloat({.5f, .5f, .5f, 1.f});
renderer.RenderClear();
renderer.SetDrawColorFloat({0.f, 0.725f, 0.f, 1.f});
renderer.RenderFillRect(
SDL::FRect{10, 10, 380, 380});
renderer.RenderTexture(characterTexture, {}, characterRect);
renderer.Present();
}
return 0;
}
An efficient driver-specific representation of pixel data.
Definition: SDL3pp_render.h:2155
std::optional< Event > PollEvent()
Poll for currently pending events.
Definition: SDL3pp_events.h:1078
const char * GetBasePath()
Get the directory where the application was run from.
Definition: SDL3pp_filesystem.h:133
void Init(InitFlags flags)
Initialize the SDL library.
Definition: SDL3pp_init.h:253
std::pair< Window, Renderer > CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags=0)
Create a window and default renderer.
Definition: SDL3pp_render.h:3217
void Delay(std::chrono::nanoseconds duration)
Wait a specified duration before returning.
Definition: SDL3pp_timer.h:99
constexpr EventType EVENT_QUIT
User-requested quit.
Definition: SDL3pp_events.h:57
constexpr InitFlags INIT_VIDEO
INIT_VIDEO implies INIT_EVENTS, should be initialized on the main thread
Definition: SDL3pp_init.h:71
The structure that defines a point (using floating point values).
Definition: SDL3pp_rect.h:512
A rectangle, with the origin at the upper left (using floating point values).
Definition: SDL3pp_rect.h:1437
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83