SimpleGL  1.1.0
A framework for platform independent rendering
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sgl::Window Class Referenceabstract

This class provides a basic GLFW window. More...

#include <glfw_window.hpp>

Inheritance diagram for sgl::Window:
sgl::WindowGL sgl::WindowVK

Public Member Functions

 ~Window (void)
 Destroys the window. More...
 
GLFWwindow * getHandle ()
 Returns the handle of the window. More...
 
int getWidth ()
 Returns the width of the drawing area. More...
 
void setWidth (int width)
 Sets the width of the drawing area. More...
 
int getHeight ()
 Returns the height of the drawing area. More...
 
void setHeight (int height)
 Sets the height of the drawing area. More...
 
glm::ivec2 getSize ()
 Returns the size of the drawing area. More...
 
void setSize (glm::ivec2 size)
 Sets the size of the drawing area. More...
 
std::string getTitle ()
 Returns the window title. More...
 
void setTitle (std::string title)
 Sets this windows title. More...
 
void showInfoTitle ()
 Shows informations in the title. More...
 
void centerWindow ()
 Centers the window on the primary screen. More...
 
void setKeyCallback (KeyCallback *callback)
 Set the key callback. More...
 
void setMouseButtonCallback (MouseButtonCallback *callback)
 Set the mouse button callback. More...
 
virtual void swapBuffers ()=0
 Swaps the framebuffers of this window. More...
 
void update ()
 Convenience method to swap buffers and poll events in one call. More...
 
bool shouldClose ()
 Checks the close flag for the window. More...
 
void sync (int fps)
 Syncs the window framerate to specified FPS. More...
 
glm::dvec2 getCursorPos ()
 Gets the cursor position. More...
 
double getCursorX ()
 Gets the cursor's X-position. More...
 
double getCursorY ()
 Gets the cursor's Y-position. More...
 

Protected Member Functions

 Window (void)
 Initializes a new window. More...
 

Protected Attributes

GLFWwindow * handle
 The handle for the GLFW window. More...
 
glm::ivec2 size
 The size of the drawing area. More...
 
std::string title
 The title for the GLFW window. More...
 

Detailed Description

This class provides a basic GLFW window.

Definition at line 29 of file glfw_window.hpp.

Constructor & Destructor Documentation

sgl::Window::Window ( void  )
protected

Initializes a new window.

Definition at line 20 of file glfw_window.cpp.

sgl::Window::~Window ( void  )

Destroys the window.

Definition at line 24 of file glfw_window.cpp.

Member Function Documentation

void sgl::Window::centerWindow ( )

Centers the window on the primary screen.

Definition at line 84 of file glfw_window.cpp.

glm::dvec2 sgl::Window::getCursorPos ( )

Gets the cursor position.

Returns
A vector that stores the position.

Definition at line 126 of file glfw_window.cpp.

double sgl::Window::getCursorX ( )

Gets the cursor's X-position.

Returns
X coordinate of the cursor.

Definition at line 132 of file glfw_window.cpp.

double sgl::Window::getCursorY ( )

Gets the cursor's Y-position.

Returns
Y coordinate of the cursor.

Definition at line 136 of file glfw_window.cpp.

GLFWwindow * sgl::Window::getHandle ( )

Returns the handle of the window.

Returns
The handle of the window.

Definition at line 28 of file glfw_window.cpp.

int sgl::Window::getHeight ( )

Returns the height of the drawing area.

Returns
The height of the drawing area.

Definition at line 44 of file glfw_window.cpp.

glm::ivec2 sgl::Window::getSize ( )

Returns the size of the drawing area.

Returns
The size of the drawing area.

Definition at line 56 of file glfw_window.cpp.

std::string sgl::Window::getTitle ( )

Returns the window title.

Returns
The Window title.

Definition at line 68 of file glfw_window.cpp.

int sgl::Window::getWidth ( )

Returns the width of the drawing area.

Returns
The width of the drawing area.

Definition at line 32 of file glfw_window.cpp.

void sgl::Window::setHeight ( int  height)

Sets the height of the drawing area.

Parameters
heightThe new height of the drawing area.

Definition at line 48 of file glfw_window.cpp.

void sgl::Window::setKeyCallback ( KeyCallback callback)

Set the key callback.

Parameters
callbackPointer to the key callback.

Definition at line 89 of file glfw_window.cpp.

void sgl::Window::setMouseButtonCallback ( MouseButtonCallback callback)

Set the mouse button callback.

Parameters
callbackPointer to the mouse button callback.

Definition at line 94 of file glfw_window.cpp.

void sgl::Window::setSize ( glm::ivec2  size)

Sets the size of the drawing area.

Parameters
sizeThe new size of the drawing area.

Definition at line 60 of file glfw_window.cpp.

void sgl::Window::setTitle ( std::string  title)

Sets this windows title.

Parameters
titleThe new title of the window.

Definition at line 72 of file glfw_window.cpp.

void sgl::Window::setWidth ( int  width)

Sets the width of the drawing area.

Parameters
widthThe new width of the drawing area.

Definition at line 36 of file glfw_window.cpp.

bool sgl::Window::shouldClose ( )

Checks the close flag for the window.

Returns
true, if the window should get closed, else false.

Definition at line 104 of file glfw_window.cpp.

void sgl::Window::showInfoTitle ( )

Shows informations in the title.

Definition at line 77 of file glfw_window.cpp.

virtual void sgl::Window::swapBuffers ( )
pure virtual

Swaps the framebuffers of this window.

Implemented in sgl::WindowVK, and sgl::WindowGL.

void sgl::Window::sync ( int  fps)

Syncs the window framerate to specified FPS.

Parameters
fpsThe desired FPS.

Definition at line 108 of file glfw_window.cpp.

void sgl::Window::update ( )

Convenience method to swap buffers and poll events in one call.

Definition at line 99 of file glfw_window.cpp.

Member Data Documentation

GLFWwindow* sgl::Window::handle
protected

The handle for the GLFW window.

Definition at line 33 of file glfw_window.hpp.

glm::ivec2 sgl::Window::size
protected

The size of the drawing area.

Definition at line 36 of file glfw_window.hpp.

std::string sgl::Window::title
protected

The title for the GLFW window.

Definition at line 39 of file glfw_window.hpp.


The documentation for this class was generated from the following files: