Skip to content

Cheat Sheet


This page lists every public class and their methods in RE:MAKE 2D.

Info

Private engine-internal classes and methods are not listed here.


Window

// class Window::Viewport
Window::Viewport(void);
explicit Window::Viewport(const Area& zone); // create a viewport

Camera& camera(void)             noexcept; // get viewport camera
void area(const Area&)           noexcept; // set viewport area
Area area(void)            const noexcept; // get viewport area
const Camera& camera(void) const noexcept; // get const viewport camera

void clear(Color = rmk::color::black) noexcept;   // clear viewport with solid color
void draw(const Printable&) noexcept; // draw a drawable object on viewport
void fill(const Printable&) noexcept; // draw filled a fillable object on viewport

// class Window
Window(std::string_view title, Vec2d pos, Dim2d size); // create a new window
u32      ID(void) const noexcept;           // get the unique window identifier
Vec2d    pos(void) const noexcept;          // get window position (upper-left corner)
Dim2d    size(void) const noexcept;         // get window dimensions
Vec2d    center(void) const noexcept;       // get window center coordinates
Area     area(void) const noexcept;         // get window area
void     move(Vec2d) noexcept;              // move window to a new position
void     resize(Dim2d) noexcept;            // resize window
void     maxSize(Dim2d) noexcept;           // set maximum window size
void     rename(std::string_view) noexcept; // change window title
void     icon(std::string_view);            // set window icon from an image file
void     resizable(bool) noexcept;          // allow or forbid user resizing
void     fullScreen(bool) noexcept;         // toggle fullscreen mode
void     border(bool) noexcept;             // show or hide window decorations
void     close(void) noexcept;              // close and destroy the window
bool     resizable(void) const noexcept;    // check if window is resizable
bool     isOpen(void) const noexcept;       // check if window is still open
bool     isFocus(void) const noexcept;      // check if window has input focus
std::string title(void) noexcept;           // get current window title
void     blendMode(window::blendmode) noexcept; // set window blend mode

void     present(void);                      // present current frame
void     screenshot(std::string_view path);  // take a screenshot of current frame (.png)
void     clear(Color = rmk::color::black) noexcept; // clear window with a solid color

void     draw(const Printable&) noexcept; // draw a drawable object
void     fill(const Printable&) noexcept; // draw filled a fillable object

void     connectViewport(Viewport&)    noexcept;  // register viewport
void     disconnectViewport(Viewport&) noexcept;  // unregister viewport

// class Printable

Color

// Color
Color(byte R, byte G, byte B, byte A = 255); // construct from RGBA components
auto operator<=>(const Color&) const noexcept = default; // full comparison support

// Named colors
namespace color {

inline constexpr Color red       = { 255, 0,   0,   255 };
inline constexpr Color green     = {   0, 230, 50,  255 };
inline constexpr Color blue      = {   0, 0,   255, 255 };
inline constexpr Color skyblue   = {   0, 191, 255, 255 };
inline constexpr Color purple    = { 138, 43,  226, 255 };
inline constexpr Color orange    = { 249, 115,  22, 255 };
inline constexpr Color yellow    = { 255, 215, 0,   255 };
inline constexpr Color gray      = { 128, 128, 128, 255 };
inline constexpr Color gold      = { 255, 203,   0, 255 };
inline constexpr Color darkblue  = {   0, 80,  180, 255 };
inline constexpr Color darkgreen = {   0, 120,  50, 255 };
inline constexpr Color lime      = {   0, 255,   0, 255 };
inline constexpr Color silver    = { 192, 192, 192, 255 };
inline constexpr Color maroon    = { 128, 0,   0,   255 };
inline constexpr Color pink      = { 255, 0,   128, 255 };
inline constexpr Color fuchsia   = { 255, 0,   255, 255 };
inline constexpr Color aqua      = {   0, 255, 255, 255 };
inline constexpr Color raywhite  = { 245, 245, 245, 255 };
inline constexpr Color cyan      = {   6, 182, 212, 255 };
inline constexpr Color emerald   = {   5, 150, 105, 255 };
inline constexpr Color teal      = {  13, 148, 136, 255 };
inline constexpr Color amber     = { 217, 119,   6, 255 };
inline constexpr Color indigo    = {  79,  70, 229, 255 };
inline constexpr Color black     = {   0, 0,   0,   255 };
inline constexpr Color white     = { 255, 255, 255, 255 };

} // namespace color

// Free operators
Color operator+(const Color&, const Color&) noexcept; // component-wise addition (clamped)
Color operator-(const Color&, const Color&) noexcept; // component-wise subtraction (clamped)
Color operator%(const Color&, const Color&) noexcept; // component-wise average
// HSL
HSL(f32 hue, f32 saturation, f32 luminosity); // construct from HSL components
auto operator<=>(const Color&) const noexcept = default; // full comparison support

Vector & dimension

// Vec2d
Vec2d(f32 X, f32 Y);     // construct from X and Y
Vec2d(f32 XY);           // construct with same value for both axes

operator Fact2d(void);   // implicit conversion (negative components clamped to 0)
operator Grid2d(void);   // implicit conversion (cast to usize)

auto operator<=>(const Vec2d&) const noexcept = default; // full comparison
Vec2d operator+(const Vec2d&, const Vec2d&) noexcept; // addition
Vec2d operator-(const Vec2d&, const Vec2d&) noexcept; // subtraction
Vec2d operator*(const Vec2d&, const Vec2d&) noexcept; // multiplication
Vec2d operator/(const Vec2d&, const Vec2d&) noexcept; // division
Vec2d operator%(const Vec2d&, const Vec2d&) noexcept; // modulo (fmod)
// Dim2d
Dim2d(f32 W, f32 H);   // construct from width and height
Dim2d(f32 WH);         // construct with same value for both axes

