Go to the documentation of this file.
41 static Window &
getInstance(
int width,
int height,
const std::string &title,
unsigned flags = 0,
bool openNow =
true) noexcept;
91 void setFPS(
unsigned int fps);
122 void setTitle(
const std::string &title);
130 void draw(
const Mesh &mesh,
const Material &material,
const Matrix &transform);
162 Window(
int width,
int height, std::string title,
unsigned flags = 0,
bool openNow =
true);
void endDrawing()
End canvas drawing and swap buffers (double buffering)
Definition: Window.cpp:129
void beginDrawing()
Setup canvas (framebuffer) to start drawing.
Definition: Window.cpp:124
RAY::Vector2 _dimensions
Dimension of window.
Definition: Window.hpp:165
bool open(void)
Initialize window and OpenGL context.
Definition: Window.cpp:45
void setExitKey(Controller::Keyboard::Key key)
Definition: Window.cpp:194
RAY::Window & toggleFullscreen()
set window to fullscreen
Definition: Window.cpp:217
bool _isOpen
has the window been open?
Definition: Window.hpp:171
bool isReady() const
Definition: Window.cpp:189
bool isFullscreen(void) const
Definition: Window.cpp:204
bool isFocused(void) const
Check if window is currently focused.
Definition: Window.cpp:68
displayState
Different states of the view of the window.
Definition: Window.hpp:98
Definition: Window.hpp:32
enum displayState _displayState
Current window draw-state.
Definition: Window.hpp:177
@ NONE
When no camera is used.
Definition: Window.hpp:104
static Window & getInstance()
Get The window's instance, if the window has not been already constructed a runtime exception is thro...
Definition: Window.cpp:18
::KeyboardKey Key
Definition: Keyboard.hpp:18
void drawFPS(const Vector2 &position)
Draws current FPS on the frame.
Definition: Window.cpp:184
const RAY::Vector2 & getDimensions(void)
Get window dimensions.
Definition: Window.cpp:73
Interface for any drawable.
Definition: IDrawable.hpp:18
void setFPS(unsigned int fps)
Set target FPS (maximum)
Definition: Window.cpp:114
A Two-dimensionnal Vector data type.
Definition: Vector2.hpp:15
unsigned getConfigFlags(void) const
Definition: Window.cpp:199
bool shouldClose(void) const
Check if KEY_ESCAPE pressed or Close icon pressed.
Definition: Window.cpp:57
Entity representing a Camera in 2D space.
Definition: Camera2D.hpp:18
void close(void)
Close window and unload OpenGL context.
Definition: Window.cpp:62
void setTitle(const std::string &title)
Set the window title.
Definition: Window.cpp:164
Definition: IAudio.hpp:12
std::string _title
Title of window.
Definition: Window.hpp:168
void unuseCamera(void)
Ends current view mode and returns to default mode.
Definition: Window.cpp:148
void setIcon(RAY::Image &img)
set the window icon
Definition: Window.cpp:179
void useCamera(Camera::Camera2D &camera)
Initialize 2D mode with custom camera (2D)
Definition: Window.cpp:134
@ THREE_DIMENSIONNAL
When a custom 3D camera is used.
Definition: Window.hpp:102
RAY::Window & setDimensions(const Vector2 &dims)
Set window dimensions.
Definition: Window.cpp:80
void draw(RAY::Drawables::IDrawable &drawable)
draw drawable
Definition: Window.cpp:169
::Matrix Matrix
Definition: Matrix.hpp:14
void setVisibleCursor(bool visible)
Set the cursor visibility.
Definition: Window.cpp:88
RAY::Window & maximize()
set window to max size
Definition: Window.cpp:223
unsigned int _flags
flags for the window (ex: FLAG_WINDOW_RESIZABLE)
Definition: Window.hpp:174
static std::optional< Window > _instance
The window's instance as an optional.
Definition: Window.hpp:35
Object representation of a framebuffer.
Definition: Image.hpp:20
RAY::Window & setConfigFlags(unsigned flags)
Definition: Window.cpp:209
bool cursorIsVisible(void) const
Check if cursor is not visible.
Definition: Window.cpp:104
Object representation of color.
Definition: Color.hpp:15
Window(Window &&)=default
A window is movable.
Entity representing a Camera in 3D space.
Definition: Camera3D.hpp:20
Vector2 getCursorPosition() const
Get the cursor position.
Definition: Window.cpp:109
@ TWO_DIMENSIONNAL
When a custom 2D camera is used.
Definition: Window.hpp:100
void clear(Color color=BLACK)
Set background color (framebuffer clear color)
Definition: Window.cpp:119
::Mesh Mesh
Vertex data definning a mesh.
Definition: Mesh.hpp:15
void enableCursor(bool enable)
Enable/Disable the cursor.
Definition: Window.cpp:96
RAY::Window & restore()
reset window size
Definition: Window.cpp:229