R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
Graphics::RaylibGraphics Class Reference

Raylib implementation of the IGraphics interface. More...

#include <RaylibGraphics.hpp>

Inheritance diagram for Graphics::RaylibGraphics:
Inheritance graph
Collaboration diagram for Graphics::RaylibGraphics:
Collaboration graph

Public Member Functions

 RaylibGraphics ()
 Construct a new Raylib graphics object.
 
 ~RaylibGraphics () override
 Destroy the Raylib graphics object and cleanup resources.
 
void InitWindow (int width, int height, const char *title) override
 Initialize the graphics window.
 
void ClearWindow () override
 Clear the window with the current clear color.
 
void StartDrawing () override
 Begin drawing frame (setup canvas for drawing operations)
 
void DisplayWindow () override
 Display the current frame to the window (end drawing and swap buffers)
 
bool IsWindowOpen () const override
 Check if the window is still open.
 
void CloseWindow () override
 Close the graphics window and cleanup resources.
 
int GetWindowWidth () const override
 Get current window width in pixels.
 
int GetWindowHeight () const override
 Get current window height in pixels.
 
void SetWindowTitle (const char *title) override
 Change the window title.
 
void SetWindowSize (int width, int height) override
 Resize the window.
 
void ToggleFullScreen () override
 Toggle between fullscreen and windowed mode.
 
void SetTargetFPS (int fps) override
 Set the target frames per second for rendering.
 
void SetClearColor (unsigned int color) override
 Set the background clear color.
 
void TakeScreenshot (const char *filepath) override
 Capture the current screen and save it to a file.
 
float GetTime () const override
 Get elapsed time since initialization.
 
float GetDeltaTime () const override
 Get the time elapsed for the last frame.
 
void DrawRect (int x, int y, int width, int height, unsigned int color) override
 Draw a rectangle outline.
 
void DrawRectFilled (int x, int y, int width, int height, unsigned int color) override
 Draw a filled rectangle.
 
void DrawCircle (int x, int y, int radius, unsigned int color) override
 Draw a circle outline.
 
void DrawCircleFilled (int x, int y, int radius, unsigned int color) override
 Draw a filled circle.
 
int LoadFont (const char *filepath, int size) override
 Load a font from file.
 
void UnloadFont (int fontHandle) override
 Unload a previously loaded font.
 
void DrawText (int fontHandle, const char *text, int x, int y, int fontSize, unsigned int color) override
 Draw text using a loaded font.
 
int GetFontHeight (int fontHandle, int fontSize) override
 Get the height of a font at a given size.
 
int LoadTexture (const char *name, const char *filepath) override
 Load a texture from an image file.
 
int CreateTextureFromMemory (char const *textureName, const void *pixels, int width, int height, int format) override
 Create a texture from raw pixel data in memory.
 
void UpdateTexture (const char *textureName, const void *pixels) override
 Update an existing texture with new pixel data.
 
void UnloadTexture (const char *textureName) override
 Unload a previously loaded texture.
 
void DrawTexture (const char *textureName, int x, int y, unsigned int tint) override
 Draw a texture at the specified position.
 
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 GetTextureSize (const char *textureName, int &width, int &height) const override
 Get the dimensions of a loaded texture.
 
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)
 
bool IsKeyPressed (int key) const override
 Check if a key was pressed (triggered once when key goes down)
 
bool IsKeyDown (int key) const override
 Check if a key is currently being held down.
 
bool IsKeyReleased (int key) const override
 Check if a key was released (triggered once when key goes up)
 
bool IsGamepadAvailable (int gamepad) const override
 Check if a gamepad is available/connected.
 
bool IsGamepadButtonPressed (int gamepad, int button) const override
 Check if a gamepad button was pressed this frame.
 
bool IsGamepadButtonDown (int gamepad, int button) const override
 Check if a gamepad button is currently held down.
 
float GetGamepadAxisMovement (int gamepad, int axis) const override
 Get gamepad axis value (for analog sticks and triggers)
 
bool IsMouseButtonPressed (int button) const override
 Check if a mouse button was pressed (triggered once when button goes down)
 
bool IsMouseButtonDown (int button) const override
 Check if a mouse button is currently being held down.
 
void GetMousePosition (float &x, float &y) const override
 Get the current mouse cursor position.
 
bool WindowShouldClose () const override
 Check if the window should close.
 
int GetMouseX () const override
 Get the current X position of the mouse cursor.
 
int GetMouseY () const override
 Get the current Y position of the mouse cursor.
 
int GetCharPressed () const override
 Get the next character from the keyboard input queue.
 
int GetScreenWidth () const override
 Get the screen width (same as window width)
 
int GetScreenHeight () const override
 Get the screen height (same as window height)
 
void DrawRectangle (int x, int y, int width, int height, unsigned int color) override
 Draw a filled rectangle (alias for DrawRectFilled)
 
void DrawRectangleLines (int x, int y, int width, int height, unsigned int color) override
 Draw a rectangle outline (alias for DrawRect)
 