auto operator<=>(const Dim2d&) const noexcept = default; // full comparison
Dim2d operator+(const Dim2d&, const Dim2d&) noexcept;    // addition
Dim2d operator-(const Dim2d&, const Dim2d&) noexcept;    // subtraction
Dim2d operator*(const Dim2d&, const Dim2d&) noexcept;    // multiplication
Dim2d operator/(const Dim2d&, const Dim2d&) noexcept;    // division
Dim2d operator%(const Dim2d&, const Dim2d&) noexcept;    // modulo (fmod)
// Fact2d — scaling factor, now f32-based (was u32)
Fact2d(f32 X, f32 Y);  // construct from X and Y — negative values clamped to 0 at construction
Fact2d(f32 XY);        // construct with same value for both axes , negative clamped to 0

operator Vec2d(void);  // implicit conversion

auto operator<=>(const Fact2d&) const noexcept = default; // full comparison
Fact2d operator+(const Fact2d&, const Fact2d&) noexcept;  // addition
Fact2d operator-(const Fact2d&, const Fact2d&) noexcept;  // subtraction
Fact2d operator*(const Fact2d&, const Fact2d&) noexcept;  // multiplication
Fact2d operator/(const Fact2d&, const Fact2d&) noexcept;  // division
Fact2d operator%(const Fact2d&, const Fact2d&) noexcept;  // modulo
// Grid2d — id/index roles (usize-based)
Grid2d(usize X, usize Y); // construct from X and Y
Grid2d(usize XY);         // construct with same value for both axes

operator Vec2d(void);     // implicit conversion

auto operator<=>(const Grid2d&) const noexcept = default; // full comparison
Grid2d operator+(const Grid2d&, const Grid2d&) noexcept;  // addition
Grid2d operator-(const Grid2d&, const Grid2d&) noexcept;  // subtraction
Grid2d operator*(const Grid2d&, const Grid2d&) noexcept;  // multiplication
Grid2d operator/(const Grid2d&, const Grid2d&) noexcept;  // division
Grid2d operator%(const Grid2d&, const Grid2d&) noexcept;  // modulo

Info

Vec2d converts implicitly to both Fact2d and Grid2d, so a Vec2d literal can be passed anywhere either type is expected.


Area

// Area
Area(i32 x, i32 y, i32 w, i32 h); // construct from position and size
Area(const Vec2d& pos, const Dim2d& size); // construct from position + dimension

Vec2d pos(void)    const noexcept; // get area upper-left position
Dim2d size(void)   const noexcept; // get area size
Vec2d center(void) const noexcept; // get area center

auto operator<=>(const Area&) const noexcept = default; // full comparison
Area operator+(const Area&, const Area&) noexcept; // addition
Area operator-(const Area&, const Area&) noexcept; // subtraction
Area operator*(const Area&, const Area&) noexcept; // multiplication
Area operator/(const Area&, const Area&) noexcept; // division
Area operator%(const Area&, const Area&) noexcept; // modulo

Geometry (abstract class)

u8                     points(void) const noexcept;           // number of vertices
Dim2d                  size(void) const noexcept;             // bounding box size
Vec2d                  center(void) const noexcept;           // center position
const Vec2d*           pointsPos(void) const noexcept;        // raw vertex array
template<IsShape S> S  as(void) const noexcept;               // cast to another shape type
virtual void           move(const Vec2d&) noexcept = 0;       // translate shape
virtual void           rotate(f32) noexcept = 0;              // rotate shape (radians)
virtual void           scale(const Fact2d&) noexcept = 0;     // scale shape
virtual void           resize(const Dim2d&) noexcept = 0;     // set new bounding box size
virtual void           transform(const Vec2d&, f32, const Fact2d&) noexcept = 0; // translate + rotate + scale
virtual bool           hasIntersected(const Geometry&) const noexcept = 0; // collision test (SAT)

Shape

Shape(const Vec2d& center, const Dim2d& size); // construct a regular polygon
// All Geometry methods above are implemented here.
// Triangulation for filled rendering is generated automatically.

Custom Shapes

using Line      = Shape<2>;   // line segment
using Diamond   = Shape<4>;   // diamond shape
using Hexagon  = Shape<6>;   // hexagon
using Ellipse   = Shape<36>;  // ellipse approximation

class Point     : public Shape<1>;  // single point
class Triangle  : public Shape<3>;  // triangle
class Rectangle : public Shape<4>;  // axis-aligned rectangle (optimized build)
class Square    : public Rectangle; // uniform rectangle
class Circle    : public Ellipse;   // circle (w == h enforced)

Signal

// Connection management
void connect(void (*func)(Args...));             // connect a free function (persistent)
void disconnect(void (*func)(Args...));          // disconnect a free function
void connectOnce(void (*func)(Args...));         // connect a free function (one shot)
void connect(Slot& slot);                        // connect a std::function by reference
void disconnect(Slot& slot);                     // disconnect a std::function
void connectOnce(Slot& slot);                    // connect a std::function (one shot)
void join(Slot&& slot);                          // move-connect a std::function (persistent)
void joinOnce(Slot&& slot);                      // move-connect a std::function (one shot)
void joinPriority(Slot&& slot);                  // move-connect with priority execution order
void connectPriority(void (*func)(Args...));     // connect a free function with priority
void disconnectPriority(void (*func)(Args...));  // disconnect a priority free function
void connectPriority(Slot& slot);                // connect a std::function with priority
void disconnectPriority(Slot& slot);             // disconnect a priority std::function
void enablePriority(void (*func)(Args...));      // promote a normal function to priority
void enablePriority(Slot& slot);                 // promote a normal slot to priority
void disablePriority(void (*func)(Args...));     // demote a priority function to normal
void disablePriority(Slot& slot);                // demote a priority slot to normal

// Emission
void emit(Args... args);                         // manually trigger all connected callbacks

