Oxygen Engine
Modern C++ 3D Engine using OpenGL
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
oe::core::Window Class Reference

#include <OxygenEngine/core/window.h>

Public Member Functions

 Window (const std::string &title, bool is_visible=true)
 Generate and open a fullscreen window.
 
 Window (const glm::ivec2 &dimensions, const std::string &title, bool is_visible=true)
 Generate and open a new window.
 
void setTitle (const std::string &title)
 Set window title.
 
void processEvents ()
 Process window events.
 
void beginRender ()
 Begin rendering to the main framebuffer.
 
void endRender ()
 End framebuffer rendering.
 
void lockCursor ()
 Hide cursor and lock it at window center.
 
void setCursorVisible (bool visible=true)
 
void setCursorPosition (const double &x, const double &y)
 Set cursor position relative to the window.
 
glm::vec2 getCursorPosition (const bool &absolute=false)
 Get cursor position relative to the window or screen.
 
void moveToCenter ()
 Center the window.
 
void show ()
 Display the window.
 
void hide ()
 Hide the window.
 
void blink ()
 Make the window blink to get user attention.
 
void makeContextCurrent ()
 
void setPosition (const glm::ivec2 &)
 Set window position (excluding decorations)
 
void setDimensions (const glm::ivec2 &)
 Set window dimensions (excluding decorations)
 
const glm::ivec2 getPosition () const
 Get window position (excluding decorations)
 
const glm::ivec2 getDimensions () const
 Get window dimensions (excluding decorations)
 
float getAspectRatio () const noexcept
 Get window aspect ratio.
 
glm::ivec2 getBufferDimensions ()
 Get main framebuffer dimensions.
 
void setShouldClose (bool can_close=true)
 Tell the window to close.
 
bool canRun () const
 Check if nothing prevented the window to close.
 
EventHandlergetEventHandler ()
 Get a reference to the event handler bound to this window.
 
const EventHandlergetEventHandler () const
 Get a const reference to the event handler bound to this window.
 
const std::string getClipboardContent ()
 Returns the contents of the system clipboard, if the content contains or is convertible to a UTF-8 encoded string.
 
void setClipboardContent (const std::string &contents)
 Set the contents of the system clipboard to the UTF-8 string.
 

Detailed Description

Window wrapper containing an Graphical context

Constructor & Destructor Documentation

◆ Window() [1/2]

oe::core::Window::Window ( const std::string &  title,
bool  is_visible = true 
)

Generate and open a fullscreen window.

Parameters
titlewindow title
is_visibleDoes the window is visible after creation

◆ Window() [2/2]

oe::core::Window::Window ( const glm::ivec2 &  dimensions,
const std::string &  title,
bool  is_visible = true 
)

Generate and open a new window.

Parameters
dimensionswindow dimensions
titlewindow title
is_visibleDoes the window is visible after creation

Member Function Documentation

◆ blink()

void oe::core::Window::blink ( )

Make the window blink to get user attention.

Note
actual effect depends between platforms, but a common effect is the blink of the window in taskbar

◆ endRender()

void oe::core::Window::endRender ( )

End framebuffer rendering.

Note
buffer will be swapped after this function is called

◆ getClipboardContent()

const std::string oe::core::Window::getClipboardContent ( )

Returns the contents of the system clipboard, if the content contains or is convertible to a UTF-8 encoded string.

Returns
Cliboard content or an empty string if its content isn't convertible to a string

◆ getCursorPosition()

glm::vec2 oe::core::Window::getCursorPosition ( const bool &  absolute = false)

Get cursor position relative to the window or screen.

Parameters
absoluteSet to true set get screen coordinates

◆ lockCursor()

void oe::core::Window::lockCursor ( )

Hide cursor and lock it at window center.

Note
use this function if you need camera controls with cursor (for example: Making a FPS Camera control)

◆ setClipboardContent()

void oe::core::Window::setClipboardContent ( const std::string &  contents)

Set the contents of the system clipboard to the UTF-8 string.

Parameters
contentsstring to sent to the clipboard

◆ setTitle()

void oe::core::Window::setTitle ( const std::string &  title)

Set window title.

Parameters
titlewindow title

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