void DrawText (const char *text, int x, int y, int fontSize, unsigned int color) override
 Draw text using default font (simplified version)
 
void SetColorblindFilter (ColorblindFilterType filter) override
 Set the colorblind filter type.
 
ColorblindFilterType GetColorblindFilter () const override
 Get the current colorblind filter type.
 
void BeginColorblindCapture () override
 Begin capturing frame for colorblind filter processing.
 
void EndColorblindCapture () override
 End capturing and apply the colorblind filter.
 
void InitAudioDevice () override
 Initialize the audio device.
 
void CloseAudioDevice () override
 Close the audio device and cleanup audio resources.
 
bool IsAudioDeviceReady () const override
 Check if audio device is ready.
 
bool LoadSound (const char *soundName, const char *filepath) override
 Load a sound from file.
 
void UnloadSound (const char *soundName) override
 Unload a previously loaded sound.
 
void PlaySound (const char *soundName) override
 Play a loaded sound.
 
void SetSoundVolume (const char *soundName, float volume) override
 Set volume for a specific sound.
 
bool IsSoundPlaying (const char *soundName) const override
 Check if a sound is currently playing.
 
- Public Member Functions inherited from Graphics::IGraphics
virtual ~IGraphics ()=default
 Virtual destructor.
 

Private Member Functions

void LoadColorblindShader ()
 
void UnloadColorblindShader ()
 

Private Attributes

std::vector< Font > _fonts
 
std::unordered_map< std::string, Texture2D > _textures
 
std::unordered_map< std::string, Sound > _sounds
 
Color _clearColor {255, 255, 255, 255}
 
bool _windowInitialized = false
 
Shader _colorblindShader {}
 
RenderTexture2D _colorblindRenderTexture {}
 
ColorblindFilterType _colorblindFilter {ColorblindFilterType::NONE}
 
bool _colorblindShaderLoaded {false}
 
int _filterTypeLoc {-1}
 
bool _audioInitialized = false
 

Detailed Description

Raylib implementation of the IGraphics interface.

Definition at line 21 of file RaylibGraphics.hpp.

Constructor & Destructor Documentation

◆ RaylibGraphics()

Graphics::RaylibGraphics::RaylibGraphics ( )

Construct a new Raylib graphics object.

Definition at line 12 of file RaylibGraphics.cpp.

◆ ~RaylibGraphics()

Graphics::RaylibGraphics::~RaylibGraphics ( )
override

Destroy the Raylib graphics object and cleanup resources.

Definition at line 14 of file RaylibGraphics.cpp.

References _audioInitialized, _fonts, _sounds, _textures, CloseAudioDevice(), UnloadColorblindShader(), UnloadFont(), UnloadSound(), and UnloadTexture().

Here is the call graph for this function:

Member Function Documentation

◆ BeginColorblindCapture()

void Graphics::RaylibGraphics::BeginColorblindCapture ( )
overridevirtual

Begin capturing frame for colorblind filter processing.

Note
Must be called after StartDrawing() and before any draw calls

Implements Graphics::IGraphics.

Definition at line 438 of file RaylibGraphics.cpp.

References _clearColor, _colorblindFilter, _colorblindRenderTexture, _colorblindShaderLoaded, GetScreenHeight(), GetScreenWidth(), and Graphics::NONE.

Referenced by Rendering::Render().

Here is the call graph for this function:

◆ ClearWindow()

void Graphics::RaylibGraphics::ClearWindow ( )
overridevirtual

Clear the window with the current clear color.

Implements Graphics::IGraphics.

Definition at line 47 of file RaylibGraphics.cpp.

References _clearColor.

Referenced by Rendering::ClearWindow(), and Rendering::Render().

◆ CloseAudioDevice()

void Graphics::RaylibGraphics::CloseAudioDevice ( )
overridevirtual

Close the audio device and cleanup audio resources.

Implements Graphics::IGraphics.

Definition at line 492 of file RaylibGraphics.cpp.

References _audioInitialized, _sounds, CloseAudioDevice(), and UnloadSound().

Referenced by CloseAudioDevice(), and ~RaylibGraphics().

Here is the call graph for this function:

◆ CloseWindow()

void Graphics::RaylibGraphics::CloseWindow ( )
overridevirtual

Close the graphics window and cleanup resources.

Implements Graphics::IGraphics.

Definition at line 71 of file RaylibGraphics.cpp.

References _windowInitialized, CloseWindow(), and WindowShouldClose().

Referenced by CloseWindow(), and Rendering::Shutdown().

Here is the call graph for this function:

◆ CreateTextureFromMemory()

int Graphics::RaylibGraphics::CreateTextureFromMemory ( char const *  textureName,
const void *  pixels,
int  width,
int  height,
int  format 
)
overridevirtual

Create a texture from raw pixel data in memory.

Parameters
pixelsPointer to raw pixel data
widthWidth of the texture in pixels
heightHeight of the texture in pixels
formatPixel format (implementation-specific)
Returns
Texture handle (integer ID) for use in drawing operations