// Automatic emission (condition-based)
void bind(Condition cond, Args... defaultArgs);        // emit every frame while condition is true
void bindRising(Condition cond, Args... defaultArgs);  // emit once when condition becomes true
void bindFalling(Condition cond, Args... defaultArgs); // emit once when condition becomes false
void bindChange(Condition cond, Args... defaultArgs);  // emit on every condition change

// Lifecycle
void  start(void);          // activate the signal
void  stop(void);           // deactivate the signal
usize count(void) const;    // number of connected slots
void  reserve(usize size);  // pre-allocate internal storage

EventManager (singleton event)

void poll(void);                  // process all pending events (non-blocking)
void wait(void);                  // wait indefinitely for an event
void wait(time::Second);          // wait for an event with timeout
void textInput(bool);             // Enable/disable text read mode
bool textInput(void);             // check text read mode stat

Keyboard

_EventSignal<> onPressA, onPressB, ..., onPressZ;          // key pressed (keycode)
_EventSignal<> onPress0, ..., onPress9;                    // number keys pressed
_EventSignal<> onPressSpace, onPressEnter, onPressEscape;  // special keys pressed
_EventSignal<> onPressBackspace, onPressTab, onPressCapsLock;
_EventSignal<> onPressDelete, onPressInsert, onPressHome;
_EventSignal<> onPressEnd, onPressPageUp, onPressPageDown;
_EventSignal<> onPressLeft, onPressRight, onPressUp, onPressDown; // arrow keys
_EventSignal<> onPressShift, onPressLShift, onPressRShift;        // shift keys
_EventSignal<> onPressCtrl, onPressLCtrl, onPressRCtrl;           // control keys
_EventSignal<> onPressAlt, onPressLAlt, onPressRAlt;              // alt keys
_EventSignal<> onPressAny;                                        // any key pressed
_EventSignal<> onPressF1 .. onPressF12;                           // function keys

// Equivalent onRelease* events for key releases
// Equivalent onPressScan*, onReleaseScan* events (scancode-based, layout-independent)

Text input

_EventSignal<std::string> onTextInput;   // UTF-8 text input
_EventSignal<std::string> onTextEdit;    // composition / IME editing

Mouse

_EventSignal<Vec2d> onMouseMove;                     // mouse position
_EventSignal<Vec2d> onMouseRawMove;                  // relative mouse motion
_EventSignal<Vec2d> onLeftDown, onLeftUp;            // left button
_EventSignal<Vec2d> onRightDown, onRightUp;          // right button
_EventSignal<Vec2d> onMiddleDown, onMiddleUp;        // middle button
_EventSignal<Vec2d> onDoubleClick;                   // double click
_EventSignal<Vec2d> onWheel;                         // mouse wheel (x, y)

Gamepad

// i32 : controller ID
_EventSignal<i32> onPressACtrl, onPressBCtrl, onPressXCtrl, onPressYCtrl;
_EventSignal<i32> onPressStart, onPressSelect;
_EventSignal<i32> onPressLShoulder, onPressRShoulder;
_EventSignal<i32> onPressDpadLeft, onPressDpadRight, onPressDpadUp, onPressDpadDown;
_EventSignal<i32> onPressLStick, onPressRStick;

// Equivalent onRelease* events
// i16 : axis value
_EventSignal<i32, i16> onAxisLeftX, onAxisLeftY;       // left stick
_EventSignal<i32, i16> onAxisRightX, onAxisRightY;     // right stick
_EventSignal<i32, i16> onAxisLTrigger, onAxisRTrigger; // triggers
_EventSignal<i32> onControllerAdded;                   // controller plugged in
_EventSignal<i32> onControllerRemoved;                 // controller unplugged

Touch

// Vec2d : click position
_EventSignal<Vec2d> onFingerDown;     // finger touched screen
_EventSignal<Vec2d> onFingerUp;       // finger lifted
_EventSignal<Vec2d> onFingerMove;     // finger moved
_EventSignal<Vec2d> onMultiGesture;   // multi-touch gesture

Mouse and Touch (mobile / mouse compatibility)

// Vec2d : click position
_EventSignal<Vec2d> onPointerUp;    // left button or finger up
_EventSignal<Vec2d> onPointerDown;  // left button or finger down

Window events

// u32 : window ID
_EventSignal<u32>        onWindowClose;        // window close requested
_EventSignal<u32>        onWindowMinimized;    // window minimized
_EventSignal<u32>        onWindowMaximized;    // window maximized
_EventSignal<u32>        onWindowRestored;     // window restored
_EventSignal<u32>        onWindowShown;        // window shown
_EventSignal<u32>        onWindowHidden;       // window hidden
_EventSignal<u32>        onWindowExposed;      // window exposed
_EventSignal<u32>        onWindowFocusGained;  // window gained focus
_EventSignal<u32>        onWindowFocusLost;    // window lost focus
_EventSignal<u32>        onWindowMouseEnter;   // mouse entered window
_EventSignal<u32>        onWindowMouseLeave;   // mouse left window
_EventSignal<u32, Dim2d> onWindowResized;      // window resized
_EventSignal<u32, Vec2d> onWindowMoved;        // window moved

Application

_EventSignal<>            onQuit;             // application quit requested
_EventSignal<std::string> onDropFile;         // file dropped onto window
_EventSignal<>            onClipboardUpdate;  // clipboard changed
_EventSignal<>            onAppForeground;    // app entering foreground
_EventSignal<>            onAppBackground;    // app entering background
_EventSignal<>            onAppLowMemory;     // low memory warning
_EventSignal<>            onLocaleChanged;    // system locale changed
_EventSignal<>            onDisplayChanged;   // display configuration changed
_EventSignal<>            onRenderReset;      // render device reset
_EventSignal<>            onEventNone;        // no event occurred (idle)

Chronometer

