Cursor - Horizon-NTH/HorizonGUI GitHub Wiki
The Cursor
class in the hgui::kernel
namespace is designed to work with GLFW Cursors.
It allows you to set and customize the mouse cursor appearance for your graphical user interface.
This class offers the flexibility to use standard system cursors or create custom cursors with specific images
and click positions. The class should be used within a graphical application with an active OpenGL context.
The class can be found in the header file Cursor.h
.
-
explicit Cursor(cursors standardCursor)
: Constructs aCursor
object using a standard cursor. -
Cursor(const std::shared_ptr<Image>& customCursor, const point& clickPosition)
: Constructs aCursor
object using a custom cursor image and click position.
-
GLFWcursor* get_cursor_ptr() const
: Retrieves the pointer to the GLFW cursor object. -
cursors get_type() const
: Retrieves the type of the cursor. -
void make_custom_cursor(const std::shared_ptr<Image>& customCursor, const point& clickPosition)
: Change the cursor to a custom cursor using the specified image and click position. -
void make_standard_cursor(cursors standardCursor)
: Change the cursor to a standard cursor type.
#include <hgui/header/Cursor.h>
// Example Usage of Cursor class
hgui::kernel::Cursor cursor(hgui::cursors::ARROW);
// Use the cursor
cursor.use();
// Example Usage of Cursor class with a custom cursor
std::shared_ptr<hgui::Image> customCursor = /* initialize custom cursor image */;
hgui::point clickPosition = /* set click position */;
hgui::kernel::Cursor cursor(customCursor, clickPosition);
// Use the custom cursor
Note: In the "Example Usage" section, you can create a
Cursor
object with either a standard cursor type or a custom cursor image.