Implements Graphics::IGraphics.

Definition at line 196 of file RaylibGraphics.cpp.

References _textures.

◆ DisplayWindow()

void Graphics::RaylibGraphics::DisplayWindow ( )
overridevirtual

Display the current frame to the window (end drawing and swap buffers)

Implements Graphics::IGraphics.

Definition at line 55 of file RaylibGraphics.cpp.

Referenced by Rendering::Render().

◆ DrawCircle()

void Graphics::RaylibGraphics::DrawCircle ( int  x,
int  y,
int  radius,
unsigned int  color 
)
overridevirtual

Draw a circle outline.

Parameters
xX coordinate of the circle center
yY coordinate of the circle center
radiusRadius of the circle in pixels
colorColor in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 133 of file RaylibGraphics.cpp.

Referenced by DrawCircleFilled().

◆ DrawCircleFilled()

void Graphics::RaylibGraphics::DrawCircleFilled ( int  x,
int  y,
int  radius,
unsigned int  color 
)
overridevirtual

Draw a filled circle.

Parameters
xX coordinate of the circle center
yY coordinate of the circle center
radiusRadius of the circle in pixels
colorColor in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 142 of file RaylibGraphics.cpp.

References DrawCircle().

Here is the call graph for this function:

◆ DrawRect()

void Graphics::RaylibGraphics::DrawRect ( int  x,
int  y,
int  width,
int  height,
unsigned int  color 
)
overridevirtual

Draw a rectangle outline.

Parameters
xX coordinate of the top-left corner
yY coordinate of the top-left corner
widthWidth of the rectangle
heightHeight of the rectangle
colorColor in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 115 of file RaylibGraphics.cpp.

References DrawRectangleLines().

Here is the call graph for this function:

◆ DrawRectangle()

void Graphics::RaylibGraphics::DrawRectangle ( int  x,
int  y,
int  width,
int  height,
unsigned int  color 
)
overridevirtual

Draw a filled rectangle (alias for DrawRectFilled)

Parameters
xX coordinate of the top-left corner
yY coordinate of the top-left corner
widthWidth of the rectangle
heightHeight of the rectangle
colorColor in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 362 of file RaylibGraphics.cpp.

References DrawRectangle().

Referenced by DrawRectangle(), DrawRectFilled(), and DrawTextureEx().

Here is the call graph for this function:

◆ DrawRectangleLines()

void Graphics::RaylibGraphics::DrawRectangleLines ( int  x,
int  y,
int  width,
int  height,
unsigned int  color 
)
overridevirtual

Draw a rectangle outline (alias for DrawRect)

Parameters
xX coordinate of the top-left corner
yY coordinate of the top-left corner
widthWidth of the rectangle
heightHeight of the rectangle
colorColor in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 371 of file RaylibGraphics.cpp.

References DrawRectangleLines().

Referenced by DrawRect(), DrawRectangleLines(), and EntityRenderer::renderWall().

Here is the call graph for this function:

◆ DrawRectFilled()

void Graphics::RaylibGraphics::DrawRectFilled ( int  x,
int  y,
int  width,
int  height,
unsigned int  color 
)
overridevirtual

Draw a filled rectangle.

Parameters
xX coordinate of the top-left corner
yY coordinate of the top-left corner
widthWidth of the rectangle
heightHeight of the rectangle
colorColor in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 124 of file RaylibGraphics.cpp.

References DrawRectangle().

Referenced by EntityRenderer::renderBackground(), EntityRenderer::renderEnemy(), EntityRenderer::renderHealthBar(), Rendering::RenderHUD(), Rendering::RenderUI(), and EntityRenderer::renderWall().

Here is the call graph for this function:

◆ DrawText() [1/2]

void Graphics::RaylibGraphics::DrawText ( const char *  text,
int  x,
int  y,
int  fontSize,
unsigned int  color 
)
overridevirtual

Draw text using default font (simplified version)

Parameters
textText string to render
xX coordinate for text position
yY coordinate for text position
fontSizeSize of the rendered text
colorText color in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 380 of file RaylibGraphics.cpp.

References DrawText().

Here is the call graph for this function:

◆ DrawText() [2/2]

void Graphics::RaylibGraphics::DrawText ( int  fontHandle,
const char *  text,
int  x,
int  y,
int  fontSize,
unsigned int  color 
)
overridevirtual

Draw text using a loaded font.

Parameters
fontHandleFont handle (or -1 for default font)
textText string to render
xX coordinate for text position
yY coordinate for text position
fontSizeSize of the rendered text
colorText color in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 165 of file RaylibGraphics.cpp.

References _fonts.

Referenced by DrawText(), Rendering::DrawText(), EntityRenderer::renderDebugInfo(), Rendering::RenderHUD(), EntityRenderer::renderPlayer(), and Rendering::RenderUI().

◆ DrawTexture()

void Graphics::RaylibGraphics::DrawTexture ( const char *  textureName,
int  x,
int  y,
unsigned int  tint 
)
overridevirtual