void start(void) noexcept;   // start or restart the chronometer
void stop(void) noexcept;    // stop and record final time
void pause(void) noexcept;   // pause without resetting
void resume(void) noexcept;  // resume after pause
void reset(void) noexcept;   // reset all values to zero
template <typename D = time::Second>
fmax elapsedTime(void) noexcept; // get elapsed time in chosen unit

DeltaTime (singleton delta)

fmax tick(void) const noexcept;    // delta time of current frame (seconds)
fmax FPS(void) const noexcept;     // current frames per second
fmax maxFPS(void) const noexcept;  // frame rate cap
void maxFPS(fmax) noexcept;        // set frame rate cap (clamped 30–1440)
void update(void);                 // advance delta and dispatch signals (called by loop)

Timer / TimerManager (singleton timer)

// Time unit
namespace time {

using Nanosecond  = std::chrono::duration<fmax, std::nano>;
using Microsecond = std::chrono::duration<fmax, std::micro>;
using Millisecond = std::chrono::duration<fmax, std::milli>;
using Second      = std::chrono::duration<fmax, std::ratio<1>>;
using Minute      = std::chrono::duration<fmax, std::ratio<60>>;
using Hour        = std::chrono::duration<fmax, std::ratio<3600>>;
using Day         = std::chrono::duration<fmax, std::ratio<86400>>;
using Week        = std::chrono::duration<fmax, std::ratio<604800>>;
using Month       = std::chrono::duration<fmax, std::ratio<2629800>>;   // 30.44 days
using Year        = std::chrono::duration<fmax, std::ratio<31557600>>;  // 365.25 days

void delay(time::Second) noexcept; // sleep for any time
}

// Timer
Timer(void);
Timer(fmax limit);
Timer(time::Second limit);

void limit(fmax) noexcept;             // set limit (seconds)
void limit(time::Second) noexcept;     // set limit
fmax limit(void) const noexcept;       // get limit

void start(void) noexcept;    // start / restart the timer
void stop(void) noexcept;     // stop and reset
void pause(void) noexcept;    // pause without resetting
void resume(void) noexcept;   // resume after pause
void repeat(bool) noexcept;   // auto-restart on timeout

bool active(void)      const noexcept; // check if currently running
bool elapsed(void)     const noexcept; // check if timeout occurred
fmax elapsedTime(void) const noexcept; // current elapsed time

_TimerSignal<> onTimeout; // emitted once when the timer elapses

Date

Date(u8 day, u8 month, i32 year); // construct a date
u8   day(void) const noexcept;    // get day
u8   month(void) const noexcept;  // get month
i32  year(void) const noexcept;   // get year
char slice(void) const noexcept;  // get current separator character
void day(u8) noexcept;            // set day
void month(u8) noexcept;          // set month
void year(i32) noexcept;          // set year
void format(const std::string_view& fmt);   // set display format (e.g. "day/month/year")
void date(const std::string_view& str);     // parse a date string
std::string date(void) const;              // format date to string
bool dayIs(const Date& other) const noexcept; // compare with another date
// Operators ==, !=, <, >, <=, >=

Clock

Clock(u8 hour, u8 minute, u8 second); // construct a time
u8   hour(void) const noexcept;       // get hour
u8   minute(void) const noexcept;     // get minute
u8   second(void) const noexcept;     // get second
char slice(void) const noexcept;      // get current separator
void hour(const u8&) noexcept;        // set hour
void minute(const u8&) noexcept;      // set minute
void second(const u8&) noexcept;      // set second
void format(const std::string_view& fmt); // set display format (e.g. "hour:minute:second")
void time(const std::string_view& str);   // parse a time string
std::string time(void) const;             // format time to string
bool timeIs(const Clock& other) const noexcept; // compare with another time
// Operators ==, !=, <, >, <=, >=

System (singleton system)

void init(void);    // initialize SDL and all subsystems (must be called before Window)
bool isInit(void);  // check if system is initialized

struct Info {
    u32         ramMB(void);           // system RAM in megabytes
    u8          cpuCount(void);        // number of logical CPU cores
    std::string platform(void);        // platform name
    u8          displayCount(void);    // number of connected displays
    u16         channelCount(void);    // number of allocated audio channels
    Dim2d       screenSize(u8 = 0);    // resolution of a display
    Date        currentDay(void);      // current system date
    Clock       currentTime(void);     // current system time
};

struct Setup {
    void allocateChannels(u16);                  // set number of audio channels
    bool backend(std::string_view);              // set render backend
    bool audioMode(std::string_view);            // set audio resampling mode
    bool scalingMode(std::string_view);          // set render scaling quality
    bool audioCategory(std::string_view);        // set audio category
    bool mouseRelativeMode(std::string_view);    // set mouse relative mode
    bool mobileOrientation(std::span<std::string_view>); // set allowed orientations
};

struct Toggle {
    bool vsync(bool);                   // enable/disable vsync
    bool blockOnPause(bool);            // block on pause (Android)
    void gameController(bool);          // enable/disable game controller support
    bool hideHomeIndicator(bool);       // hide home indicator (iOS)
    void relativeMouseMode(bool);       // enable/disable relative mouse mode
    bool materialAcceleration(bool);    // enable/disable framebuffer acceleration
    bool accelerometerAsJoystick(bool); // use accelerometer as joystick
};

Info   info;    // system information
Setup  setup;   // system setup (must be called before init)
Toggle toggle;  // system toggles (must be called before init)

PhysicManager (singleton physics)

f32   gravitationalConstant(void) const noexcept;  // get gravity
void  gravitationalConstant(f32) noexcept;         // set gravity
f32   pixelsPerMeter(void) const noexcept;         // get pixel-to-meter ratio
void  pixelsPerMeter(f32) noexcept;                // set pixel-to-meter ratio
Area  world(void) const noexcept;                  // get world boundaries
void  world(const Area&) noexcept;                 // set world boundaries (creates boundary walls)
void  remove(PhysicBody&);                         // remove a body from the simulation

