CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::GLFWWindow Class Referencefinal

#include <CeresEngine/Platform/GLFW/GLFWWindow.hpp>

Inheritance diagram for CeresEngine::GLFWWindow:
CeresEngine::PlatformWindow

Classes

struct  DragState
 

Public Types

enum class  API { OpenGL , None }
 

Public Member Functions

 GLFWWindow (double width=800.0, double height=600.0, const String &title="Game Engine", API api=API::None)
 Create a new GLFW window.
 
 GLFWWindow (const GLFWWindow &)=delete
 
GLFWWindowoperator= (const GLFWWindow &)=delete
 
 ~GLFWWindow () final
 Destroys the GLFW window.
 
void activate () final
 
void deactivate () final
 
String getTitle () const final
 
void setTitle (const String &title) final
 
Vector2 getSize () const final
 
void resize (double width, double height) final
 
void close () final
 
bool isFullscreen () const final
 
void setFullscreen (bool fullscreen) final
 
double getScalingFactor () const final
 
GLFWwindowgetHandle () const
 
- Public Member Functions inherited from CeresEngine::PlatformWindow
 PlatformWindow (const PlatformWindowProperties &properties)
 
virtual ~PlatformWindow ()=default
 
void resize (const Vector2 size)
 Resizes the window.
 
void sendEvent (const AnyInputEvent &event)
 Sends a new event through the window.
 

Static Public Member Functions

static Vector< const char * > getVulkanInstanceExtensions ()
 
static GLFWWindowfromHandle (GLFWwindow *handle)
 Gets the GLFWWindow from the given GLFW handle.
 

Private Member Functions

void keyboardCallback (int key, int scancode, int action, int modifiers)
 A callback method called by GLFW when a keyboard button is pressed.
 
void charCallback (int unicodeChar)
 A callback method called by GLFW when a keyboard button is pressed and inputs text.
 
void mouseButtonCallback (int button, int action, int modifiers)
 A callback method called by GLFW when a mouse button is pressed.
 
void mousePositionCallback (double x, double y)
 A callback method called by GLFW when the mouse changes position.
 
void mouseScrollCallback (double x, double y)
 A callback method called by GLFW when the mouse scroll wheel position changes.
 

Private Attributes

GLFWwindowmWindow
 The GLFW window handle.
 
PlatformWindowProperties mProperties
 
String mTitle
 The window title.
 
HashMap< Button, DragStatemDragStates
 
ModifierButton mModifierButtons
 
InputState mState
 The.
 

Additional Inherited Members

- Public Attributes inherited from CeresEngine::PlatformWindow
const PlatformWindowPropertiesproperties
 Generates a hash for the provided type.
 
Event< void(PlatformWindow &, Vector2)> didResize
 A signal that gets dispatched whenever the window gets resized.
 
Event< void(PlatformWindow &)> didClose
 A signal that gets dispatched whenever the window gets closed.
 
Event< void(const AnyInputEvent &)> onEvent
 An event fired when any input event is received on the window.
 
Event< void(const KeyEvent &)> onKeyDown
 An event fired when a key down event is received.
 
Event< void(const KeyEvent &)> onKeyUp
 An event fired when a key up event is received.
 
Event< void(const MouseEvent &)> onMouseDown
 An event fired when a mouse down event is received.
 
Event< void(const MouseEvent &)> onMouseUp
 An event fired when a mouse up event is received.
 
Event< void(const MouseEvent &)> onMouseMove
 An event fired when a mouse move event is received.
 
Event< void(const MouseEvent &)> onMouseDrag
 An event fired when a mouse drag eent is received.
 
Event< void(const MouseEvent &)> onMouseScroll
 An event fired when a mouse scroll event is received.
 
Event< void(const TextEvent &)> onTextInput
 An event fired when a text input event is received.
 
Event< void(const Rect2 &newRect, const Rect2 &oldRect)> didChangeFrame
 
Event< bool()> windowShouldClose
 

Member Enumeration Documentation

◆ API

Enumerator
OpenGL 
None 

Constructor & Destructor Documentation

◆ GLFWWindow() [1/2]

CeresEngine::GLFWWindow::GLFWWindow ( double  width = 800.0,
double  height = 600.0,
const String title = "Game Engine",
API  api = API::None 
)
explicit

Create a new GLFW window.