Draw a texture at the specified position.

Parameters
textureNameName of the texture to draw
xX coordinate for drawing position
yY coordinate for drawing position
tintTint color in 0xAARRGGBB format (0xFFFFFFFF for no tint)

Implements Graphics::IGraphics.

Definition at line 226 of file RaylibGraphics.cpp.

References _textures, and DrawTexture().

Referenced by DrawTexture().

Here is the call graph for this function:

◆ DrawTextureEx()

void Graphics::RaylibGraphics::DrawTextureEx ( const char *  textureName,
int  srcX,
int  srcY,
int  srcW,
int  srcH,
float  destX,
float  destY,
float  rotation,
float  scale,
unsigned int  tint 
)
overridevirtual

Draw a texture with advanced parameters (rotation, scale, source rectangle)

Parameters
textureNameName of the texture to draw
srcXX coordinate of source rectangle in texture
srcYY coordinate of source rectangle in texture
srcWWidth of source rectangle
srcHHeight of source rectangle
destXX coordinate of destination position
destYY coordinate of destination position
rotationRotation angle in degrees
scaleScale factor (1.0 = original size)
tintTint color in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 238 of file RaylibGraphics.cpp.

References _textures, DrawRectangle(), DrawTexturePro(), and LOG_WARNING.

Referenced by Rendering::DrawSprite(), EntityRenderer::renderOrbitalModule(), EntityRenderer::renderPlayer(), and EntityRenderer::renderProjectile().

Here is the call graph for this function:

◆ DrawTexturePro()

void Graphics::RaylibGraphics::DrawTexturePro ( const char *  textureName,
int  srcX,
int  srcY,
int  srcW,
int  srcH,
float  destX,
float  destY,
float  destW,
float  destH,
unsigned int  tint 
)
overridevirtual

Draw a texture with separate width/height scaling (for non-uniform scaling)

Parameters
textureNameName of the texture to draw
srcXX coordinate of source rectangle in texture
srcYY coordinate of source rectangle in texture
srcWWidth of source rectangle
srcHHeight of source rectangle
destXX coordinate of destination position
destYY coordinate of destination position
destWWidth of destination rectangle
destHHeight of destination rectangle
tintTint color in 0xAARRGGBB format

Implements Graphics::IGraphics.

Definition at line 272 of file RaylibGraphics.cpp.

References _textures, and DrawTexturePro().

Referenced by DrawTextureEx(), DrawTexturePro(), EndColorblindCapture(), and EntityRenderer::renderBackground().

Here is the call graph for this function:

◆ EndColorblindCapture()

void Graphics::RaylibGraphics::EndColorblindCapture ( )
overridevirtual

End capturing and apply the colorblind filter.

Note
Must be called after all draw calls and before DisplayWindow()

Implements Graphics::IGraphics.

Definition at line 457 of file RaylibGraphics.cpp.

References _colorblindFilter, _colorblindRenderTexture, _colorblindShader, _colorblindShaderLoaded, _filterTypeLoc, DrawTexturePro(), GetScreenHeight(), GetScreenWidth(), and Graphics::NONE.

Referenced by Rendering::Render().

Here is the call graph for this function:

◆ GetCharPressed()

int Graphics::RaylibGraphics::GetCharPressed ( ) const
overridevirtual

Get the next character from the keyboard input queue.

Returns
Character code (0 if no character in queue)

Implements Graphics::IGraphics.

Definition at line 350 of file RaylibGraphics.cpp.

◆ GetColorblindFilter()

ColorblindFilterType Graphics::RaylibGraphics::GetColorblindFilter ( ) const
overridevirtual

Get the current colorblind filter type.

Returns
The currently active colorblind filter

Implements Graphics::IGraphics.

Definition at line 434 of file RaylibGraphics.cpp.

References _colorblindFilter.

◆ GetDeltaTime()

float Graphics::RaylibGraphics::GetDeltaTime ( ) const
overridevirtual

Get the time elapsed for the last frame.

Returns
Delta time in seconds (time between current and previous frame)

Implements Graphics::IGraphics.

Definition at line 110 of file RaylibGraphics.cpp.

Referenced by Rendering::RenderGameScene(), and Rendering::UpdateFpsCounter().

◆ GetFontHeight()

int Graphics::RaylibGraphics::GetFontHeight ( int  fontHandle,
int  fontSize 
)
overridevirtual

Get the height of a font at a given size.

Parameters
fontHandleFont handle returned by LoadFont()
fontSizeSize to query
Returns
Height of the font in pixels

Implements Graphics::IGraphics.

Definition at line 180 of file RaylibGraphics.cpp.

References _fonts.

◆ GetGamepadAxisMovement()

float Graphics::RaylibGraphics::GetGamepadAxisMovement ( int  gamepad,
int  axis 
) const
overridevirtual

Get gamepad axis value (for analog sticks and triggers)