std::vector<Tracker<PhysicBody>>& bodies(void)   const noexcept; // all physics bodies
std::vector<Tracker<PhysicBody>>& statics(void)  const noexcept; // static bodies only
std::vector<Tracker<PhysicBody>>& dynamics(void) const noexcept; // dynamic bodies only

PhysicBody

void        tag(std::string_view) noexcept;         // set identifying tag
std::string tag(void) const noexcept;                // get tag
u64         ID(void) const noexcept;                 // get unique body ID
void        isSolid(bool) noexcept;                  // set solid or sensor
bool        isSolid(void) const noexcept;            // check if solid
void        move(const Vec2d&) noexcept;             // move body
void        rotate(f32) noexcept;                    // rotate body
void        scale(const Fact2d&) noexcept;           // scale body
void        resize(const Dim2d&) noexcept;           // resize body
Vec2d       center(void) const noexcept;             // get center position
Dim2d       size(void) const noexcept;               // get size
void        focusAnimation(std::string_view);        // focus an animation
Animation&  animation(std::string_view);             // get animation by name (use focused animation by default)
void        linkAnimation(std::string_view, const Animation&); // attach an animation (first animation is automatically focused)

// Parameter : Tracker<PhysicBody> self, Tracker<PhysicBody> other
_PhysicSignal<Tracker<PhysicBody>, Tracker<PhysicBody>> onContact;       // emitted on contact persist
_PhysicSignal<Tracker<PhysicBody>, Tracker<PhysicBody>> onContactStart;  // emitted on contact begin
_PhysicSignal<Tracker<PhysicBody>, Tracker<PhysicBody>> onContactEnd;    // emitted on contact end

StaticBody

explicit StaticBody(const Geometry& shape); // create and register a static physics body

DynamicBody

explicit DynamicBody(const Geometry& shape); // create and register a dynamic physics body
void mass(f32) noexcept;                    // set mass (kg)
f32  mass(void) const noexcept;             // get mass (kg)

void density(f32) noexcept;                 // set density (kg/m², independent of size)
f32  density(void) const noexcept;          // get density (kg/m²)

void bounce(f32) noexcept;                  // set restitution (0.0 – 1.0)
f32  bounce(void) const noexcept;           // get restitution

void bounceThreshold(f32) noexcept;         // set minimum velocity for bounce
f32  bounceThreshold(void) const noexcept;  // get bounce threshold

void infiniteBounce(bool) noexcept;         // enable or disable perfect bouncing
bool infiniteBounce(void) const noexcept;   // check whether perfect bouncing is enabled

void friction(f32) noexcept;                // set friction coefficient
f32  friction(void) const noexcept;         // get friction coefficient

void gravity(bool) noexcept;                // enable or disable gravity
bool gravity(void) const noexcept;          // check whether gravity is enabled

void isBullet(bool) noexcept;               // enable bullet (CCD) mode for fast objects
bool isBullet(void) const noexcept;         // check whether bullet mode is enabled

void warp(const Area&) noexcept;            // set screen-wrapping area
Area warp(void) const noexcept;             // get screen-wrapping area

void limit(const Area&) noexcept;           // set movement boundaries
Area limit(void) const noexcept;            // get movement boundaries

void velocity(const Vec2d&) noexcept;       // set linear velocity
Vec2d velocity(void) const noexcept;        // get linear velocity

void jump(f32) noexcept;                    // apply an upward impulse
void push(const Vec2d&) noexcept;           // apply a continuous force

// Parameter: Tracker<DynamicBody> self
_PhysicSignal<Tracker<DynamicBody>> onMove;         // emitted while moving
_PhysicSignal<Tracker<DynamicBody>> onMoveUp;       // emitted while moving upward
_PhysicSignal<Tracker<DynamicBody>> onMoveDown;     // emitted while moving downward
_PhysicSignal<Tracker<DynamicBody>> onMoveLeft;     // emitted while moving left
_PhysicSignal<Tracker<DynamicBody>> onMoveRight;    // emitted while moving right

Sound / Music / SFX

// Sound (abstract base)
i8 playFor(void) const noexcept; // remaining loops
u8 volume(void)  const noexcept; // current volume

virtual void play(i8 = 0) = 0;                // start playback (0=once, -1=infinite, n=n times)
virtual void stop(void) = 0;                  // stop playback
virtual void pause(void) = 0;                 // pause playback
virtual void resume(void) = 0;                // resume playback
virtual void volume(u8) noexcept = 0;         // set volume (1–128)

Signal<> onRepeat; // emit when sound remaining
Signal<> onFinish; // emit when sound ended (in last remaining)

// Music
Music(std::string_view path, u8 volume = 64); // load music file
void play(i8 loop = 0) override;              // start music
void stop(void) override;                     // stop music
void pause(void) override;                    // pause music
void resume(void) override;                   // resume music
void volume(u8) noexcept override;            // set music volume

// SFX
SFX(std::string_view path, u8 volume = 64);  // load sound effect file
void play(i8 loop = 0) override;              // play sound
void stop(void) override;                     // stop sound on current channel
void stopAll(void);                           // stop all channels playing this SFX
void pause(void) override;                    // pause sound
void resume(void) override;                   // resume sound
void volume(u8) noexcept override;            // set sound volume

TextureBase (abstract)

