Interface ID: IID_IMoaDrCursor
Pointer type: PIMoaDrCursor
Inheritance: IMoaUnknown
Header file: driservc.h
IMoaDrCursor interface consists of a single method, which
lets Xtras set animated cursors or static cursors on Sprites or the Stage.
The syntax in this file is C++ style.
- SetSpriteCursor(MoaDrSpriteChanIndex spriteNum,
- MoaDrCursorID cursorID,
- PMoaDrCMRef pCursorBitmap,
- PMoaDrCMRef pCursorMask)
spriteNumMoaDrSpriteChanIndex The sprite channel number of the sprite whose cursor you wish to set. A value of 0 indicates setting the stage cursorcursorIDMoaDrCursorID One of the built in types or a resource ID. The built in cursors are as follows:#define kMoaDrCursor_Arrow -1 #define kMoaDrCursor_Default 0 #define kMoaDrCursor_IBeam 1 #define kMoaDrCursor_Crosshair 2 #define kMoaDrCursor_Crossbar 3 #define kMoaDrCursor_Watch 4 #define kMoaDrCursor_Finger 280 typedef MoaLong MoaDrCursorID;
pCursorBitmapPMoaDrCMRef The CMRef of a cast member (either a 1-bit bitmap or a Cursor Xtra asset) to be used as the sprite cursorpCursorMaskPMoaDrCMRef An optional 1-bit mask bitmap (used only with a 1-bit bitmap cursor)MoaError
PIMoaDrSpriteCallback pDrSpriteCallback = NULL;
PIMoaDrCursor pDrCursor = NULL;
MoaDrCursorID cursorID = kMoaDrCursor_Arrow;
MoaDrSpriteChanIndex spriteChanIndex = 0; /* our own sprite channel index */
/* fpSpriteCallback was saved earlier as an instance variable.
/ First get the DrSpriteCallback and find out what your sprite channel index is. */
pObj->fpSpriteCallback->QueryInterface(&IID_IMoaDrSpriteCallback, (PPMoaVoid)&pDrSpriteCallback);
if(pDrSpriteCallback)
pDrSpriteCallback->GetSpriteChanIndex(&spriteChanIndex);
pObj->pCallback->QueryInterface(&IID(IMoaDrCursor), (PPMoaVoid)&pDrCursor);
if ( foo == 1 ) /* whatever :) */
// Set the Arrow cursor
cursorID = kMoaDrCursor_Arrow;
else
// Set the I-Beam cursor
cursorID = kMoaDrCursor_IBeam;
/* Set the sprite cursor of your own sprite to the appropriate type, determined above.
/ Don't do this if no sprite was returned because we don't want to set the stage cursor
/ ( 0 as the sprite channel means set the stage cursor) */
if(pDrCursor & spriteChanIndex)
pDrCursor->SetSpriteCursor(spriteChanIndex, cursorID, NULL, NULL);