#include <Window.hpp>
A window. You can draw objects on the window. More...
A window. You can draw objects on the window.
Definition at line 31 of file Window.hpp.
Public Member Functions | |
Window () | |
A null window. More... | |
Window (int width, int height, const std::string &title) | |
The window construtor. More... | |
GLFWwindow * | window () const |
The window handle. More... | |
float | time () const |
The last time Window::PoolEvent() was called. More... | |
Input & | input () |
Return an object for querying the input state. More... | |
void | ExecuteMainLoop (const std::function< void(void)> &loop) |
Helper function. Execute the main loop of the application. On web based application: registers the loop in 'requestAnimationFrame'. On desktop based applications: This is a simple 'while' loop. The loop stops when the user presses the 'escape' button or when the |loop| function returns 'false'. More... | |
void | ExecuteMainLoopUntil (const std::function< bool(void)> &loop) |
Helper function. Execute the main loop of the application. On web based application: registers the loop in 'requestAnimationFrame'. On desktop based applications: This is a simple 'while' loop. The loop stops when the user presses the 'escape' button or when the |loop| function returns 'false'. More... | |
void | PoolEvents () |
Handle all the new input events. This update the input() object. More... | |
void | Display () |
Present what has been draw to the screen. More... | |
void | LimitFrameRate (float fps) |
bool | ShouldClose () |
Returns true when the user wants to close the window. More... | |
Window (Window &&) noexcept | |
Window (const Window &)=delete | |
Window & | operator= (Window &&) noexcept |
Window & | operator= (const Window &)=delete |
void | Clear (const glm::vec4 &color) |
Clear the surface with a single color. More... | |
void | SetView (const View &view) |
Set the View to use. More... | |
void | SetView (const glm::mat4 &mat) |
Set the View to use. More... | |
const View & | view () const |
Return the View currently assigned to this RenderTarget. More... | |
void | SetShaderProgram (ShaderProgram &shader_program) |
Set the ShaderProgram to be used. More... | |
ShaderProgram & | shader_program_2d () |
Return the default predefined 2D shader program. It is bound by default. More... | |
ShaderProgram & | shader_program_3d () |
Return the default predefined 3D shader program. More... | |
virtual void | Draw (const Drawable &drawable) |
Draw on the surface. More... | |
virtual void | Draw (RenderState &state) |
Draw on the surface. More... | |
glm::vec2 | dimensions () const |
the dimension (width, height) of the drawing area. More... | |
int | width () const |
the width of the surface. More... | |
int | height () const |
the height of the surface. More... | |
Static Public Member Functions | |
static void | Bind (RenderTarget *target) |
Protected Member Functions | |
void | InitRenderTarget () |
Protected Attributes | |
int | width_ = 0 |
int | height_ = 0 |
glm::mat4 | projection_matrix_ = glm::mat4(1) |
smk::View | view_ |
Shader | vertex_shader_2d_ |
Shader | fragment_shader_2d_ |
ShaderProgram | shader_program_2d_ |
Shader | vertex_shader_3d_ |
Shader | fragment_shader_3d_ |
ShaderProgram | shader_program_3d_ |
ShaderProgram | shader_program_ |
GLuint | frame_buffer_ = 0 |
smk::Window::Window | ( | ) |
A null window.
Definition at line 117 of file Window.cpp.
smk::Window::Window | ( | int | width, |
int | height, | ||
const std::string & | title | ||
) |
The window construtor.
width | The desired width of the window. |
height | The desired height of the window. |
title | The window's title. |
Definition at line 126 of file Window.cpp.
smk::Window::~Window | ( | ) |
Definition at line 254 of file Window.cpp.
|
noexcept |
Definition at line 217 of file Window.cpp.
|
staticinherited |
Definition at line 28 of file RenderTarget.cpp.
|
inherited |
Clear the surface with a single color.
color | An opaque color to fill the surface. |
Definition at line 65 of file RenderTarget.cpp.
|
inherited |
the dimension (width, height) of the drawing area.
Definition at line 219 of file RenderTarget.cpp.
void smk::Window::Display | ( | ) |
Present what has been draw to the screen.
Definition at line 244 of file Window.cpp.
|
virtualinherited |
Draw on the surface.
drawable | The object to be drawn on the surface. |
Definition at line 162 of file RenderTarget.cpp.
|
virtualinherited |
Draw on the surface.
state | The RenderState to be usd for drawing. |
Definition at line 174 of file RenderTarget.cpp.
void smk::Window::ExecuteMainLoop | ( | const std::function< void(void)> & | loop | ) |
Helper function. Execute the main loop of the application. On web based application: registers the loop in 'requestAnimationFrame'. On desktop based applications: This is a simple 'while' loop. The loop stops when the user presses the 'escape' button or when the |loop| function returns 'false'.
loop | The function to be called for each new frame. |
Definition at line 297 of file Window.cpp.
void smk::Window::ExecuteMainLoopUntil | ( | const std::function< bool(void)> & | loop | ) |
Helper function. Execute the main loop of the application. On web based application: registers the loop in 'requestAnimationFrame'. On desktop based applications: This is a simple 'while' loop. The loop stops when the user presses the 'escape' button or when the |loop| function returns 'false'.
loop | The function to be called for each new frame. |
Definition at line 280 of file Window.cpp.
|
inherited |
the height of the surface.
Definition at line 231 of file RenderTarget.cpp.
|
protectedinherited |
Definition at line 235 of file RenderTarget.cpp.
Input & smk::Window::input | ( | ) |
Return an object for querying the input state.
Definition at line 270 of file Window.cpp.
void smk::Window::LimitFrameRate | ( | float | fps | ) |
If needed, insert pause in the execution to maintain a given framerate.
fps | the desired frame rate. |
Definition at line 327 of file Window.cpp.
Definition at line 221 of file Window.cpp.
void smk::Window::PoolEvents | ( | ) |
Handle all the new input events. This update the input() object.
Definition at line 238 of file Window.cpp.
|
inherited |
Set the ShaderProgram to be used.
shader_program | The ShaderProgram to be used. |
{
Definition at line 140 of file RenderTarget.cpp.
|
inherited |
Set the View to use.
mat | The matrix to transform from/to the OpenGL space [-1,1]^3 to the screen space. |
Definition at line 90 of file RenderTarget.cpp.
|
inherited |
Set the View to use.
view | The view to use. |
Definition at line 75 of file RenderTarget.cpp.
|
inherited |
Return the default predefined 2D shader program. It is bound by default.
Definition at line 151 of file RenderTarget.cpp.
|
inherited |
Return the default predefined 3D shader program.
Definition at line 156 of file RenderTarget.cpp.
bool smk::Window::ShouldClose | ( | ) |
Returns true when the user wants to close the window.
Definition at line 340 of file Window.cpp.
float smk::Window::time | ( | ) | const |
The last time Window::PoolEvent() was called.
Definition at line 265 of file Window.cpp.
|
inherited |
Return the View currently assigned to this RenderTarget.
Definition at line 95 of file RenderTarget.cpp.
|
inherited |
the width of the surface.
Definition at line 225 of file RenderTarget.cpp.
GLFWwindow * smk::Window::window | ( | ) | const |
|
protectedinherited |
Definition at line 71 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 75 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 81 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 63 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 66 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 79 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 72 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 76 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 70 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 74 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 67 of file RenderTarget.hpp.
|
protectedinherited |
Definition at line 62 of file RenderTarget.hpp.