virtual void          move(const Vec2d&) noexcept = 0;                     // translate texture
virtual void          rotate(f32) noexcept = 0;                             // rotate texture (radians)
virtual void          scale(const Fact2d&) noexcept = 0;                    // scale texture
virtual void          resize(const Dim2d&) noexcept = 0;                    // resize texture
virtual void          transform(const Vec2d&, f32, const Fact2d&) noexcept = 0; // translate + rotate + scale
virtual Vec2d         center(void) const noexcept = 0;                      // get center position
virtual Dim2d         size(void) const noexcept = 0;                        // get current size
virtual Dim2d         realSize(void) const noexcept = 0;                    // get original image size
virtual const Geometry& shape(void) const noexcept = 0;                     // get bounding shape
virtual void          unclip(void) noexcept = 0;                            // remove clipping rectangle
virtual void          clip(const Vec2d&, const Dim2d&) noexcept = 0;        // set clipping rectangle
virtual bool          hasIntersected(const Geometry&) const noexcept = 0;   // collision test
virtual bool          hasIntersected(const TextureBase&) const noexcept;    // collision test (texture vs texture)
virtual const SDL_Rect* getClipRect(void) const noexcept = 0;               // get current clip rect
virtual std::vector<SDL_Vertex> vertices(void) const noexcept = 0;          // get transformed vertices

Texture / Sprite / Image

Texture(std::string_view path, const S& shape); // load texture from file for a given shape
// All TextureBase methods above are implemented here.

// Sprite alias (Rectangle shape)
Sprite(std::string_view path, const Rectangle&); // rectangular sprite

Text

Text(std::string_view font_name, Vec2d pos); // create text at position using a loaded font

void anchorX(anchor::x) noexcept;     // set horizontal anchor (left, center, right)
void anchorY(anchor::y) noexcept;     // set vertical anchor (top, middle, bottom)
std::string text(void) const noexcept; // get current text content

void write(std::string_view);   // set text content
void append(std::string_view);  // append text to current content
void append(fmt);               // append a formatting token (see below)
void clear(void);               // clear text content

void maxLength(u16) noexcept;         // set max wrap length (pixels)
u16  maxLength(void) const noexcept;  // get max wrap length
// fmt tokens usable with Text::append(fmt)
enum fmt : u8 {
    nl,     // insert a newline
    tab,    // insert a tab (4 spaces)
    endl,   // mark next append() as a fresh write (erase current content first)
    flush   // clear the text immediately
};
// Stream-style operators (remake2d/stream.hpp)
Text& operator<<(Text&, Text&)            noexcept; // append another Text's content
Text& operator<<(Text&, std::string_view) noexcept; // append a string
Text& operator<<(Text&, fmt)               noexcept; // append a fmt token
template<IsBasicType T> Text& operator<<(Text&, const T&) noexcept; // append any basic/arithmetic type (stringified)

FontManager (singleton font)

void load(std::string_view tag, std::string_view path, u8 size); // load a font from file

Animation

Animation(std::string_view path, const Rectangle& shape,
          u8 total_clips, Dim2d clip_size,
          Vec2d start_pos = {0,0}, u8 spacing = 0); // create sprite sheet animation

void play(i8 loop = 0, u8 fps = 12); // start animation (0=once, -1=infinite, n=n times)
void pause(void) noexcept;           // pause animation
void resume(void) noexcept;          // resume animation
void stop(void) noexcept;            // stop and reset to first frame

Signal<> onRepeat; // emit when animation remaining
Signal<> onFinish; // emit when animation ended (in last remaining)

Camera

Camera(void);  // default camera
Camera(const Vec2d& center, const Dim2d& size, const Dim2d& limit = nil); // camera with bounds

void  zoom(f32)            noexcept;         // set zoom level
void  move(const Vec2d&)   noexcept;         // move camera
void  limit(const Dim2d&)  noexcept;         // set world boundaries
void  resize(const Dim2d&) noexcept;         // set viewport size
void  smoothing(f32)       noexcept;         // set smoothing factor (0.0 – 1.0)

f32   zoom(void)       const noexcept;       // get zoom
Dim2d size(void)       const noexcept;       // get viewport size
Vec2d center(void)     const noexcept;       // get camera position
Vec2d viewCenter(void) const noexcept;       // get the smoothed point the view is centered on (trails the followed point, clamped by limit)
Dim2d limit(void)      const noexcept;       // get world boundaries
Vec2d offset(void)     const noexcept;       // get last frame offset
f32   smoothing(void)  const noexcept;       // get smoothing factor

Vec2d followedPoint(void) const noexcept;    // get tracked point
void  follow(const Followable&) noexcept;    // track a followable object
void  unfollow(void)            noexcept;    // track a followable object

Signal<> onMove;  // emitted when camera moves

Followable

virtual Vec2d center(void) const noexcept = 0;

TileMap

struct TileMapData {
    Vec2d  center;
    Dim2d  size;
    Grid2d cut;
    Dim2d  clip_size;
    Vec2d  clip_start;
    Vec2d  margin;
};

// TileMapData constructor
TileMapData (Vec2d center, Dim2d size, Grid2d cut, Dim2d clip_size, Vec2d clip_start = 0, Vec2d margin = 0);

TileMap(std::string_view tileset_path, TileMapData data); // create tile map

using TileID       = u32;                          // tile identifier type
using TileTemplate = std::vector<TileID>;          // tile layout type

Vec2d  center(void)    const noexcept;             // get map position
Dim2d  size(void)      const noexcept;             // get map size
Dim2d  clip(void)      const noexcept;             // get tile clip size
Grid2d cut(void)       const noexcept;             // get grid dimensions
TileMapData data(void) const noexcept;             // get all grid data

void   move(Vec2d)       noexcept;                 // move map
void   resize(Dim2d)     noexcept;                 // resize map
void   counterStart(i16) noexcept;                 // set starting tile ID offset
void   tag(std::string_view, TileID);              // assign a tag to a tile ID

void   load(TileTemplate);                         // load tile layout
void   build(void) noexcept;                       // build physics and animations (async)

void        applyPhysic(TileID);                   // apply physics to a tile type
void        applyPhysic(std::string_view);         // apply physics to a tagged tile type
PhysicBody& body(TileID);                          // get physics body by tile ID
PhysicBody& body(std::string_view);                // get physics body by tag

u32         tileCount(void) const noexcept;        // total number of tiles
u32         tileCount(TileID) const noexcept;      // count of a specific tile type

TileGrid

