|
R-Type
Distributed multiplayer game engine in C++
|
Abstract interface for graphics rendering operations. More...
#include <IGraphics.hpp>


Public Member Functions | |
| virtual | ~IGraphics ()=default |
| Virtual destructor. | |
| virtual void | InitWindow (int width, int height, const char *title)=0 |
| Initialize the graphics window. | |
| virtual void | ClearWindow ()=0 |
| Clear the window with the current clear color. | |
| virtual void | StartDrawing ()=0 |
| Begin drawing frame (setup canvas for drawing operations) | |
| virtual void | DisplayWindow ()=0 |
| Display the current frame to the window (end drawing and swap buffers) | |
| virtual bool | IsWindowOpen () const =0 |
| Check if the window is still open. | |
| virtual void | CloseWindow ()=0 |
| Close the graphics window and cleanup resources. | |
| virtual int | GetWindowWidth () const =0 |
| Get current window width in pixels. | |
| virtual int | GetWindowHeight () const =0 |
| Get current window height in pixels. | |
| virtual void | SetWindowTitle (const char *title)=0 |
| Change the window title. | |
| virtual void | SetWindowSize (int width, int height)=0 |
| Resize the window. | |
| virtual void | ToggleFullScreen ()=0 |
| Toggle between fullscreen and windowed mode. | |
| virtual void | SetTargetFPS (int fps)=0 |
| Set the target frames per second for rendering. | |
| virtual void | SetClearColor (unsigned int color)=0 |
| Set the background clear color. | |
| virtual void | TakeScreenshot (const char *filepath)=0 |
| Capture the current screen and save it to a file. | |
| virtual float | GetTime () const =0 |
| Get elapsed time since initialization. | |
| virtual float | GetDeltaTime () const =0 |
| Get the time elapsed for the last frame. | |
| virtual void | DrawRect (int x, int y, int width, int height, unsigned int color)=0 |
| Draw a rectangle outline. | |
| virtual void | DrawRectFilled (int x, int y, int width, int height, unsigned int color)=0 |
| Draw a filled rectangle. | |
| virtual void | DrawCircle (int x, int y, int radius, unsigned int color)=0 |
| Draw a circle outline. | |
| virtual void | DrawCircleFilled (int x, int y, int radius, unsigned int color)=0 |
| Draw a filled circle. | |
| virtual int | LoadFont (const char *filepath, int size)=0 |
| Load a font from file. | |
| virtual void | UnloadFont (int fontHandle)=0 |
| Unload a previously loaded font. | |
| virtual void | DrawText (int fontHandle, const char *text, int x, int y, int fontSize, unsigned int color)=0 |
| Draw text using a loaded font. | |
| virtual int | GetFontHeight (int fontHandle, int fontSize)=0 |
| Get the height of a font at a given size. | |
| virtual int | LoadTexture (const char *textureName, const char *filepath)=0 |
| Load a texture from an image file. | |
| virtual int | CreateTextureFromMemory (const char *textureName, const void *pixels, int width, int height, int format)=0 |
| Create a texture from raw pixel data in memory. | |
| virtual void | UpdateTexture (const char *textureName, const void *pixels)=0 |
| Update an existing texture with new pixel data. | |
| virtual void | UnloadTexture (const char *textureName)=0 |
| Unload a previously loaded texture. | |
| virtual void | DrawTexture (const char *textureName, int x, int y, unsigned int tint)=0 |
| Draw a texture at the specified position. | |
| virtual void | DrawTextureEx (const char *textureName, int srcX, int srcY, int srcW, int srcH, float destX, float destY, float rotation, float scale, unsigned int tint)=0 |
| Draw a texture with advanced parameters (rotation, scale, source rectangle) | |
| virtual bool | GetTextureSize (const char *textureName, int &width, int &height) const =0 |
| Get the dimensions of a loaded texture. | |
| virtual void | DrawTexturePro (const char *textureName, int srcX, int srcY, int srcW, int srcH, float destX, float destY, float destW, float destH, unsigned int tint)=0 |
| Draw a texture with separate width/height scaling (for non-uniform scaling) | |
| virtual bool | IsKeyPressed (int key) const =0 |
| Check if a key was pressed (triggered once when key goes down) | |
| virtual bool | IsKeyDown (int key) const =0 |
| Check if a key is currently being held down. | |
| virtual bool | IsKeyReleased (int key) const =0 |
| Check if a key was released (triggered once when key goes up) | |
| virtual bool | IsGamepadAvailable (int gamepad) const =0 |
| Check if a gamepad is available/connected. | |
| virtual bool | IsGamepadButtonPressed (int gamepad, int button) const =0 |
| Check if a gamepad button was pressed this frame. | |
| virtual bool | IsGamepadButtonDown (int gamepad, int button) const =0 |
| Check if a gamepad button is currently held down. | |
| virtual float | GetGamepadAxisMovement (int gamepad, int axis) const =0 |
| Get gamepad axis value (for analog sticks and triggers) | |
| virtual bool | IsMouseButtonPressed (int button) const =0 |
| Check if a mouse button was pressed (triggered once when button goes down) | |
| virtual bool | IsMouseButtonDown (int button) const =0 |
| Check if a mouse button is currently being held down. | |
| virtual void | GetMousePosition (float &x, float &y) const =0 |
| Get the current mouse cursor position. | |
| virtual bool | WindowShouldClose () const =0 |
| Check if the window should close. | |
| virtual int | GetMouseX () const =0 |
| Get the current X position of the mouse cursor. | |
| virtual int | GetMouseY () const =0 |
| Get the current Y position of the mouse cursor. | |
| virtual int | GetCharPressed () const =0 |
| Get the next character from the keyboard input queue. | |
| virtual int | GetScreenWidth () const =0 |
| Get the screen width (same as window width) | |
| virtual int | GetScreenHeight () const =0 |
| Get the screen height (same as window height) | |
| virtual void | DrawRectangle (int x, int y, int width, int height, unsigned int color)=0 |
| Draw a filled rectangle (alias for DrawRectFilled) | |
| virtual void | DrawRectangleLines (int x, int y, int width, int height, unsigned int color)=0 |
| Draw a rectangle outline (alias for DrawRect) | |
| virtual void | DrawText (const char *text, int x, int y, int fontSize, unsigned int color)=0 |
| Draw text using default font (simplified version) | |
| virtual void | SetColorblindFilter (ColorblindFilterType filter)=0 |
| Set the colorblind filter type. | |
| virtual ColorblindFilterType | GetColorblindFilter () const =0 |
| Get the current colorblind filter type. | |
| virtual void | BeginColorblindCapture ()=0 |
| Begin capturing frame for colorblind filter processing. | |
| virtual void | EndColorblindCapture ()=0 |
| End capturing and apply the colorblind filter. | |
| virtual void | InitAudioDevice ()=0 |
| Initialize the audio device. | |
| virtual void | CloseAudioDevice ()=0 |
| Close the audio device and cleanup audio resources. | |
| virtual bool | IsAudioDeviceReady () const =0 |
| Check if audio device is ready. | |
| virtual bool | LoadSound (const char *soundName, const char *filepath)=0 |
| Load a sound from file. | |
| virtual void | UnloadSound (const char *soundName)=0 |
| Unload a previously loaded sound. | |
| virtual void | PlaySound (const char *soundName)=0 |
| Play a loaded sound. | |
| virtual void | SetSoundVolume (const char *soundName, float volume)=0 |
| Set volume for a specific sound. | |
| virtual bool | IsSoundPlaying (const char *soundName) const =0 |
| Check if a sound is currently playing. | |
Abstract interface for graphics rendering operations.
This interface provides a platform-agnostic API for window management, rendering primitives, texture handling, font rendering, and input processing. Implementations should provide concrete backends (e.g., Raylib, SDL, SFML).
Definition at line 32 of file IGraphics.hpp.
|
virtualdefault |
Virtual destructor.
|
pure virtual |
Begin capturing frame for colorblind filter processing.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Clear the window with the current clear color.
Implemented in Graphics::RaylibGraphics.
Referenced by Game::LoginMenu::Render().
|
pure virtual |
Close the audio device and cleanup audio resources.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Close the graphics window and cleanup resources.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Create a texture from raw pixel data in memory.
| pixels | Pointer to raw pixel data |
| width | Width of the texture in pixels |
| height | Height of the texture in pixels |
| format | Pixel format (implementation-specific) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Display the current frame to the window (end drawing and swap buffers)
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Draw a circle outline.
| x | X coordinate of the circle center |
| y | Y coordinate of the circle center |
| radius | Radius of the circle in pixels |
| color | Color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibSlider::Render().
|
pure virtual |
Draw a filled circle.
| x | X coordinate of the circle center |
| y | Y coordinate of the circle center |
| radius | Radius of the circle in pixels |
| color | Color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibSlider::Render().
|
pure virtual |
Draw a rectangle outline.
| x | X coordinate of the top-left corner |
| y | Y coordinate of the top-left corner |
| width | Width of the rectangle |
| height | Height of the rectangle |
| color | Color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
Referenced by Game::WaitingRoomMenu::Render(), and UI::RaylibButton::Render().
|
pure virtual |
Draw a filled rectangle (alias for DrawRectFilled)
| x | X coordinate of the top-left corner |
| y | Y coordinate of the top-left corner |
| width | Width of the rectangle |
| height | Height of the rectangle |
| color | Color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
Referenced by Game::ChatWidget::Render(), UI::RaylibSlider::Render(), and UI::RaylibTextInput::Render().
|
pure virtual |
Draw a rectangle outline (alias for DrawRect)
| x | X coordinate of the top-left corner |
| y | Y coordinate of the top-left corner |
| width | Width of the rectangle |
| height | Height of the rectangle |
| color | Color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
Referenced by Game::ChatWidget::Render(), and UI::RaylibTextInput::Render().
|
pure virtual |
Draw a filled rectangle.
| x | X coordinate of the top-left corner |
| y | Y coordinate of the top-left corner |
| width | Width of the rectangle |
| height | Height of the rectangle |
| color | Color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
Referenced by Game::LoginMenu::Render(), Game::WaitingRoomMenu::Render(), and UI::RaylibButton::Render().
|
pure virtual |
Draw text using default font (simplified version)
| text | Text string to render |
| x | X coordinate for text position |
| y | Y coordinate for text position |
| fontSize | Size of the rendered text |
| color | Text color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Draw text using a loaded font.
| fontHandle | Font handle (or -1 for default font) |
| text | Text string to render |
| x | X coordinate for text position |
| y | Y coordinate for text position |
| fontSize | Size of the rendered text |
| color | Text color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
Referenced by Game::ChatWidget::Render(), Game::AccessibilityMenu::Render(), Game::AddServerMenu::Render(), Game::ConnectionMenu::Render(), Game::CreateRoomMenu::Render(), Game::LoginMenu::Render(), Game::RoomListMenu::Render(), Game::ServerListMenu::Render(), Game::SettingsMenu::Render(), Game::WaitingRoomMenu::Render(), UI::RaylibButton::Render(), and UI::RaylibTextInput::Render().
|
pure virtual |
Draw a texture at the specified position.
| textureName | Name of the texture to draw |
| x | X coordinate for drawing position |
| y | Y coordinate for drawing position |
| tint | Tint color in 0xAARRGGBB format (0xFFFFFFFF for no tint) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Draw a texture with advanced parameters (rotation, scale, source rectangle)
| textureName | Name of the texture to draw |
| srcX | X coordinate of source rectangle in texture |
| srcY | Y coordinate of source rectangle in texture |
| srcW | Width of source rectangle |
| srcH | Height of source rectangle |
| destX | X coordinate of destination position |
| destY | Y coordinate of destination position |
| rotation | Rotation angle in degrees |
| scale | Scale factor (1.0 = original size) |
| tint | Tint color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Draw a texture with separate width/height scaling (for non-uniform scaling)
| textureName | Name of the texture to draw |
| srcX | X coordinate of source rectangle in texture |
| srcY | Y coordinate of source rectangle in texture |
| srcW | Width of source rectangle |
| srcH | Height of source rectangle |
| destX | X coordinate of destination position |
| destY | Y coordinate of destination position |
| destW | Width of destination rectangle |
| destH | Height of destination rectangle |
| tint | Tint color in 0xAARRGGBB format |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
End capturing and apply the colorblind filter.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Get the next character from the keyboard input queue.
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibTextInput::HandleCharacterInput().
|
pure virtual |
Get the current colorblind filter type.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Get the time elapsed for the last frame.
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibTextInput::HandleBackspace(), and UI::RaylibTextInput::UpdateCursorBlink().
|
pure virtual |
Get the height of a font at a given size.
| fontHandle | Font handle returned by LoadFont() |
| fontSize | Size to query |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibButton::Render().
|
pure virtual |
Get gamepad axis value (for analog sticks and triggers)
| gamepad | Gamepad index (0-3) |
| axis | Axis code (use GAMEPAD_AXIS_* constants) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Get the current mouse cursor position.
| x | Reference to store the X coordinate |
| y | Reference to store the Y coordinate |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibButton::IsMouseOver().
|
pure virtual |
Get the current X position of the mouse cursor.
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibTextInput::IsMouseOver(), UI::RaylibSlider::IsMouseOverHandle(), UI::RaylibSlider::IsMouseOverTrack(), and UI::RaylibSlider::UpdateValueFromMouse().
|
pure virtual |
Get the current Y position of the mouse cursor.
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibTextInput::IsMouseOver(), UI::RaylibSlider::IsMouseOverHandle(), and UI::RaylibSlider::IsMouseOverTrack().
|
pure virtual |
Get the screen height (same as window height)
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibSlider::ApplyAlignment(), UI::RaylibTextInput::ApplyAlignment(), Game::LoginMenu::Initialize(), Game::RoomListMenu::Initialize(), Game::ServerListMenu::Initialize(), Game::WaitingRoomMenu::Initialize(), and Game::LoginMenu::Render().
|
pure virtual |
Get the screen width (same as window width)
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibSlider::ApplyAlignment(), UI::RaylibTextInput::ApplyAlignment(), Game::CreateRoomMenu::Initialize(), Game::WaitingRoomMenu::Initialize(), Game::AccessibilityMenu::Render(), Game::AddServerMenu::Render(), Game::ConnectionMenu::Render(), Game::CreateRoomMenu::Render(), Game::LoginMenu::Render(), Game::RoomListMenu::Render(), Game::ServerListMenu::Render(), Game::SettingsMenu::Render(), and Game::WaitingRoomMenu::Render().
|
pure virtual |
Get the dimensions of a loaded texture.
| textureName | Name of the texture |
| width | Reference to store the width |
| height | Reference to store the height |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Get elapsed time since initialization.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Get current window height in pixels.
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibButton::ApplyAlignment(), and Game::KeyBindingsMenu::Initialize().
|
pure virtual |
Get current window width in pixels.
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibButton::ApplyAlignment().
|
pure virtual |
Initialize the audio device.
Implemented in Graphics::RaylibGraphics.
Referenced by Audio::SoundEffectManager::Initialize().
|
pure virtual |
Initialize the graphics window.
| width | Width of the window in pixels |
| height | Height of the window in pixels |
| title | Title displayed on the window |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Check if audio device is ready.
Implemented in Graphics::RaylibGraphics.
Referenced by Audio::SoundEffectManager::Initialize().
|
pure virtual |
Check if a gamepad is available/connected.
| gamepad | Gamepad index (0-3, typically 0 for first controller) |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibMenu::HandleKeyboardNavigation().
|
pure virtual |
Check if a gamepad button is currently held down.
| gamepad | Gamepad index (0-3) |
| button | Button code (use GAMEPAD_BUTTON_* constants) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Check if a gamepad button was pressed this frame.
| gamepad | Gamepad index (0-3) |
| button | Button code (use GAMEPAD_BUTTON_* constants) |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibMenu::HandleKeyboardNavigation().
|
pure virtual |
Check if a key is currently being held down.
| key | Key code to check (implementation-specific key constants) |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibTextInput::HandleBackspace(), UI::RaylibMenu::HandleKeyboardNavigation(), and UI::RaylibTextInput::HandlePaste().
|
pure virtual |
Check if a key was pressed (triggered once when key goes down)
| key | Key code to check (implementation-specific key constants) |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibTextInput::HandleBackspace(), UI::RaylibMenu::HandleKeyboardNavigation(), UI::RaylibTextInput::HandlePaste(), Game::LoginMenu::HandleTabNavigation(), and Game::LoginMenu::Update().
|
pure virtual |
Check if a key was released (triggered once when key goes up)
| key | Key code to check (implementation-specific key constants) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Check if a mouse button is currently being held down.
| button | Mouse button code (implementation-specific button constants) |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibButton::Update(), and UI::RaylibSlider::Update().
|
pure virtual |
Check if a mouse button was pressed (triggered once when button goes down)
| button | Mouse button code (implementation-specific button constants) |
Implemented in Graphics::RaylibGraphics.
Referenced by UI::RaylibTextInput::HandleFocusClick(), and UI::RaylibSlider::Update().
|
pure virtual |
Check if a sound is currently playing.
| soundName | Name of the sound to check |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Check if the window is still open.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Load a font from file.
| filepath | Path to the font file (e.g., .ttf, .otf) |
| size | Font size to load |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Load a sound from file.
| soundName | Unique name to identify the sound |
| filepath | Path to the sound file (e.g., .wav, .mp3, .ogg) |
Implemented in Graphics::RaylibGraphics.
Referenced by Audio::SoundEffectManager::LoadSounds().
|
pure virtual |
Load a texture from an image file.
| filepath | Path to the image file (e.g., .png, .jpg) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Play a loaded sound.
| soundName | Name of the sound to play |
Implemented in Graphics::RaylibGraphics.
Referenced by Audio::SoundEffectManager::PlayClickSound(), Audio::SoundEffectManager::PlayMainMenuOpenSound(), and Audio::SoundEffectManager::PlayRoomMenuOpenSound().
|
pure virtual |
Set the background clear color.
| color | Color in 0xAARRGGBB format (Alpha, Red, Green, Blue) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Set the colorblind filter type.
| filter | The type of colorblind filter to apply |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Set volume for a specific sound.
| soundName | Name of the sound |
| volume | Volume level (0.0 to 1.0) |
Implemented in Graphics::RaylibGraphics.
Referenced by Audio::SoundEffectManager::ApplyVolumeToAllSounds().
|
pure virtual |
Set the target frames per second for rendering.
| fps | Target frame rate (e.g., 60 for 60 FPS) |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Resize the window.
| width | New width in pixels |
| height | New height in pixels |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Change the window title.
| title | New title for the window |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Begin drawing frame (setup canvas for drawing operations)
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Capture the current screen and save it to a file.
| filepath | Path where the screenshot will be saved |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Toggle between fullscreen and windowed mode.
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Unload a previously loaded font.
| fontHandle | Font handle returned by LoadFont() |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Unload a previously loaded sound.
| soundName | Name of the sound to unload |
Implemented in Graphics::RaylibGraphics.
Referenced by Audio::SoundEffectManager::~SoundEffectManager().
|
pure virtual |
Unload a previously loaded texture.
| textureName | Name of the texture to unload |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Update an existing texture with new pixel data.
| textureName | Name of the texture to update |
| pixels | Pointer to new pixel data |
Implemented in Graphics::RaylibGraphics.
|
pure virtual |
Check if the window should close.
Implemented in Graphics::RaylibGraphics.