cgv
|
#include <gl_cursor.h>
Public Member Functions | |
gl_cursor () | |
construct empty gl_cursor instance | |
bool | is_created () const |
check whether cursor has been created | |
bool | create (const std::string &id="arrow") |
Create cursor from textual name of default cursor. More... | |
bool | create_from_file (const std::string &file_name) |
Create cursor from a file of type .cur or .ani. | |
unsigned | get_width () const |
return the width of the cursor | |
unsigned | get_height () const |
return the height of the cursor | |
int | get_hot_x () const |
return the x-coordinate of the hot spot of the cursor in local pixel coordinates | |
int | get_hot_y () const |
return the y-coordinate of the hot spot of the cursor in local pixel coordinates | |
void | set_hot_spot (int _x, int _y) |
set a new hot spot of the cursor in local pixel coordinates | |
unsigned | get_nr_steps () const |
return the number of animation steps | |
unsigned | get_nr_frames () const |
return the number of animation frames | |
unsigned | get_texture_id (unsigned frame_idx=0) const |
return the gl texture id of the given frame | |
unsigned | get_step_frame (unsigned step_idx) const |
return the frame index of given step | |
void | set_step_frame (unsigned step_idx, unsigned frame_idx) |
set the frame index of given step | |
unsigned | get_step_period (unsigned step_idx) const |
return the period of given step in 1/60th of a second | |
void | set_step_period (unsigned step_idx, unsigned period) |
return the period of given step in 1/60th of a second | |
void | append_step (unsigned frame_idx, unsigned period) |
append an animation step given by frame index and step period | |
unsigned | find_step_index (double elapsed_seconds) const |
find the step index of a given elapsed time in seconds | |
unsigned | get_frame_texture_id (int frame_idx) const |
return the gl texture id of the given frame | |
void | draw (int x, int y, bool use_color=false, unsigned frame_idx=0) |
draw the cursor at the given location More... | |
windows only implementation of functionality to create and draw an RGBA texture representing standard mouse cursor icons. This class is completely standalone and does not depend on any other file in the cgv framework.
bool cgv::render::gl::gl_cursor::create | ( | const std::string & | id = "arrow" | ) |
Create cursor from textual name of default cursor.
This can only be called when the opengl context is active in which this cursor is used. The return value tells whether the creation was successful. Possible values for the cursor id are:
void cgv::render::gl::gl_cursor::draw | ( | int | x, |
int | y, | ||
bool | use_color = false , |
||
unsigned | frame_idx = 0 |
||
) |
draw the cursor at the given location
The current opengl transformation must result in a scaling proportional to pixel coordinates. By default the texture color and alpha values are directly drawn to screen. If use_color
is set to true, color and alpha are multiplied with the currently set color.