TileGrid(const Vec2d& center, const Dim2d& size, const Grid2d& cut); // create a grid
void move(const Vec2d&)   noexcept;   // move grid center
void cut(const Grid2d&)   noexcept;   // change grid divisions
void resize(const Dim2d&) noexcept;   // resize grid

usize         count(void)         const noexcept;   // total number of cells
Dim2d         size(void)          const noexcept;   // grid size
Grid2d        cut(void)           const noexcept;   // current grid divisions
Vec2d         center(void)        const noexcept;   // grid center
Area          cell(const Grid2d&) const noexcept;   // get a specific cell area by (col, row)

std::vector<Area>& cells(void)             noexcept; // get all cell areas
const std::vector<Area>& cells(void) const noexcept; // get all cell areas (const)

Parallax

Parallax(const Vec2d& center, const Dim2d& size, const std::vector<Sprite>& sprites, const std::vector<u8>& quotients); // create parallax background
void  move(const Vec2d&)     noexcept;  // move background
void  resize(const Dim2d&)   noexcept;  // resize background
void  velocity(const Vec2d&) noexcept;  // set scroll speed
Vec2d velocity(void)   const noexcept;  // get scroll speed
Dim2d size(void)       const noexcept;  // get size
Vec2d center(void)     const noexcept;  // get center
void  linkCamera(const Camera&) noexcept; // scroll with a camera's movement

Data / Save

// Data (sum type)
Data(byte);
Data(rune);
Data(int);
Data(imax);
Data(fmax);
Data(bool);
Data(Vec2d);
Data(Fact2d);
Data(Grid2d);
Data(Dim2d);
Data(Color);
Data(Area);
Data(std::string_view);
Data(std::vector<Data>);
Data(std::map<std::string, Data>);

static Data list(std::span<Data>);                              // create list
static Data map(std::span<std::pair<const std::string, Data>>); // create map

const Data& operator[](usize idx) const;                // access list element by index
const Data& operator[](std::string_view key) const;     // access map field by key

template<typename T> operator T(void) const;            // implicit conversion
template<typename T> T get(std::string_view key) const; // typed field access

// Savable
virtual Data sdata(void) const  = 0;  // serialize to Data
virtual void ldata(const Data&) = 0;  // load from Data

// DataFile
DataFile(std::string_view name);           // open or create a data file
void save(const Data&);                    // save raw Data
void load(Data&);                          // load raw Data
void save(const ISavable&);                // save a savable object
void load(ISavable&);                      // load into a savable object

void        remove(void)      noexcept;    // delete the file
bool        exist(void) const noexcept;    // check if file exists
std::string path(void)  const noexcept;    // get full file path
std::string name(void)  const noexcept;    // get file name

template<IsSavable T> friend DataFile& operator<<(DataFile&, const T&); // stream-save a savable object
template<IsSavable T> friend DataFile& operator>>(DataFile&, T&);       // stream-load a savable object

// SaveManager (singleton data)
std::string root(void)       const noexcept;    // get root directory
void        root(std::string_view) noexcept;    // set root directory

bool        isInitialized(void) const noexcept; // check if initialized

Scene & Actor

// Actor
virtual void update(void) = 0;     // update logic (override in derived)

void addChild(Actor&)      noexcept;  // add child
void removeChild(Actor&)   noexcept;  // remove child

UnsafeTracker<Actor>& parent(void)             noexcept; // get current parent (mutable)
const UnsafeTracker<Actor>& parent(void) const noexcept; // get current parent (constant)

std::vector<UnsafeTracker<Actor>>& children(void)             noexcept; // get all children (mutable)
const std::vector<UnsafeTracker<Actor>>& children(void) const noexcept; // get all children (constant)

void active(bool)       noexcept; // enable/disable active
bool active(void) const noexcept; // check if is active


// template<IsPhysic P> PhysicActor<P> (inherit from Actor)
PhysicActor(const Geometry&); // create actor with physics body
P body; // public physics body member

virtual void update(void) override {}; // update logic (override in derived)

using StaticActor  = PhysicActor<StaticBody>;
using DynamicActor = PhysicActor<DynamicBody>;

// Scene
void execute(const Frame&);               // set main update function
void add(Actor&, i16 layer = 0);          // add actor to a layer
void add(const Frame&, i16 layer = 0);    // add function to a layer
void remove(Actor&);                      // remove actor from scene
void update(void);                        // run one frame
void active(bool)       noexcept;         // enable/disable active
bool active(void) const noexcept;         // check if is active
void setLayerActive(i16 layer, bool);     // enable/disable all actors on a layer
void setActorActive(Actor&, bool);        // enable/disable a specific actor

// Act
void add(std::string_view name, Scene&);                               // register a scene
void link(std::string_view name, std::span<std::string_view> scenes);  // group scenes under a tag
void focus(std::string_view);                                          // activate a scene or link
void update(void) const;                                               // update focused scene(s)
void updates(void) const;                                              // update all scenes
void update(std::string_view) const;                                   // update a specific scene or link

Tracker<Scene>       scene(std::string_view);                          // get scene by tag
const Tracker<Scene> scene(std::string_view) const;                    // get scene by tag (const)

Croutines

// Croutine<Args...> and Croutine<>
template<typename F> void load(F&& function);  // attach a coroutine function
void run(Args... args);                        // start with arguments
void run(void);                                // start without arguments (Croutine<> only)
void resume(void) noexcept;                    // resume after pause
void stop(void) noexcept;                      // stop permanently
void wait(void) noexcept;                      // block caller until coroutine finishes
bool isRunning(void) noexcept;                 // check if currently running
u64  ID(void) const noexcept;                  // get coroutine ID
u64  majorID(void) const noexcept;             // get worker thread ID
void priority(croutine::priority) noexcept;    // set scheduling priority (engine, heavy, user)
void isEngine(bool) noexcept;                  // mark as engine priority
void isHeavy(bool) noexcept;                   // mark as heavy priority
auto operator co_await(void) noexcept;         // await completion from another coroutine

