FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::Cursor Class Reference

#include <cursor.h>

Collaboration diagram for FIFE::Cursor:
Collaboration graph

Public Member Functions

 Cursor (RenderBackend *renderbackend)
 
virtual ~Cursor ()
 
virtual void draw ()
 
void set (uint32_t cursor_id=0)
 
void set (ImagePtr image)
 
void set (AnimationPtr anim)
 
void setDrag (ImagePtr image, int32_t drag_offset_x=0, int32_t drag_offset_y=0)
 
void setDrag (AnimationPtr anim, int32_t drag_offset_x=0, int32_t drag_offset_y=0)
 
void resetDrag ()
 
MouseCursorType getType () const
 
uint32_t getId () const
 
ImagePtr getImage ()
 
AnimationPtr getAnimation ()
 
MouseCursorType getDragType () const
 
ImagePtr getDragImage ()
 
AnimationPtr getDragAnimation ()
 
uint32_t getX () const
 
uint32_t getY () const
 
void setPosition (uint32_t x, uint32_t y)
 
void getPosition (int32_t *x, int32_t *y)
 

Protected Member Functions

void setNativeCursor (uint32_t cursor_id)
 
uint32_t getNativeId (uint32_t cursor_id)
 

Detailed Description

Cursor class manages mouse cursor handling

Definition at line 84 of file cursor.h.

Constructor & Destructor Documentation

FIFE::Cursor::Cursor ( RenderBackend renderbackend)

Constructor.

Definition at line 76 of file cursor.cpp.

References set().

virtual FIFE::Cursor::~Cursor ( )
inlinevirtual

Destructor.

Definition at line 92 of file cursor.h.

Member Function Documentation

void FIFE::Cursor::draw ( )
virtual
AnimationPtr FIFE::Cursor::getAnimation ( )
inline

Gets the current mouse animation

Definition at line 145 of file cursor.h.

AnimationPtr FIFE::Cursor::getDragAnimation ( )
inline

Gets the current mouse drag animation

Definition at line 157 of file cursor.h.

ImagePtr FIFE::Cursor::getDragImage ( )
inline

Gets the current mouse drag image

Definition at line 153 of file cursor.h.

MouseCursorType FIFE::Cursor::getDragType ( ) const
inline

Gets the current mouse cursor type

Definition at line 149 of file cursor.h.

uint32_t FIFE::Cursor::getId ( ) const
inline

Gets the current mouse cursor handle

Definition at line 137 of file cursor.h.

ImagePtr FIFE::Cursor::getImage ( )
inline

Gets the current mouse image

Definition at line 141 of file cursor.h.

uint32_t FIFE::Cursor::getNativeId ( uint32_t  cursor_id)
protected

To get some consistancy between platforms, this function checks if cursor_id matches any of the values in NativeCursor, and returns the resource ID specific to the running platform. If no match is found, cursor_id is returned.

Parameters
Oneof the values in NativeCursor

Definition at line 244 of file cursor.cpp.

Referenced by setNativeCursor().

Here is the caller graph for this function:

void FIFE::Cursor::getPosition ( int32_t *  x,
int32_t *  y 
)

Get the current mouse position

Definition at line 177 of file cursor.cpp.

MouseCursorType FIFE::Cursor::getType ( ) const
inline

Gets the current mouse cursor type

Definition at line 133 of file cursor.h.

uint32_t FIFE::Cursor::getX ( ) const
inline

Gets the current mouse x position

Definition at line 161 of file cursor.h.

uint32_t FIFE::Cursor::getY ( ) const
inline

Gets the current mouse y position

Definition at line 165 of file cursor.h.

void FIFE::Cursor::resetDrag ( )

Resets the cursor drag type to CURSOR_NONE

Definition at line 160 of file cursor.cpp.

References FIFE::SharedPtr< T >::reset().

void FIFE::Cursor::set ( uint32_t  cursor_id = 0)

Sets the current mouse cursor

Parameters
cursor_idFor native cursors, this is the resource id to native cursor, or one of the values in NativeCursor

Definition at line 95 of file cursor.cpp.

References FIFE::SharedPtr< T >::reset(), and setNativeCursor().

Referenced by Cursor(), and draw().

Here is the caller graph for this function:

void FIFE::Cursor::set ( ImagePtr  image)

Sets the current mouse cursor type to image

Parameters
imageImagePtr to a image used for the cursor

Definition at line 107 of file cursor.cpp.

References FIFE::SharedPtr< T >::reset().

void FIFE::Cursor::set ( AnimationPtr  anim)

Sets the current mouse cursor type to animation

Parameters
animAnimationPtr to a loaded animation used for the cursor

Definition at line 121 of file cursor.cpp.

References FIFE::TimeManager::getTime(), and FIFE::SharedPtr< T >::reset().

void FIFE::Cursor::setDrag ( ImagePtr  image,
int32_t  drag_offset_x = 0,
int32_t  drag_offset_y = 0 
)

Sets the current drag image cursor

Parameters
imageImagePtr to a image used for the drag
Note
to reset the cursors drag call cursor.setDrag(Cursor::CURSOR_NONE, 0, 0)

Definition at line 136 of file cursor.cpp.

References FIFE::SharedPtr< T >::reset().

void FIFE::Cursor::setDrag ( AnimationPtr  anim,
int32_t  drag_offset_x = 0,
int32_t  drag_offset_y = 0 
)

Sets the current drag animated cursor

Parameters
animAnimationPtr to a loaded animation used for the drag
Note
to reset the cursors drag call cursor.setDrag(Cursor::CURSOR_NONE, 0, 0)

Definition at line 147 of file cursor.cpp.

References FIFE::TimeManager::getTime(), and FIFE::SharedPtr< T >::reset().

void FIFE::Cursor::setNativeCursor ( uint32_t  cursor_id)
protected

Sets the cursor to a native type.

Parameters
cursor_idResource id to native cursor, or one of the values in NativeCursor

Definition at line 332 of file cursor.cpp.

References getNativeId().

Referenced by set().

Here is the caller graph for this function:

void FIFE::Cursor::setPosition ( uint32_t  x,
uint32_t  y 
)

Set the mouse position

Parameters
x,yThe new position in screen coordinates

Definition at line 171 of file cursor.cpp.


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