Nameless Engine
Loading...
Searching...
No Matches
ne::WindowCursor Class Reference

#include <Window.h>

Public Member Functions

 WindowCursor (const WindowCursor &)=delete
 
WindowCursoroperator= (const WindowCursor &)=delete
 
 ~WindowCursor ()
 

Protected Member Functions

void releaseCursor ()
 
GLFWcursor * getCursor () const
 

Static Protected Member Functions

static std::variant< std::unique_ptr< WindowCursor >, Errorcreate (const std::filesystem::path &pathToIcon)
 

Private Member Functions

 WindowCursor (GLFWcursor *pCursor)
 

Private Attributes

GLFWcursor * pCursor = nullptr
 

Friends

class Window
 

Detailed Description

Represents a custom window cursor.

Constructor & Destructor Documentation

◆ ~WindowCursor()

ne::WindowCursor::~WindowCursor ( )

Checks if the created cursor was released and if not, logs an error.

◆ WindowCursor()

ne::WindowCursor::WindowCursor ( GLFWcursor *  pCursor)
private

Initializes window cursor.

Parameters
pCursorCreated GLFW cursor.

Member Function Documentation

◆ create()

std::variant< std::unique_ptr< WindowCursor >, Error > ne::WindowCursor::create ( const std::filesystem::path &  pathToIcon)
staticprotected

Loads image and creates a new cursor.

Warning
This function must only be called from the main thread.
Remarks
You should call releaseCursor when you no longer need this cursor.
Parameters
pathToIconPath to the image (.png). The image data should be 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first.
Returns
Error if something went wrong, otherwise created cursor.

◆ getCursor()

GLFWcursor * ne::WindowCursor::getCursor ( ) const
protected

Returns internal GLFW cursor.

Returns
Internal GLFW cursor.

◆ releaseCursor()

void ne::WindowCursor::releaseCursor ( )
protected

Releases existing cursor.

Warning
This function must only be called from the main thread.

Member Data Documentation

◆ pCursor

GLFWcursor* ne::WindowCursor::pCursor = nullptr
private

Created GLFW cursor.


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