 |
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 = 800,
int height = 450,
const std::string& title =
"raylib") {
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);
210 ::SetWindowIcon(image);
218 ::SetWindowTitle(title.c_str());
226 ::SetWindowPosition(x, y);
234 return SetPosition(
static_cast<int>(position.x),
static_cast<int>(position.y));
241 ::SetWindowMonitor(monitor);
249 ::SetWindowMinSize(width, height);
257 ::SetWindowSize(width, height);
265 return SetSize(
static_cast<int>(size.x),
static_cast<int>(size.y));
279 return ::GetWindowHandle();
302 return ::GetScreenWidth();
309 return ::GetScreenHeight();
316 return ::GetWindowPosition();
323 return ::GetWindowScaleDPI();
345 return ::GetFrameTime();
357 #endif // RAYLIB_CPP_INCLUDE_WINDOW_HPP_
inline ::Vector2 GetSize()
Get the screen's width and height.
int GetWidth() const
Get current screen width.
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 Init(int width=800, int height=450, const std::string &title="raylib")
void Close()
Close window and unload OpenGL context.
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.
Window & SetFullscreen(bool fullscreen)
Set whether or not the application should be fullscreen.
Window & SetPosition(int x, int y)
Set window position on screen.
Window & SetSize(const ::Vector2 &size)
Set window dimensions.
bool IsMaximized() const
Check if window is currently minimized.
inline ::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.
int GetHeight() const
Get current screen height.
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)
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.
Window & BeginDrawing()
Setup canvas (framebuffer) to start drawing.
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 & SetPosition(const ::Vector2 &position)
Set window position on screen.
Window & SetTargetFPS(int fps)
Set target FPS (maximum)
inline ::Vector2 GetPosition() const
Get window position XY on monitor.
bool IsMinimized() const
Check if window is currently minimized.
Window & Restore()
Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
Window & SetIcon(const ::Image &image)
Set icon for window.
Window and Graphics Device Functions.