![]() |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
Window and Graphics Device Functions. More...
#include <Window.hpp>
Public Member Functions | |
| Window ()=default | |
| Build a Window object, but defer the initialization. More... | |
| Window (int width, int height, const std::string_view title="raylib", unsigned int flags=0) | |
| Initialize window and OpenGL context. More... | |
| ~Window () | |
| Close window and unload OpenGL context. More... | |
| Window & | BeginDrawing () |
| Setup canvas (framebuffer) to start drawing. More... | |
| Window & | ClearBackground (const ::Color &color=BLACK) |
| Clear window with given color. More... | |
| Window & | ClearState (unsigned int flag) |
| Clear window configuration state flags. More... | |
| bool | Drawing () |
Alternates between calling BeginDrawing() and EndDrawing(). More... | |
| Window & | EndDrawing () |
| End canvas drawing and swap buffers (double buffering) More... | |
| void | Init (int width=800, int height=450, const std::string_view title="raylib", unsigned int flags=0) |
| Initializes the window. More... | |
| Window & | Maximize () |
| Set window state: maximized, if resizable (only PLATFORM_DESKTOP) More... | |
| Window & | Minimize () |
| Set window state: minimized, if resizable (only PLATFORM_DESKTOP) More... | |
| Window & | Restore () |
| Set window state: not minimized/maximized (only PLATFORM_DESKTOP) More... | |
| void | SetClipboardText (const std::string_view text) |
| Set clipboard text content. More... | |
| Window & | SetFocused () |
| Set window focused (only PLATFORM_DESKTOP) More... | |
| Window & | SetFullscreen (bool fullscreen) |
| Set whether or not the application should be fullscreen. More... | |
| Window & | SetIcon (const ::Image &image) |
| Set icon for window. More... | |
| Window & | SetIcons (Image *images, int count) |
| Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) More... | |
| Window & | SetIcons (std::span< Image > images) |
| Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) More... | |
| Window & | SetMinSize (const ::Vector2 &size) |
| Set window minimum dimensions. More... | |
| Window & | SetMinSize (int width, int height) |
| Set window minimum dimensions. More... | |
| Window & | SetMonitor (int monitor) |
| Set monitor for the current window. More... | |
| Window & | SetOpacity (float opacity) |
| Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) More... | |
| Window & | SetPosition (const ::Vector2 &position) |
| Set window position on screen. More... | |
| Window & | SetPosition (int x, int y) |
| Set window position on screen. More... | |
| Window & | SetSize (const ::Vector2 &size) |
| Set window dimensions. More... | |
| Window & | SetSize (int width, int height) |
| Set window dimensions. More... | |
| Window & | SetState (unsigned int flag) |
| Set window configuration state using flags. More... | |
| Window & | SetTargetFPS (int fps) |
| Set target FPS (maximum) More... | |
| Window & | SetTitle (const std::string_view title) |
| Set title for window. More... | |
| Window & | ToggleBorderless () |
| Toggle window state: borderless/windowed. More... | |
| Window & | ToggleFullscreen () |
| Toggle window state: fullscreen/windowed. More... | |
Static Public Member Functions | |
| static void | Close () |
| Close window and unload OpenGL context. More... | |
| static void | DrawFPS (int posX=10, int posY=10) |
| Draw current FPS. More... | |
| static std::string | GetClipboardText () |
| Get clipboard text content. More... | |
| static int | GetFPS () |
| Returns current FPS. More... | |
| static float | GetFrameTime () |
| Returns time in seconds for last frame drawn. More... | |
| static void * | GetHandle () |
| Get native window handle. More... | |
| static int | GetHeight () |
| Get current screen height. More... | |
| static int | GetMonitor () |
| static Vector2 | GetPosition () |
| Get window position XY on monitor. More... | |
| static int | GetRenderHeight () |
| Get current render height (it considers HiDPI) More... | |
| static int | GetRenderWidth () |
| Get current render width (it considers HiDPI) More... | |
| static Vector2 | GetScaleDPI () |
| Get window scale DPI factor. More... | |
| static Vector2 | GetSize () |
| Get the screen's width and height. More... | |
| static double | GetTime () |
| Returns elapsed time in seconds since InitWindow() More... | |
| static int | GetWidth () |
| Get current screen width. More... | |
| static void | HideCursor () |
| Hides cursor. More... | |
| static bool | IsCursorHidden () |
| Check if cursor is not visible. More... | |
| static bool | IsCursorOnScreen () |
| Check if cursor is on the current screen. More... | |
| static bool | IsFocused () |
| Check if window is currently focused. More... | |
| static bool | IsFullscreen () |
| Check if window is currently fullscreen. More... | |
| static bool | IsHidden () |
| Check if window is currently hidden. More... | |
| static bool | IsMaximized () |
| Check if window is currently minimized. More... | |
| static bool | IsMinimized () |
| Check if window is currently minimized. More... | |
| static bool | IsResized () |
| Check if window has been resized last frame. More... | |
| static bool | IsState (unsigned int flag) |
| Check if one specific window flag is enabled. More... | |
| static bool | IsValid () |
| Check if window has been initialized successfully. More... | |
| static void | SetConfigFlags (unsigned int flags) |
| Sets the configuration flags for raylib. More... | |
| static void | SetExitKey (int key) |
| Set a custom key to exit program (default is ESC) More... | |
| static bool | ShouldClose () |
| Check if KEY_ESCAPE pressed or Close icon pressed. More... | |
| static void | ShowCursor () |
| Shows cursor. More... | |
Protected Attributes | |
| bool | m_drawing = false |
Handles the internal drawing state for calling either BeginDrawing() or EndDrawing() from the Drawing() function. More... | |
Window and Graphics Device Functions.
Definition at line 16 of file Window.hpp.
|
default |
|
inline |
Initialize window and OpenGL context.
| width | The width of the window. |
| height | The height of the window. |
| title | The desired title of the window. |
| flags | The ConfigFlags to set prior to initializing the window. See SetConfigFlags for more details. |
| logLevel | The the current threshold (minimum) log level |
| raylib::RaylibException | Thrown if the window failed to initiate. |
Definition at line 39 of file Window.hpp.
References Init().
|
inline |
Close window and unload OpenGL context.
Definition at line 46 of file Window.hpp.
References Close().
|
inline |
Setup canvas (framebuffer) to start drawing.
Definition at line 340 of file Window.hpp.
References BeginDrawing().
Referenced by BeginDrawing(), and Drawing().
|
inline |
Clear window with given color.
Definition at line 164 of file Window.hpp.
References ClearBackground().
Referenced by ClearBackground().
|
inline |
Clear window configuration state flags.
Definition at line 156 of file Window.hpp.
|
inlinestatic |
Close window and unload OpenGL context.
Definition at line 84 of file Window.hpp.
Referenced by ~Window().
|
inlinestatic |
Draw current FPS.
Definition at line 416 of file Window.hpp.
References DrawFPS().
Referenced by DrawFPS().
|
inline |
Alternates between calling BeginDrawing() and EndDrawing().
BeginDrawing() scope. Definition at line 453 of file Window.hpp.
References BeginDrawing(), EndDrawing(), and m_drawing.
|
inline |
End canvas drawing and swap buffers (double buffering)
Definition at line 348 of file Window.hpp.
References EndDrawing().
Referenced by Drawing(), and EndDrawing().
|
inlinestatic |
Get clipboard text content.
Definition at line 398 of file Window.hpp.
|
inlinestatic |
Returns current FPS.
Definition at line 411 of file Window.hpp.
|
inlinestatic |
Returns time in seconds for last frame drawn.
Definition at line 421 of file Window.hpp.
|
inlinestatic |
Get native window handle.
Definition at line 335 of file Window.hpp.
|
inlinestatic |
|
inlinestatic |
Definition at line 381 of file Window.hpp.
|
inlinestatic |
Get window position XY on monitor.
Definition at line 376 of file Window.hpp.
|
inlinestatic |
Get current render height (it considers HiDPI)
Definition at line 371 of file Window.hpp.
|
inlinestatic |
Get current render width (it considers HiDPI)
Definition at line 366 of file Window.hpp.
|
inlinestatic |
Get window scale DPI factor.
Definition at line 386 of file Window.hpp.
|
inlinestatic |
Get the screen's width and height.
Definition at line 330 of file Window.hpp.
References GetHeight(), and GetWidth().
|
inlinestatic |
Returns elapsed time in seconds since InitWindow()
Definition at line 426 of file Window.hpp.
|
inlinestatic |
|
inlinestatic |
Hides cursor.
Definition at line 103 of file Window.hpp.
References HideCursor().
Referenced by HideCursor().
|
inline |
Initializes the window.
| width | The width of the window. |
| height | The height of the window. |
| title | The desired title of the window. |
| flags | The ConfigFlags to set prior to initializing the window. See SetConfigFlags for more details. |
| raylib::RaylibException | Thrown if the window failed to initiate. |
Definition at line 61 of file Window.hpp.
References raylib::InitWindow(), and SetConfigFlags().
Referenced by Window().
|
inlinestatic |
Check if cursor is not visible.
Definition at line 98 of file Window.hpp.
|
inlinestatic |
Check if cursor is on the current screen.
Definition at line 93 of file Window.hpp.
|
inlinestatic |
Check if window is currently focused.
Definition at line 133 of file Window.hpp.
|
inlinestatic |
Check if window is currently fullscreen.
Definition at line 113 of file Window.hpp.
Referenced by SetFullscreen().
|
inlinestatic |
Check if window is currently hidden.
Definition at line 118 of file Window.hpp.
|
inlinestatic |
Check if window is currently minimized.
Definition at line 128 of file Window.hpp.
|
inlinestatic |
Check if window is currently minimized.
Definition at line 123 of file Window.hpp.
|
inlinestatic |
Check if window has been resized last frame.
Definition at line 138 of file Window.hpp.
|
inlinestatic |
Check if one specific window flag is enabled.
Definition at line 143 of file Window.hpp.
|
inlinestatic |
Check if window has been initialized successfully.
Definition at line 431 of file Window.hpp.
|
inline |
Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
Definition at line 206 of file Window.hpp.
|
inline |
Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
Definition at line 214 of file Window.hpp.
|
inline |
Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
Definition at line 222 of file Window.hpp.
|
inline |
Set clipboard text content.
Definition at line 391 of file Window.hpp.
References SetClipboardText().
Referenced by SetClipboardText().
|
inlinestatic |
Sets the configuration flags for raylib.
| flags | The ConfigFlags to apply to the configuration. |
Definition at line 440 of file Window.hpp.
References SetConfigFlags().
Referenced by Init(), and SetConfigFlags().
|
inlinestatic |
Set a custom key to exit program (default is ESC)
Definition at line 79 of file Window.hpp.
References SetExitKey().
Referenced by SetExitKey().
|
inline |
Set window focused (only PLATFORM_DESKTOP)
Definition at line 317 of file Window.hpp.
|
inline |
Set whether or not the application should be fullscreen.
Definition at line 180 of file Window.hpp.
References IsFullscreen(), and ToggleFullscreen().
|
inline |
Set icon for window.
Definition at line 230 of file Window.hpp.
Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
Definition at line 238 of file Window.hpp.
Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
Definition at line 246 of file Window.hpp.
|
inline |
Set window minimum dimensions.
Definition at line 293 of file Window.hpp.
|
inline |
Set window minimum dimensions.
Definition at line 285 of file Window.hpp.
|
inline |
Set monitor for the current window.
Definition at line 277 of file Window.hpp.
|
inline |
Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
Definition at line 309 of file Window.hpp.
|
inline |
|
inline |
Set window position on screen.
Definition at line 262 of file Window.hpp.
Referenced by SetPosition().
|
inline |
Set window dimensions.
Definition at line 325 of file Window.hpp.
References SetSize().
Referenced by SetSize().
|
inline |
Set window dimensions.
Definition at line 301 of file Window.hpp.
|
inline |
Set window configuration state using flags.
Definition at line 148 of file Window.hpp.
|
inline |
Set target FPS (maximum)
Definition at line 403 of file Window.hpp.
References SetTargetFPS().
Referenced by SetTargetFPS().
|
inline |
Set title for window.
Definition at line 254 of file Window.hpp.
References raylib::SetWindowTitle().
|
inlinestatic |
Check if KEY_ESCAPE pressed or Close icon pressed.
Definition at line 74 of file Window.hpp.
|
inlinestatic |
Shows cursor.
Definition at line 108 of file Window.hpp.
References ShowCursor().
Referenced by ShowCursor().
|
inline |
Toggle window state: borderless/windowed.
Definition at line 198 of file Window.hpp.
|
inline |
Toggle window state: fullscreen/windowed.
Definition at line 172 of file Window.hpp.
References ToggleFullscreen().
Referenced by SetFullscreen(), and ToggleFullscreen().
|
protected |
Handles the internal drawing state for calling either BeginDrawing() or EndDrawing() from the Drawing() function.
Definition at line 472 of file Window.hpp.
Referenced by Drawing().