Parameters
gamepadGamepad index (0-3)
axisAxis code (use GAMEPAD_AXIS_* constants)
Returns
Axis value between -1.0 and 1.0 (0.0 for triggers at rest)

Implements Graphics::IGraphics.

Definition at line 317 of file RaylibGraphics.cpp.

◆ GetMousePosition()

void Graphics::RaylibGraphics::GetMousePosition ( float &  x,
float &  y 
) const
overridevirtual

Get the current mouse cursor position.

Parameters
xReference to store the X coordinate
yReference to store the Y coordinate

Implements Graphics::IGraphics.

Definition at line 329 of file RaylibGraphics.cpp.

References GetMousePosition().

Referenced by GetMousePosition().

Here is the call graph for this function:

◆ GetMouseX()

int Graphics::RaylibGraphics::GetMouseX ( ) const
overridevirtual

Get the current X position of the mouse cursor.

Returns
X coordinate in pixels

Implements Graphics::IGraphics.

Definition at line 342 of file RaylibGraphics.cpp.

◆ GetMouseY()

int Graphics::RaylibGraphics::GetMouseY ( ) const
overridevirtual

Get the current Y position of the mouse cursor.

Returns
Y coordinate in pixels

Implements Graphics::IGraphics.

Definition at line 346 of file RaylibGraphics.cpp.

◆ GetScreenHeight()

int Graphics::RaylibGraphics::GetScreenHeight ( ) const
overridevirtual

Get the screen height (same as window height)

Returns
Height in pixels

Implements Graphics::IGraphics.

Definition at line 358 of file RaylibGraphics.cpp.

Referenced by BeginColorblindCapture(), EndColorblindCapture(), and LoadColorblindShader().

◆ GetScreenWidth()

int Graphics::RaylibGraphics::GetScreenWidth ( ) const
overridevirtual

Get the screen width (same as window width)

Returns
Width in pixels

Implements Graphics::IGraphics.

Definition at line 354 of file RaylibGraphics.cpp.

Referenced by BeginColorblindCapture(), EndColorblindCapture(), and LoadColorblindShader().

◆ GetTextureSize()

bool Graphics::RaylibGraphics::GetTextureSize ( const char *  textureName,
int &  width,
int &  height 
) const
overridevirtual

Get the dimensions of a loaded texture.

Parameters
textureNameName of the texture
widthReference to store the width
heightReference to store the height
Returns
true if texture exists and dimensions were retrieved, false otherwise

Implements Graphics::IGraphics.

Definition at line 262 of file RaylibGraphics.cpp.

References _textures.

Referenced by EntityRenderer::setBackground().

◆ GetTime()

float Graphics::RaylibGraphics::GetTime ( ) const
overridevirtual

Get elapsed time since initialization.

Returns
Time in seconds since graphics system was initialized

Implements Graphics::IGraphics.

Definition at line 106 of file RaylibGraphics.cpp.

◆ GetWindowHeight()

int Graphics::RaylibGraphics::GetWindowHeight ( ) const
overridevirtual

Get current window height in pixels.

Returns
Height in pixels.

Implements Graphics::IGraphics.

Definition at line 67 of file RaylibGraphics.cpp.

Referenced by EntityRenderer::renderBackground().

◆ GetWindowWidth()

int Graphics::RaylibGraphics::GetWindowWidth ( ) const
overridevirtual

Get current window width in pixels.

Returns
Width in pixels.

Implements Graphics::IGraphics.

Definition at line 63 of file RaylibGraphics.cpp.

Referenced by EntityRenderer::renderBackground(), and Rendering::RenderHUD().

◆ InitAudioDevice()

void Graphics::RaylibGraphics::InitAudioDevice ( )
overridevirtual

Initialize the audio device.

Note
Must be called before any audio operations

Implements Graphics::IGraphics.

Definition at line 485 of file RaylibGraphics.cpp.

References _audioInitialized, and InitAudioDevice().

Referenced by InitAudioDevice().

Here is the call graph for this function:

◆ InitWindow()

void Graphics::RaylibGraphics::InitWindow ( int  width,
int  height,
const char *  title 
)
overridevirtual

Initialize the graphics window.

Parameters
widthWidth of the window in pixels
heightHeight of the window in pixels
titleTitle displayed on the window

Implements Graphics::IGraphics.

Definition at line 31 of file RaylibGraphics.cpp.

References _windowInitialized, InitWindow(), SetWindowSize(), and SetWindowTitle().

Referenced by Rendering::Initialize(), and InitWindow().

Here is the call graph for this function:

◆ IsAudioDeviceReady()

bool Graphics::RaylibGraphics::IsAudioDeviceReady ( ) const
overridevirtual

Check if audio device is ready.

Returns
true if audio device is initialized

Implements Graphics::IGraphics.

Definition at line 503 of file RaylibGraphics.cpp.

References _audioInitialized, and IsAudioDeviceReady().

Referenced by IsAudioDeviceReady().

Here is the call graph for this function:

◆ IsGamepadAvailable()