// Macros
rmk_pause();            // yield execution back to the scheduler
rmk_await(coro);        // await another croutine
rmk_lockedPause(lock);  // yield while releasing a PauseGuard lock

Lock (coroutine-safe locks)

// PauseGuard — wraps a std::mutex for exclusive access across a rmk_pause()
explicit PauseGuard(std::mutex&); // lock mutex on construction
void unlock(void) noexcept;       // manually unlock
void relock(void) noexcept;       // manually re-lock

// SharedPause — wraps a std::shared_mutex for shared read access across a rmk_pause()
explicit SharedPause(std::shared_mutex&); // shared lock on construction
void unlock(void) noexcept;               // manually unlock
void relock(void) noexcept;               // manually re-lock

// Macro
rmk_lockedPause(lock); // release lock, yield, re-acquire on resume

MainRenderLoop (singleton loop)

void execute(Window& win, const std::function<void(void)>& body) noexcept; // loop while window is open
void execute(const std::function<bool(void)>& cond, const std::function<void(void)>& body) noexcept; // loop with custom condition
void update(void) noexcept;                             // start the main loop (blocking)
bool isRunning(void) const noexcept;                    // check if loop is active

Random (singleton random)

u32  seed(void) noexcept;                   // get current seed
void seed(u32)  noexcept;                   // set seed

u32  randSeed(void) noexcept;               // generate a hardware random seed
void rollSeed(void) noexcept;               // generate and apply a new random seed

template<IsBasicType T = i32> T rand(const T& min, const T& max) noexcept;      // random integer/float
template<> Vec2d  rand<Vec2d>(const Vec2d& min, const Vec2d& max) noexcept;     // random vector
template<> Fact2d rand<Fact2d>(const Fact2d& min, const Fact2d& max) noexcept;  // random vector
template<> Grid2d rand<Grid2d>(const Grid2d& min, const Grid2d& max) noexcept;  // random vector
template<> Dim2d  rand<Dim2d>(const Dim2d& min, const Dim2d& max) noexcept;     // random dimensions
template<> Color  rand<Color>(const Color& min, const Color& max) noexcept;     // random color in HSL range

Color mixColor(f32 saturation = 1.0f, f32 lightness = 0.5f) noexcept;   // random vivid color (HSL)

template<typename T> T choice(const std::span<T>&) noexcept;            // random element from span
std::string choice(const std::span<std::string_view>&) noexcept;        // random string from span

std::vector<u8> dice(u8 n, u8 faces) noexcept;  // roll n dice with given face count
bool chance(f32 probability) noexcept;          // true with given probability (0.0–1.0)

Miscellaneous Utilities

// Nil
constexpr Nil nil; // universal null/zero placeholder
// Operators: all types comparable to nil via == and !=
// (nil == T{} evaluates to true)


enum class layer : i16 {
    min   = -50, // minimum layer
    max   = 249, // maximum layer

    size  = 50, // distance between two layers

    ground = min,           // ground layer start
    world  = ground + size, // world layer start
    sky    = world  + size, // sky layer start
    ui     = sky    + size, // ui layer start
    log    = ui     + size, // log layer start

    count = log + size * 2 - 1 // total layers count
};

// Layer helpers (returns i16 layer value)
namespace level {
    i16 ground(u8 wall) noexcept; // wall + layer::ground  (background elements)
    i16 world(u8 wall)  noexcept; // wall + layer::world   (game world objects)
    i16 sky(u8 wall)    noexcept; // wall + layer::sky     (foreground effects)
    i16 ui(u8 wall)     noexcept; // wall + layer::ui      (user interface)
    i16 log(u8 wall)    noexcept; // wall + layer::log     (debug overlay)
}

// Angle utilities
namespace angle {
    fmax degToRad(fmax degrees) noexcept;
    fmax radToDeg(fmax radians) noexcept;

    namespace literal {
        fmax operator""_deg(fmax) noexcept; // degrees to radians literal
        fmax operator""_rad(fmax) noexcept; // radians to degrees literal
    }
}

// File utilities
namespace file {
    std::string jump(std::span<std::string_view> paths) noexcept; // return first existing file path
}

// Time literals
namespace time::literal {
    operator""_ns; operator""_us; operator""_ms;
    operator""_s;  operator""_min; operator""_h;
    operator""_d;  operator""_w; operator""_mo; operator""_y;
}

// Physics unit conversion
namespace physic {
    f32   pixelToMeter(f32) noexcept;
    f32   meterToPixel(f32) noexcept;
    Vec2d pixelToMeter(const Vec2d&) noexcept;
    Vec2d meterToPixel(const Vec2d&) noexcept;
    Dim2d pixelToMeter(const Dim2d&) noexcept;
    Dim2d meterToPixel(const Dim2d&) noexcept;
}

// Constants
inline constexpr fmax pi      = 3.14159265358979;
inline constexpr bool on      = true,  off     = false;
inline constexpr bool isTrue  = true,  isFalse = false;
inline constexpr u8   success = 0,     fail    = 1;

Script

// SolState (singleton script)
template<typename T, typename... Ctors>
void registerType(std::string_view name, std::function<void(SolState::Type&)> init = nullptr); // register C++ type to Lua

template<typename T> void loadVar(std::string_view id, T& data) noexcept; // expose C++ variable to Lua

std::string loadedTypes(void) const noexcept;              // list all registered type names
bool        isLoadedType(std::string_view) const noexcept; // check if a type is registered

// Script
Script(std::string_view lua_file);            // load a Lua script
template<typename T> T get(std::string_view); // get a Lua variable by name
void update(void);                            // run the script

Signal<> onFileChanged;                       // emitted when script file changes on disk

Info

Lua script execution requires the remakeScript add-on to be built and linked (COMPONENTS Script). See Installation for details.