![]() |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
Window and Graphics Device Functions. More...
#include <Window.hpp>
Public Member Functions | |
Window () | |
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... | |
void | Close () |
Close window and unload OpenGL context. More... | |
void | DrawFPS (int posX=10, int posY=10) const |
Draw current FPS. More... | |
Window & | EndDrawing () |
End canvas drawing and swap buffers (double buffering) More... | |
const std::string | GetClipboardText () |
Get clipboard text content. More... | |
int | GetFPS () const |
Returns current FPS. More... | |
float | GetFrameTime () const |
Returns time in seconds for last frame drawn. More... | |
void * | GetHandle () const |
Get native window handle. More... | |
int | GetHeight () const |
Get current screen height. More... | |
Vector2 | GetPosition () const |
Get window position XY on monitor. More... | |
int | GetRenderHeight () const |
Get current render height (it considers HiDPI) More... | |
int | GetRenderWidth () const |
Get current render width (it considers HiDPI) More... | |
Vector2 | GetScaleDPI () const |
Get window scale DPI factor. More... | |
Vector2 | GetSize () const |
Get the screen's width and height. More... | |
double | GetTime () const |
Returns elapsed time in seconds since InitWindow() More... | |
int | GetWidth () const |
Get current screen width. More... | |
void | Init (int width=800, int height=450, const std::string_view title="raylib", unsigned int flags=0) |
Initializes the window. More... | |
bool | IsCursorOnScreen () const |
Check if cursor is on the current screen. More... | |
bool | IsFocused () const |
Check if window is currently focused. More... | |
bool | IsFullscreen () const |
Check if window is currently fullscreen. More... | |
bool | IsHidden () const |
Check if window is currently hidden. More... | |
bool | IsMaximized () const |
Check if window is currently minimized. More... | |
bool | IsMinimized () const |
Check if window is currently minimized. More... | |
bool | IsResized () const |
Check if window has been resized last frame. More... | |
bool | IsState (unsigned int flag) const |
Check if one specific window flag is enabled. 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... | |
void | SetConfigFlags (unsigned int flags) |
Sets the configuration flags for raylib. More... | |
void | SetExitKey (int key) |
Set a custom key to exit program (default is ESC) 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... | |
bool | ShouldClose () const |
Check if KEY_ESCAPE pressed or Close icon pressed. More... | |
Window & | ToggleBorderless () |
Toggle window state: borderless/windowed. More... | |
Window & | ToggleFullscreen () |
Toggle window state: fullscreen/windowed. More... | |
Static Public Member Functions | |
static bool | IsReady () |
Check if window has been initialized successfully. More... | |
Window and Graphics Device Functions.
Definition at line 16 of file Window.hpp.
|
inline |
Build a Window object, but defer the initialization.
Ensure you call Init() manually.
Definition at line 23 of file Window.hpp.
|
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. |
raylib::RaylibException | Thrown if the window failed to initiate. |
Definition at line 40 of file Window.hpp.
References Init().
|
inline |
Close window and unload OpenGL context.
Definition at line 47 of file Window.hpp.
References Close().
|
inline |
Setup canvas (framebuffer) to start drawing.
Definition at line 353 of file Window.hpp.
References BeginDrawing().
Referenced by BeginDrawing().
|
inline |
Clear window with given color.
Definition at line 172 of file Window.hpp.
References ClearBackground().
Referenced by ClearBackground().
|
inline |
Clear window configuration state flags.
Definition at line 164 of file Window.hpp.
|
inline |
Close window and unload OpenGL context.
Definition at line 91 of file Window.hpp.
Referenced by ~Window().
|
inline |
Draw current FPS.
Definition at line 440 of file Window.hpp.
References DrawFPS().
Referenced by DrawFPS().
|
inline |
End canvas drawing and swap buffers (double buffering)
Definition at line 361 of file Window.hpp.
References EndDrawing().
Referenced by EndDrawing().
|
inline |
Get clipboard text content.
Definition at line 418 of file Window.hpp.
|
inline |
Returns current FPS.
Definition at line 433 of file Window.hpp.
|
inline |
Returns time in seconds for last frame drawn.
Definition at line 447 of file Window.hpp.
|
inline |
Get native window handle.
Definition at line 346 of file Window.hpp.
|
inline |
|
inline |
Get window position XY on monitor.
Definition at line 397 of file Window.hpp.
|
inline |
Get current render height (it considers HiDPI)
Definition at line 390 of file Window.hpp.
|
inline |
Get current render width (it considers HiDPI)
Definition at line 383 of file Window.hpp.
|
inline |
Get window scale DPI factor.
Definition at line 404 of file Window.hpp.
|
inline |
Get the screen's width and height.
Definition at line 339 of file Window.hpp.
References GetHeight(), and GetWidth().
|
inline |
Returns elapsed time in seconds since InitWindow()
Definition at line 454 of file Window.hpp.
|
inline |
|
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 64 of file Window.hpp.
References SetConfigFlags().
Referenced by Window().
|
inline |
Check if cursor is on the current screen.
Definition at line 100 of file Window.hpp.
|
inline |
Check if window is currently focused.
Definition at line 135 of file Window.hpp.
|
inline |
Check if window is currently fullscreen.
Definition at line 107 of file Window.hpp.
Referenced by SetFullscreen().
|
inline |
Check if window is currently hidden.
Definition at line 114 of file Window.hpp.
|
inline |
Check if window is currently minimized.
Definition at line 128 of file Window.hpp.
|
inline |
Check if window is currently minimized.
Definition at line 121 of file Window.hpp.
|
inlinestatic |
Check if window has been initialized successfully.
Definition at line 461 of file Window.hpp.
|
inline |
Check if window has been resized last frame.
Definition at line 142 of file Window.hpp.
|
inline |
Check if one specific window flag is enabled.
Definition at line 149 of file Window.hpp.
|
inline |
Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
Definition at line 213 of file Window.hpp.
|
inline |
Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
Definition at line 221 of file Window.hpp.
|
inline |
Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
Definition at line 229 of file Window.hpp.
|
inline |
Set clipboard text content.
Definition at line 411 of file Window.hpp.
References SetClipboardText().
Referenced by SetClipboardText().
|
inline |
Sets the configuration flags for raylib.
flags | The ConfigFlags to apply to the configuration. |
Definition at line 472 of file Window.hpp.
References SetConfigFlags().
Referenced by Init(), and SetConfigFlags().
|
inline |
Set a custom key to exit program (default is ESC)
Definition at line 84 of file Window.hpp.
References SetExitKey().
Referenced by SetExitKey().
|
inline |
Set window focused (only PLATFORM_DESKTOP)
Definition at line 324 of file Window.hpp.
|
inline |
Set whether or not the application should be fullscreen.
Definition at line 188 of file Window.hpp.
References IsFullscreen(), and ToggleFullscreen().
|
inline |
Set icon for window.
Definition at line 237 of file Window.hpp.
Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
Definition at line 245 of file Window.hpp.
Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
Definition at line 253 of file Window.hpp.
|
inline |
Set window minimum dimensions.
Definition at line 300 of file Window.hpp.
|
inline |
Set window minimum dimensions.
Definition at line 292 of file Window.hpp.
|
inline |
Set monitor for the current window.
Definition at line 284 of file Window.hpp.
|
inline |
Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
Definition at line 316 of file Window.hpp.
|
inline |
|
inline |
Set window position on screen.
Definition at line 269 of file Window.hpp.
Referenced by SetPosition().
|
inline |
|
inline |
|
inline |
Set window configuration state using flags.
Definition at line 156 of file Window.hpp.
|
inline |
Set target FPS (maximum)
Definition at line 425 of file Window.hpp.
References SetTargetFPS().
Referenced by SetTargetFPS().
|
inline |
Set title for window.
Definition at line 261 of file Window.hpp.
|
inline |
Check if KEY_ESCAPE pressed or Close icon pressed.
Definition at line 77 of file Window.hpp.
|
inline |
Toggle window state: borderless/windowed.
Definition at line 205 of file Window.hpp.
|
inline |
Toggle window state: fullscreen/windowed.
Definition at line 180 of file Window.hpp.
References ToggleFullscreen().
Referenced by SetFullscreen(), and ToggleFullscreen().