bool Graphics::RaylibGraphics::IsGamepadAvailable ( int  gamepad) const
overridevirtual

Check if a gamepad is available/connected.

Parameters
gamepadGamepad index (0-3, typically 0 for first controller)
Returns
true if the gamepad is connected, false otherwise

Implements Graphics::IGraphics.

Definition at line 305 of file RaylibGraphics.cpp.

Referenced by Rendering::IsGamepadAvailable().

◆ IsGamepadButtonDown()

bool Graphics::RaylibGraphics::IsGamepadButtonDown ( int  gamepad,
int  button 
) const
overridevirtual

Check if a gamepad button is currently held down.

Parameters
gamepadGamepad index (0-3)
buttonButton code (use GAMEPAD_BUTTON_* constants)
Returns
true if the button is currently down, false otherwise

Implements Graphics::IGraphics.

Definition at line 313 of file RaylibGraphics.cpp.

Referenced by Rendering::IsGamepadButtonDown().

◆ IsGamepadButtonPressed()

bool Graphics::RaylibGraphics::IsGamepadButtonPressed ( int  gamepad,
int  button 
) const
overridevirtual

Check if a gamepad button was pressed this frame.

Parameters
gamepadGamepad index (0-3)
buttonButton code (use GAMEPAD_BUTTON_* constants)
Returns
true if the button was just pressed, false otherwise

Implements Graphics::IGraphics.

Definition at line 309 of file RaylibGraphics.cpp.

◆ IsKeyDown()

bool Graphics::RaylibGraphics::IsKeyDown ( int  key) const
overridevirtual

Check if a key is currently being held down.

Parameters
keyKey code to check (implementation-specific key constants)
Returns
true if the key is currently down, false otherwise

Implements Graphics::IGraphics.

Definition at line 297 of file RaylibGraphics.cpp.

Referenced by Rendering::IsKeyDown().

◆ IsKeyPressed()

bool Graphics::RaylibGraphics::IsKeyPressed ( int  key) const
overridevirtual

Check if a key was pressed (triggered once when key goes down)

Parameters
keyKey code to check (implementation-specific key constants)
Returns
true if the key was just pressed, false otherwise

Implements Graphics::IGraphics.

Definition at line 293 of file RaylibGraphics.cpp.

Referenced by Rendering::HandleEscapeKeyInput().

◆ IsKeyReleased()

bool Graphics::RaylibGraphics::IsKeyReleased ( int  key) const
overridevirtual

Check if a key was released (triggered once when key goes up)

Parameters
keyKey code to check (implementation-specific key constants)
Returns
true if the key was just released, false otherwise

Implements Graphics::IGraphics.

Definition at line 301 of file RaylibGraphics.cpp.

◆ IsMouseButtonDown()

bool Graphics::RaylibGraphics::IsMouseButtonDown ( int  button) const
overridevirtual

Check if a mouse button is currently being held down.

Parameters
buttonMouse button code (implementation-specific button constants)
Returns
true if the button is currently down, false otherwise

Implements Graphics::IGraphics.

Definition at line 325 of file RaylibGraphics.cpp.

◆ IsMouseButtonPressed()

bool Graphics::RaylibGraphics::IsMouseButtonPressed ( int  button) const
overridevirtual

Check if a mouse button was pressed (triggered once when button goes down)

Parameters
buttonMouse button code (implementation-specific button constants)
Returns
true if the button was just pressed, false otherwise

Implements Graphics::IGraphics.

Definition at line 321 of file RaylibGraphics.cpp.

◆ IsSoundPlaying()

bool Graphics::RaylibGraphics::IsSoundPlaying ( const char *  soundName) const
overridevirtual

Check if a sound is currently playing.

Parameters
soundNameName of the sound to check
Returns
true if the sound is playing

Implements Graphics::IGraphics.

Definition at line 541 of file RaylibGraphics.cpp.

References _sounds.

◆ IsWindowOpen()

bool Graphics::RaylibGraphics::IsWindowOpen ( ) const
overridevirtual

Check if the window is still open.

Returns
true if the window should remain open, false if close was requested

Implements Graphics::IGraphics.

Definition at line 59 of file RaylibGraphics.cpp.

References _windowInitialized, and WindowShouldClose().

Referenced by Rendering::IsWindowOpen().

Here is the call graph for this function:

◆ LoadColorblindShader()

void Graphics::RaylibGraphics::LoadColorblindShader ( )
private

Definition at line 391 of file RaylibGraphics.cpp.

References _colorblindRenderTexture, _colorblindShader, _colorblindShaderLoaded, _filterTypeLoc, GetScreenHeight(), and GetScreenWidth().

Referenced by SetColorblindFilter().

Here is the call graph for this function:

◆ LoadFont()

int Graphics::RaylibGraphics::LoadFont ( const char *  filepath,
int  size 
)
overridevirtual

Load a font from file.

Parameters
filepathPath to the font file (e.g., .ttf, .otf)
sizeFont size to load
Returns
Font handle (integer ID) for use in drawing operations

