![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <Window.hpp>
Classes | |
struct | Settings |
Public Types | |
enum | DisplayMode { DisplayMode::Windowed, DisplayMode::Borderless, DisplayMode::Fullscreen } |
![]() | |
enum | { ColorBit = 1, DepthBit = 1 << 1, StencilBit = 1 << 2, AllBit = ColorBit | DepthBit | StencilBit } |
Public Member Functions | |
Window () | |
Default constructor. More... | |
Window (const Settings &settings) | |
Overloaded constructor. More... | |
~Window () override | |
Destructor. More... | |
void | preUpdate (const float deltaTime) override |
Pre-update. More... | |
void | postUpdate (const float deltaTime) override |
Post-update. More... | |
void | draw () override |
Draw. More... | |
bool | bind () const override |
Bind this render target for drawing. More... | |
void | open (const Settings &settings) |
Open this window. More... | |
void | close () |
Close and destroy this window. More... | |
bool | isOpen () const |
Check if this window is open. More... | |
template<typename T , typename... Args> | |
T & | setEventHandler (Args &&...args) |
Set the event handler. More... | |
void | setDefaultEventHandler () |
Set the default handler. More... | |
WindowEventHandler * | getEventHandler () |
Get the event handler. More... | |
void | removeEventHandler () |
Remove and delete the event handler. More... | |
WindowLibHandle | getLibraryHandle () |
Get the window library handle handle. More... | |
WindowHandle | getNativeHandle () |
Get the native window handle. More... | |
void | setMouseMode (const Mouse::Mode mode) |
Set the mouse mode. More... | |
void | setPosition (const int x, const int y) |
Set the window position. More... | |
glm::ivec2 | getPosition () const |
Get the window position. More... | |
void | setSize (const int width, const int height) |
Set the window size. More... | |
glm::uvec2 | getSize () const override |
Get the size of the window. More... | |
![]() | |
RenderTarget () | |
Constructor. More... | |
virtual | ~RenderTarget ()=0 |
Virtual destructor. More... | |
void | clear (const unsigned int bits) |
Clear the selected buffers. More... | |
RenderTarget & | setClearColor (const Color &color) |
Set the clear color. More... | |
Color | getClearColor () const |
Get the clear color. More... | |
RenderTarget & | setClearDepth (const float depth) |
Set the clear depth. More... | |
float | getClearDepth () const |
Get the clear depth value. More... | |
RenderTarget & | setClearStencil (const int stencil) |
Set the clear stencil. More... | |
int | getClearStencil () const |
Get the clear stencil value. More... | |
![]() | |
Subsystem (const uint32 ID) | |
Constructor. More... | |
virtual | ~Subsystem ()=0 |
Virtual destructor. More... | |
Message::Result | sendMessage (const Message &message) |
Function to handle messages. More... | |
Subsystem & | setActive (const bool active) |
Set this sub system active. More... | |
bool | isActive () const |
Check if this sub system is active. More... | |
uint32 | getID () const |
Get the ID. More... | |
Static Public Member Functions | |
static void | pollEvents () |
Poll the events of all open windows. More... | |
Additional Inherited Members | |
![]() | |
std::recursive_mutex | m_mutex |
Mutex. More... | |
Definition at line 68 of file Window/Window.hpp.
|
strong |
Display modes
Enumerator | |
---|---|
Windowed |
Windowed with decorations. |
Borderless |
Windowed without decorations. |
Fullscreen |
Full screen. |
Definition at line 80 of file Window/Window.hpp.
jop::Window::Window | ( | ) |
Default constructor.
Does not open a window.
jop::Window::Window | ( | const Settings & | settings | ) |
Overloaded constructor.
Calls open() using the given settings.
settings | The window settings |
|
override |
Destructor.
|
overridevirtual |
void jop::Window::close | ( | ) |
Close and destroy this window.
If no window is open, this does nothing.
|
overridevirtual |
Draw.
This simply swaps the OpenGL buffers and displays the current back buffer.
Reimplemented from jop::Subsystem.
WindowEventHandler* jop::Window::getEventHandler | ( | ) |
Get the event handler.
WindowLibHandle jop::Window::getLibraryHandle | ( | ) |
Get the window library handle handle.
On desktop operating systems this is GLFWwindow*.
WindowHandle jop::Window::getNativeHandle | ( | ) |
Get the native window handle.
glm::ivec2 jop::Window::getPosition | ( | ) | const |
Get the window position.
|
overridevirtual |
Get the size of the window.
This is the size of the window's frame buffer.
Implements jop::RenderTarget.
bool jop::Window::isOpen | ( | ) | const |
Check if this window is open.
void jop::Window::open | ( | const Settings & | settings | ) |
Open this window.
This will create a new window. If one already exists, it will be replaced.
settings | The window settings |
|
static |
Poll the events of all open windows.
This will poll all events and invoke the appropriate callbacks.
|
overridevirtual |
|
overridevirtual |
Pre-update.
This will simply set an internal boolean flag so we know when a new frame has begun.
Reimplemented from jop::Subsystem.
void jop::Window::removeEventHandler | ( | ) |
Remove and delete the event handler.
After this call, there won't be a valid event handler.
void jop::Window::setDefaultEventHandler | ( | ) |
Set the default handler.
The default event handler has no functionality other than exiting the engine when the close button is clicked.
On android the default handler exits the engine when the "back" button is pressed.
T& jop::Window::setEventHandler | ( | Args &&... | args | ) |
Set the event handler.
This function will automatically pass a reference of this window into the handler's constructor.
args | The arguments to use with construction |
void jop::Window::setMouseMode | ( | const Mouse::Mode | mode | ) |
void jop::Window::setPosition | ( | const int | x, |
const int | y | ||
) |
Set the window position.
x | The X coordinate |
y | The Y coordinate |
void jop::Window::setSize | ( | const int | width, |
const int | height | ||
) |
Set the window size.
This will set the size of the client area.
width | New width |
height | New height |