16 for (
const Font &font :
_fonts) {
19 for (
const auto &[name, texture] :
_textures) {
22 for (
const auto &[name, sound] :
_sounds) {
32 if (!::IsWindowReady()) {
64 return ::GetScreenWidth();
68 return ::GetScreenHeight();
111 return ::GetFrameTime();
117 clr.a = (color >> 24) & 0xFF;
118 clr.r = (color >> 16) & 0xFF;
119 clr.g = (color >> 8) & 0xFF;
120 clr.b = color & 0xFF;
126 clr.a = (color >> 24) & 0xFF;
127 clr.r = (color >> 16) & 0xFF;
128 clr.g = (color >> 8) & 0xFF;
129 clr.b = color & 0xFF;
135 clr.a = (color >> 24) & 0xFF;
136 clr.r = (color >> 16) & 0xFF;
137 clr.g = (color >> 8) & 0xFF;
138 clr.b = color & 0xFF;
139 ::DrawCircleLines(x, y, radius, clr);
144 clr.a = (color >> 24) & 0xFF;
145 clr.r = (color >> 16) & 0xFF;
146 clr.g = (color >> 8) & 0xFF;
147 clr.b = color & 0xFF;
152 Font font = ::LoadFontEx(filepath, size, 0, 0);
153 if (font.texture.id == 0)
160 if (fontHandle >= 0 &&
static_cast<size_t>(fontHandle) <
_fonts.size()) {
166 unsigned int color) {
168 clr.a = (color >> 24) & 0xFF;
169 clr.r = (color >> 16) & 0xFF;
170 clr.g = (color >> 8) & 0xFF;
171 clr.b = color & 0xFF;
173 if (fontHandle >= 0 &&
static_cast<size_t>(fontHandle) <
_fonts.size()) {
174 ::DrawTextEx(
_fonts[fontHandle], text, {(float)x, (
float)y}, fontSize, 1.0f, clr);
177 ::DrawText(text, x, y, fontSize, clr);
181 if (fontHandle >= 0 &&
static_cast<size_t>(fontHandle) <
_fonts.size()) {
182 return _fonts[fontHandle].baseSize;
197 int height,
int format) {
199 img.data =
const_cast<void *
>(pixels);
204 Texture2D texture = ::LoadTextureFromImage(img);
230 clr.a = (tint >> 24) & 0xFF;
231 clr.r = (tint >> 16) & 0xFF;
232 clr.g = (tint >> 8) & 0xFF;
239 float destX,
float destY,
float rotation,
float scale,
244 clr.a = (tint >> 24) & 0xFF;
245 clr.r = (tint >> 16) & 0xFF;
246 clr.g = (tint >> 8) & 0xFF;
249 Rectangle source = {(float)srcX, (
float)srcY, (float)srcW, (
float)srcH};
250 Rectangle dest = {destX, destY, (float)srcW * scale, (
float)srcH * scale};
251 Vector2 origin = {0, 0};
256 TraceLog(
LOG_WARNING,
"DrawTextureEx: Texture '%s' not found! Drawing fallback rectangle",
258 ::DrawRectangle((
int)destX, (
int)destY, (
int)(srcW * scale), (
int)(srcH * scale), BLUE);
265 width = iter->second.width;
266 height = iter->second.height;
273 float destX,
float destY,
float destW,
float destH,
278 clr.a = (tint >> 24) & 0xFF;
279 clr.r = (tint >> 16) & 0xFF;
280 clr.g = (tint >> 8) & 0xFF;
283 Rectangle source = {
static_cast<float>(srcX),
static_cast<float>(srcY),
static_cast<float>(srcW),
284 static_cast<float>(srcH)};
285 Rectangle dest = {destX, destY, destW, destH};
286 Vector2 origin = {0, 0};
294 return ::IsKeyPressed(key);
298 return ::IsKeyDown(key);
302 return ::IsKeyReleased(key);
306 return ::IsGamepadAvailable(gamepad);
310 return ::IsGamepadButtonPressed(gamepad, button);
314 return ::IsGamepadButtonDown(gamepad, button);
318 return ::GetGamepadAxisMovement(gamepad, axis);
322 return ::IsMouseButtonPressed(button);
326 return ::IsMouseButtonDown(button);
339 return ::WindowShouldClose();
343 return ::GetMouseX();
347 return ::GetMouseY();
351 return ::GetCharPressed();
355 return ::GetScreenWidth();
359 return ::GetScreenHeight();
364 clr.a = (color >> 24) & 0xFF;
365 clr.r = (color >> 16) & 0xFF;
366 clr.g = (color >> 8) & 0xFF;
367 clr.b = color & 0xFF;
373 clr.a = (color >> 24) & 0xFF;
374 clr.r = (color >> 16) & 0xFF;
375 clr.g = (color >> 8) & 0xFF;
376 clr.b = color & 0xFF;
382 clr.a = (color >> 24) & 0xFF;
383 clr.r = (color >> 16) & 0xFF;
384 clr.g = (color >> 8) & 0xFF;
385 clr.b = color & 0xFF;
397 _colorblindShader = ::LoadShader(
"assets/shaders/colorblind.vs",
"assets/shaders/colorblind.fs");
477 Vector2 origin = {0.0f, 0.0f};
494 for (
const auto &[name, sound] :
_sounds) {
512 if (sound.frameCount == 0) {
520 auto iter =
_sounds.find(soundName);
528 auto iter =
_sounds.find(soundName);
535 auto iter =
_sounds.find(soundName);
542 auto iter =
_sounds.find(soundName);
544 return ::IsSoundPlaying(iter->second);
bool _colorblindShaderLoaded
void SetClearColor(unsigned int color) override
Set the background clear color.
void DrawRectangle(int x, int y, int width, int height, unsigned int color) override
Draw a filled rectangle (alias for DrawRectFilled)
float GetDeltaTime() const override
Get the time elapsed for the last frame.
void DrawRectFilled(int x, int y, int width, int height, unsigned int color) override
Draw a filled rectangle.
int GetMouseX() const override
Get the current X position of the mouse cursor.
void DisplayWindow() override
Display the current frame to the window (end drawing and swap buffers)
void DrawTextureEx(const char *textureName, int srcX, int srcY, int srcW, int srcH, float destX, float destY, float rotation, float scale, unsigned int tint) override
Draw a texture with advanced parameters (rotation, scale, source rectangle)
bool IsKeyPressed(int key) const override
Check if a key was pressed (triggered once when key goes down)
int GetMouseY() const override
Get the current Y position of the mouse cursor.
bool IsKeyDown(int key) const override
Check if a key is currently being held down.
void DrawRect(int x, int y, int width, int height, unsigned int color) override
Draw a rectangle outline.
void DrawCircleFilled(int x, int y, int radius, unsigned int color) override
Draw a filled circle.
bool GetTextureSize(const char *textureName, int &width, int &height) const override
Get the dimensions of a loaded texture.
int LoadFont(const char *filepath, int size) override
Load a font from file.
void UnloadTexture(const char *textureName) override
Unload a previously loaded texture.
void CloseWindow() override
Close the graphics window and cleanup resources.
bool WindowShouldClose() const override
Check if the window should close.
ColorblindFilterType _colorblindFilter
void SetTargetFPS(int fps) override
Set the target frames per second for rendering.
bool IsSoundPlaying(const char *soundName) const override
Check if a sound is currently playing.
void SetSoundVolume(const char *soundName, float volume) override
Set volume for a specific sound.
std::unordered_map< std::string, Texture2D > _textures
int GetFontHeight(int fontHandle, int fontSize) override
Get the height of a font at a given size.
bool IsMouseButtonPressed(int button) const override
Check if a mouse button was pressed (triggered once when button goes down)
void BeginColorblindCapture() override
Begin capturing frame for colorblind filter processing.
int CreateTextureFromMemory(char const *textureName, const void *pixels, int width, int height, int format) override
Create a texture from raw pixel data in memory.
ColorblindFilterType GetColorblindFilter() const override
Get the current colorblind filter type.
float GetGamepadAxisMovement(int gamepad, int axis) const override
Get gamepad axis value (for analog sticks and triggers)
void DrawTexturePro(const char *textureName, int srcX, int srcY, int srcW, int srcH, float destX, float destY, float destW, float destH, unsigned int tint) override
Draw a texture with separate width/height scaling (for non-uniform scaling)
void SetWindowTitle(const char *title) override
Change the window title.
void SetColorblindFilter(ColorblindFilterType filter) override
Set the colorblind filter type.
int GetCharPressed() const override
Get the next character from the keyboard input queue.
void DrawRectangleLines(int x, int y, int width, int height, unsigned int color) override
Draw a rectangle outline (alias for DrawRect)
bool IsAudioDeviceReady() const override
Check if audio device is ready.
void StartDrawing() override
Begin drawing frame (setup canvas for drawing operations)
void ClearWindow() override
Clear the window with the current clear color.
bool IsGamepadAvailable(int gamepad) const override
Check if a gamepad is available/connected.
void SetWindowSize(int width, int height) override
Resize the window.
int GetWindowHeight() const override
Get current window height in pixels.
void UpdateTexture(const char *textureName, const void *pixels) override
Update an existing texture with new pixel data.
void DrawText(int fontHandle, const char *text, int x, int y, int fontSize, unsigned int color) override
Draw text using a loaded font.
void ToggleFullScreen() override
Toggle between fullscreen and windowed mode.
void CloseAudioDevice() override
Close the audio device and cleanup audio resources.
bool IsGamepadButtonPressed(int gamepad, int button) const override
Check if a gamepad button was pressed this frame.
bool IsMouseButtonDown(int button) const override
Check if a mouse button is currently being held down.
RaylibGraphics()
Construct a new Raylib graphics object.
std::vector< Font > _fonts
bool LoadSound(const char *soundName, const char *filepath) override
Load a sound from file.
void UnloadColorblindShader()
bool IsKeyReleased(int key) const override
Check if a key was released (triggered once when key goes up)
bool IsWindowOpen() const override
Check if the window is still open.
void LoadColorblindShader()
int GetWindowWidth() const override
Get current window width in pixels.
void DrawCircle(int x, int y, int radius, unsigned int color) override
Draw a circle outline.
std::unordered_map< std::string, Sound > _sounds
void InitAudioDevice() override
Initialize the audio device.
void InitWindow(int width, int height, const char *title) override
Initialize the graphics window.
void UnloadFont(int fontHandle) override
Unload a previously loaded font.
RenderTexture2D _colorblindRenderTexture
void DrawTexture(const char *textureName, int x, int y, unsigned int tint) override
Draw a texture at the specified position.
int GetScreenWidth() const override
Get the screen width (same as window width)
void UnloadSound(const char *soundName) override
Unload a previously loaded sound.
void GetMousePosition(float &x, float &y) const override
Get the current mouse cursor position.
int GetScreenHeight() const override
Get the screen height (same as window height)
void TakeScreenshot(const char *filepath) override
Capture the current screen and save it to a file.
void EndColorblindCapture() override
End capturing and apply the colorblind filter.
float GetTime() const override
Get elapsed time since initialization.
~RaylibGraphics() override
Destroy the Raylib graphics object and cleanup resources.
bool IsGamepadButtonDown(int gamepad, int button) const override
Check if a gamepad button is currently held down.
int LoadTexture(const char *name, const char *filepath) override
Load a texture from an image file.
void PlaySound(const char *soundName) override
Play a loaded sound.
ColorblindFilterType
Colorblind filter types for accessibility.