Implements Graphics::IGraphics.

Definition at line 151 of file RaylibGraphics.cpp.

References _fonts.

◆ LoadSound()

bool Graphics::RaylibGraphics::LoadSound ( const char *  soundName,
const char *  filepath 
)
overridevirtual

Load a sound from file.

Parameters
soundNameUnique name to identify the sound
filepathPath to the sound file (e.g., .wav, .mp3, .ogg)
Returns
true if sound was loaded successfully, false otherwise

Implements Graphics::IGraphics.

Definition at line 507 of file RaylibGraphics.cpp.

References _audioInitialized, _sounds, and LoadSound().

Referenced by LoadSound().

Here is the call graph for this function:

◆ LoadTexture()

int Graphics::RaylibGraphics::LoadTexture ( const char *  textureName,
const char *  filepath 
)
overridevirtual

Load a texture from an image file.

Parameters
filepathPath to the image file (e.g., .png, .jpg)
Returns
Texture handle (integer ID) for use in drawing operations

Implements Graphics::IGraphics.

Definition at line 188 of file RaylibGraphics.cpp.

References _textures, and LoadTexture().

Referenced by LoadTexture(), Rendering::LoadTexture(), and EntityRenderer::setBackground().

Here is the call graph for this function:

◆ PlaySound()

void Graphics::RaylibGraphics::PlaySound ( const char *  soundName)
overridevirtual

Play a loaded sound.

Parameters
soundNameName of the sound to play

Implements Graphics::IGraphics.

Definition at line 527 of file RaylibGraphics.cpp.

References _sounds, and PlaySound().

Referenced by PlaySound().

Here is the call graph for this function:

◆ SetClearColor()

void Graphics::RaylibGraphics::SetClearColor ( unsigned int  color)
overridevirtual

Set the background clear color.

Parameters
colorColor in 0xAARRGGBB format (Alpha, Red, Green, Blue)

Implements Graphics::IGraphics.

Definition at line 94 of file RaylibGraphics.cpp.

References _clearColor.

◆ SetColorblindFilter()

void Graphics::RaylibGraphics::SetColorblindFilter ( ColorblindFilterType  filter)
overridevirtual

Set the colorblind filter type.

Parameters
filterThe type of colorblind filter to apply

Implements Graphics::IGraphics.

Definition at line 425 of file RaylibGraphics.cpp.

References _colorblindFilter, _colorblindShaderLoaded, LoadColorblindShader(), and Graphics::NONE.

Referenced by Rendering::InitializeAccessibilityMenu(), and Rendering::LoadAccessibilitySettings().

Here is the call graph for this function:

◆ SetSoundVolume()

void Graphics::RaylibGraphics::SetSoundVolume ( const char *  soundName,
float  volume 
)
overridevirtual

Set volume for a specific sound.

Parameters
soundNameName of the sound
volumeVolume level (0.0 to 1.0)

Implements Graphics::IGraphics.

Definition at line 534 of file RaylibGraphics.cpp.

References _sounds, and SetSoundVolume().

Referenced by SetSoundVolume().

Here is the call graph for this function:

◆ SetTargetFPS()

void Graphics::RaylibGraphics::SetTargetFPS ( int  fps)
overridevirtual

Set the target frames per second for rendering.

Parameters
fpsTarget frame rate (e.g., 60 for 60 FPS)

Implements Graphics::IGraphics.

Definition at line 90 of file RaylibGraphics.cpp.

References SetTargetFPS().

Referenced by Rendering::ApplyInitialMenuSettings(), Rendering::InitializeSettingsMenu(), and SetTargetFPS().

Here is the call graph for this function:

◆ SetWindowSize()

void Graphics::RaylibGraphics::SetWindowSize ( int  width,
int  height 
)
overridevirtual

Resize the window.

Parameters
widthNew width in pixels
heightNew height in pixels

Implements Graphics::IGraphics.

Definition at line 82 of file RaylibGraphics.cpp.

References SetWindowSize().

Referenced by InitWindow(), and SetWindowSize().

Here is the call graph for this function:

◆ SetWindowTitle()

void Graphics::RaylibGraphics::SetWindowTitle ( const char *  title)
overridevirtual

Change the window title.

Parameters
titleNew title for the window

Implements Graphics::IGraphics.

Definition at line 78 of file RaylibGraphics.cpp.

References SetWindowTitle().

Referenced by InitWindow(), and SetWindowTitle().

Here is the call graph for this function:

◆ StartDrawing()

void Graphics::RaylibGraphics::StartDrawing ( )
overridevirtual

Begin drawing frame (setup canvas for drawing operations)

Implements Graphics::IGraphics.

Definition at line 51 of file RaylibGraphics.cpp.

Referenced by Rendering::Render().

◆ TakeScreenshot()

void Graphics::RaylibGraphics::TakeScreenshot ( const char *  filepath)
overridevirtual

Capture the current screen and save it to a file.

Parameters
filepathPath where the screenshot will be saved

Implements Graphics::IGraphics.