Parameters
widthThe window initial width
heightThe window initial height
titleThe window initial title
apiThe graphics API to request to the system

◆ GLFWWindow() [2/2]

CeresEngine::GLFWWindow::GLFWWindow ( const GLFWWindow )
delete

◆ ~GLFWWindow()

CeresEngine::GLFWWindow::~GLFWWindow ( )
final

Destroys the GLFW window.

Member Function Documentation

◆ activate()

void CeresEngine::GLFWWindow::activate ( )
finalvirtual

◆ charCallback()

void CeresEngine::GLFWWindow::charCallback ( int  unicodeChar)
private

A callback method called by GLFW when a keyboard button is pressed and inputs text.

Parameters
unicodeCharThe character unicode.

◆ close()

void CeresEngine::GLFWWindow::close ( )
finalvirtual

◆ deactivate()

void CeresEngine::GLFWWindow::deactivate ( )
finalvirtual

◆ fromHandle()

static GLFWWindow * CeresEngine::GLFWWindow::fromHandle ( GLFWwindow handle)
static

Gets the GLFWWindow from the given GLFW handle.

Parameters
handleThe GLFW handle
Returns
The attached GLFWWindow object

◆ getHandle()

GLFWwindow * CeresEngine::GLFWWindow::getHandle ( ) const
Returns
The GLFW window handle

◆ getScalingFactor()

double CeresEngine::GLFWWindow::getScalingFactor ( ) const
finalvirtual

◆ getSize()

Vector2 CeresEngine::GLFWWindow::getSize ( ) const
finalvirtual

◆ getTitle()

String CeresEngine::GLFWWindow::getTitle ( ) const
finalvirtual

◆ getVulkanInstanceExtensions()

static Vector< const char * > CeresEngine::GLFWWindow::getVulkanInstanceExtensions ( )
static
Returns
A vector of required Vulkan instance extensions

◆ isFullscreen()

bool CeresEngine::GLFWWindow::isFullscreen ( ) const
finalvirtual

◆ keyboardCallback()

void CeresEngine::GLFWWindow::keyboardCallback ( int  key,
int  scancode,
int  action,
int  modifiers 
)
private

A callback method called by GLFW when a keyboard button is pressed.

Parameters
keyThe GLFW key code
scancodeThe operating system key scan code
actionThe key action (press, release or repeat)
modifiersThe modifiers pressed with the keys

◆ mouseButtonCallback()

void CeresEngine::GLFWWindow::mouseButtonCallback ( int  button,
int  action,
int  modifiers 
)
private

A callback method called by GLFW when a mouse button is pressed.

Parameters
buttonThe GLFW mouse button code
actionThe button action (press or release)
modifiersThe modifiers pressed with the buttons

◆ mousePositionCallback()

void CeresEngine::GLFWWindow::mousePositionCallback ( double  x,
double  y 
)
private

A callback method called by GLFW when the mouse changes position.

Parameters
xThe X coordinate
yThe Y coordinate

◆ mouseScrollCallback()

void CeresEngine::GLFWWindow::mouseScrollCallback ( double  x,
double  y 
)
private

A callback method called by GLFW when the mouse scroll wheel position changes.

Parameters
xThe X coordinate
yThe Y coordinate

◆ operator=()

GLFWWindow & CeresEngine::GLFWWindow::operator= ( const GLFWWindow )
delete

◆ resize()

void CeresEngine::GLFWWindow::resize ( double  width,
double  height 
)
finalvirtual

◆ setFullscreen()

void CeresEngine::GLFWWindow::setFullscreen ( bool  fullscreen)
finalvirtual

◆ setTitle()

void CeresEngine::GLFWWindow::setTitle ( const String title)
finalvirtual

Member Data Documentation

◆ mDragStates

HashMap<Button, DragState> CeresEngine::GLFWWindow::mDragStates
private

◆ mModifierButtons

ModifierButton CeresEngine::GLFWWindow::mModifierButtons
private

◆ mProperties

PlatformWindowProperties CeresEngine::GLFWWindow::mProperties
private

◆ mState

InputState CeresEngine::GLFWWindow::mState
private

The.

◆ mTitle

String CeresEngine::GLFWWindow::mTitle
private

The window title.

◆ mWindow

GLFWwindow* CeresEngine::GLFWWindow::mWindow
private

The GLFW window handle.


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