Cursor Object class.
More...
|
| bool | info (Sint32 iMode=0) override |
| | Request Cursor object information.
|
| const string & | getName () const override |
| | Get the name.
|
| Uint32 | getID () const override |
| | Get the ID.
|
| Sint32 | assignImage (Sint32 idImage, Sint32 iOwnership=0) |
| | Assign an Image to this cursor.
|
| Sint32 | getImage () const |
| | Get the assigned Image of this cursor.
|
| Sint32 | build () |
| | Build the cursor.
|
| bool | setHotSpot (const Position &posHotX, const Position &posHotY) |
| | Set the cursor hotspots.
|
| bool | getHotSpot (Sint32 *iHotX, Sint32 *iHotY) |
| | Get the cursor hotspots.
|
| Sint32 | save (const string &sCDCFile, const string &sResourceName="") |
| | Save the cursor to a CDC file.
|
| Sint32 | save (const Sint32 idCDC, const string &sResourceName="") |
| | Save the cursor to a CDC file.
|
◆ info()
| bool CRM64Pro::Cursor::info |
( |
Sint32 | iMode = 0 | ) |
|
|
override |
Request Cursor object information.
Writes information to the default log.
- Parameters
-
| iMode | unused for the time being. |
- Returns
- true on success, or false on failure.
◆ getName()
| const string & CRM64Pro::Cursor::getName |
( |
| ) |
const |
|
override |
Get the name.
- Returns
- The object name.
◆ getID()
| Uint32 CRM64Pro::Cursor::getID |
( |
| ) |
const |
|
override |
Get the ID.
- Returns
- Object ID.
◆ assignImage()
| Sint32 CRM64Pro::Cursor::assignImage |
( |
Sint32 | idImage, |
|
|
Sint32 | iOwnership = 0 ) |
Assign an Image to this cursor.
Used for associating an Image to cursors created via CursorMgr::create().
- Parameters
-
| idImage | Image id. |
| iOwnership | 0 (default) creates a copy; any other value takes ownership (image cannot be owned by another item). |
- Returns
- 0 on success, or a negative error code on failure.
- Note
- Image name is internally modified (prefixed with '#' + internal code + cursor name). Re-assigning closes the old image. SDL system cursors don't support image assignments.
◆ getImage()
| Sint32 CRM64Pro::Cursor::getImage |
( |
| ) |
const |
Get the assigned Image of this cursor.
- Returns
- greater than 0 on success, or a negative error code on failure.
◆ build()
| Sint32 CRM64Pro::Cursor::build |
( |
| ) |
|
Build the cursor.
If the assigned Image colorkey is modified, this method rebuilds the cursor. Other Image attributes (color/alpha modulation) have no effect on cursors.
- Returns
- 0 on success, or a negative error code on failure.
- Note
- Cursors are dynamically built when first selected. Use this method to build them in advance.
◆ setHotSpot()
| bool CRM64Pro::Cursor::setHotSpot |
( |
const Position & | posHotX, |
|
|
const Position & | posHotY ) |
Set the cursor hotspots.
- Parameters
-
| posHotX | Position with x hotspot. Can be absolute (float) or use ::PH_CENTER / ::PH_SIZE helpers. |
| posHotY | Position with y hotspot. Can be absolute (float) or use ::PH_CENTER / ::PH_SIZE helpers. |
- Returns
- true on success or false on failure.
- Note
- Hotspot of SDL system cursors can not be modified, they are fixed to (0,0).
-
Supports implicit conversion: setHotSpot(10.0f, 20.0f) or setHotSpot(Position(PH_CENTER), Position(PH_SIZE))
◆ getHotSpot()
| bool CRM64Pro::Cursor::getHotSpot |
( |
Sint32 * | iHotX, |
|
|
Sint32 * | iHotY ) |
Get the cursor hotspots.
- Parameters
-
| iHotX | an integer pointer filled in with x hotspot position of the cursor. If nullptr is passed, the method ignores the retrieving of this value. |
| iHotY | an integer pointer filled in with y hotspot position of the cursor. If nullptr is passed, the method ignores the retrieving of this value. |
- Returns
- true on success or false on failure.
- Note
- The mouse cursor position is internally updated in Main::update() each Logic Frame update.
◆ save() [1/2]
| Sint32 CRM64Pro::Cursor::save |
( |
const string & | sCDCFile, |
|
|
const string & | sResourceName = "" ) |
Save the cursor to a CDC file.
The associated image will also be saved to the same CDC file.
- Parameters
-
| sCDCFile | string containing [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
| sResourceName | Optional resource name to use in the CDC. If empty (default), uses the Cursor object's internal name. |
- Returns
- 0 or greater on success or a negative error code on failure.
- Note
- Existing cursor is overwritten. Cannot save child cursors or SDL system cursors.
◆ save() [2/2]
| Sint32 CRM64Pro::Cursor::save |
( |
const Sint32 | idCDC, |
|
|
const string & | sResourceName = "" ) |
Save the cursor to a CDC file.
The associated image will also be saved to the same CDC file.
- Parameters
-
| idCDC | CDC id. |
| sResourceName | Optional resource name to use in the CDC. If empty (default), uses the Cursor object's internal name. |
- Returns
- 0 or greater on success or a negative error code on failure.
- Note
- Existing cursor is overwritten. If a child, calls parent's save method. Cannot save SDL system cursors.