Definition at line 101 of file RaylibGraphics.cpp.

References TakeScreenshot().

Referenced by TakeScreenshot().

Here is the call graph for this function:

◆ ToggleFullScreen()

void Graphics::RaylibGraphics::ToggleFullScreen ( )
overridevirtual

Toggle between fullscreen and windowed mode.

Implements Graphics::IGraphics.

Definition at line 86 of file RaylibGraphics.cpp.

◆ UnloadColorblindShader()

void Graphics::RaylibGraphics::UnloadColorblindShader ( )
private

Definition at line 415 of file RaylibGraphics.cpp.

References _colorblindRenderTexture, _colorblindShader, and _colorblindShaderLoaded.

Referenced by ~RaylibGraphics().

◆ UnloadFont()

void Graphics::RaylibGraphics::UnloadFont ( int  fontHandle)
overridevirtual

Unload a previously loaded font.

Parameters
fontHandleFont handle returned by LoadFont()

Implements Graphics::IGraphics.

Definition at line 159 of file RaylibGraphics.cpp.

References _fonts, and UnloadFont().

Referenced by UnloadFont(), and ~RaylibGraphics().

Here is the call graph for this function:

◆ UnloadSound()

void Graphics::RaylibGraphics::UnloadSound ( const char *  soundName)
overridevirtual

Unload a previously loaded sound.

Parameters
soundNameName of the sound to unload

Implements Graphics::IGraphics.

Definition at line 519 of file RaylibGraphics.cpp.

References _sounds, and UnloadSound().

Referenced by CloseAudioDevice(), UnloadSound(), and ~RaylibGraphics().

Here is the call graph for this function:

◆ UnloadTexture()

void Graphics::RaylibGraphics::UnloadTexture ( const char *  textureName)
overridevirtual

Unload a previously loaded texture.

Parameters
textureNameName of the texture to unload

Implements Graphics::IGraphics.

Definition at line 218 of file RaylibGraphics.cpp.

References _textures, and UnloadTexture().

Referenced by EntityRenderer::clearBackground(), UnloadTexture(), and ~RaylibGraphics().

Here is the call graph for this function:

◆ UpdateTexture()

void Graphics::RaylibGraphics::UpdateTexture ( const char *  textureName,
const void *  pixels 
)
overridevirtual

Update an existing texture with new pixel data.

Parameters
textureNameName of the texture to update
pixelsPointer to new pixel data

Implements Graphics::IGraphics.

Definition at line 211 of file RaylibGraphics.cpp.

References _textures, and UpdateTexture().

Referenced by UpdateTexture().

Here is the call graph for this function:

◆ WindowShouldClose()

bool Graphics::RaylibGraphics::WindowShouldClose ( ) const
overridevirtual

Check if the window should close.

Returns
true if the window should close, false otherwise

Implements Graphics::IGraphics.

Definition at line 335 of file RaylibGraphics.cpp.

References _windowInitialized.

Referenced by CloseWindow(), IsWindowOpen(), Rendering::Render(), and Rendering::WindowShouldClose().

Member Data Documentation

◆ _audioInitialized

bool Graphics::RaylibGraphics::_audioInitialized = false
private

◆ _clearColor

Color Graphics::RaylibGraphics::_clearColor {255, 255, 255, 255}
private

Definition at line 122 of file RaylibGraphics.hpp.

Referenced by BeginColorblindCapture(), ClearWindow(), and SetClearColor().

◆ _colorblindFilter

ColorblindFilterType Graphics::RaylibGraphics::_colorblindFilter {ColorblindFilterType::NONE}
private

◆ _colorblindRenderTexture

RenderTexture2D Graphics::RaylibGraphics::_colorblindRenderTexture {}
private

◆ _colorblindShader

Shader Graphics::RaylibGraphics::_colorblindShader {}
private

◆ _colorblindShaderLoaded

bool Graphics::RaylibGraphics::_colorblindShaderLoaded {false}
private

◆ _filterTypeLoc

int Graphics::RaylibGraphics::_filterTypeLoc {-1}
private

Definition at line 130 of file RaylibGraphics.hpp.

Referenced by EndColorblindCapture(), and LoadColorblindShader().

◆ _fonts

std::vector<Font> Graphics::RaylibGraphics::_fonts
private

Definition at line 119 of file RaylibGraphics.hpp.

Referenced by DrawText(), GetFontHeight(), LoadFont(), UnloadFont(), and ~RaylibGraphics().

◆ _sounds

std::unordered_map<std::string, Sound> Graphics::RaylibGraphics::_sounds
private

◆ _textures

std::unordered_map<std::string, Texture2D> Graphics::RaylibGraphics::_textures
private

◆ _windowInitialized

bool Graphics::RaylibGraphics::_windowInitialized = false
private

Definition at line 123 of file RaylibGraphics.hpp.

Referenced by CloseWindow(), InitWindow(), IsWindowOpen(), and WindowShouldClose().


The documentation for this class was generated from the following files: