 |
raylib-cpp
C++ object-oriented wrapper library for raylib.
|
25 #ifndef RAYLIB_CPP_INCLUDE_WINDOW_HPP_
26 #define RAYLIB_CPP_INCLUDE_WINDOW_HPP_
30 #include "./raylib.hpp"
49 Window(
int width = 800,
int height = 450,
const std::string& title =
"raylib",
50 bool lateInit =
false) {
52 Init(width, height, title);
60 void Init(
int width,
int height,
const std::string& title) {
61 ::InitWindow(width, height, title.c_str());
68 return ::WindowShouldClose();
82 return ::IsCursorOnScreen();
89 return ::IsWindowReady();
96 return ::IsWindowFullscreen();
103 return ::IsWindowHidden();
110 return ::IsWindowMinimized();
117 return ::IsWindowMaximized();
124 return ::IsWindowFocused();
131 return ::IsWindowResized();
137 inline bool IsState(
unsigned int flag)
const {
138 return ::IsWindowState(flag);
145 ::SetWindowState(flag);
153 ::ClearWindowState(flag);
193 ::SetWindowIcon(image);
201 ::SetWindowTitle(title.c_str());
209 ::SetWindowPosition(x, y);
217 ::SetWindowMonitor(monitor);
225 ::SetWindowMinSize(width, height);
233 ::SetWindowSize(width, height);
241 return ::GetWindowHandle();
264 return ::GetScreenWidth();
271 return ::GetScreenHeight();
278 return ::GetWindowPosition();
285 return ::GetWindowScaleDPI();
292 return ::GetMonitorName(monitor);
299 return ::GetClipboardText();
329 return ::GetFrameTime();
341 #endif // RAYLIB_CPP_INCLUDE_WINDOW_HPP_
void * GetHandle() const
Get native window handle.
Provides all the classes associated with raylib-cpp.
Window & SetMonitor(int monitor)
Set monitor for the current window.
double GetTime() const
Returns elapsed time in seconds since InitWindow()
bool IsHidden() const
Check if window is currently hidden.
void Close()
Close window and unload OpenGL context.
Window & SetIcon(::Image image)
Set icon for window.
Window & SetMinSize(int width, int height)
Set window minimum dimensions.
Window & SetState(unsigned int flag)
Set window configuration state using flags.
float GetFrameTime() const
Returns time in seconds for last frame drawn.
bool ShouldClose() const
Check if KEY_ESCAPE pressed or Close icon pressed.
void Init(int width, int height, const std::string &title)
std::string GetMonitorName(int monitor) const
Get the human-readable, UTF-8 encoded name of the primary monitor.
Window & SetPosition(int x, int y)
Set window position on screen.
bool IsMaximized() const
Check if window is currently minimized.
Vector2 GetScaleDPI() const
Get window scale DPI factor.
Window(int width=800, int height=450, const std::string &title="raylib", bool lateInit=false)
Initialize window and OpenGL context.
bool IsFocused() const
Check if window is currently focused.
bool IsResized() const
Check if window has been resized last frame.
Window & EndDrawing()
End canvas drawing and swap buffers (double buffering)
Window & SetSize(int width, int height)
Set window dimensions.
int GetFPS() const
Returns current FPS.
Window & Minimize()
Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
int GetScreenHeight() const
Get current screen height.
Window & ToggleFullscreen()
Toggle window state: fullscreen/windowed.
Window & Maximize()
Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
Window & SetTitle(const std::string &title)
Set title for window.
bool IsCursorOnScreen() const
Check if cursor is on the current screen.
bool IsFullscreen() const
Check if window is currently fullscreen.
static bool IsReady()
Check if window has been initialized successfully.
int GetScreenWidth() const
Get current screen width.
std::string GetClipboardText() const
Get clipboard text content.
Window & BeginDrawing()
Setup canvas (framebuffer) to start drawing.
Window & SetClipboardText(const std::string &text)
Set clipboard text content.
Window & ClearState(unsigned int flag)
Clear window configuration state flags.
bool IsState(unsigned int flag) const
Check if one specific window flag is enabled.
Window & SetTargetFPS(int fps)
Set target FPS (maximum)
bool IsMinimized() const
Check if window is currently minimized.
Window & Restore()
Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
Vector2 GetPosition() const
Get window position XY on monitor.
Window and Graphics Device Functions.