CRM32Pro SDK  v5.22
List of all members | Public Member Functions | Friends
CRM32Pro_ICursor Class Reference

ICursor. More...

Detailed Description

ICursor.

Interface to manage cursor.

Public Member Functions

void AutoRestore (char value)
 Enable or disable auto background restore. More...
 
void ChangeType (char id, char type)
 Change the type of given cursor. More...
 
void ClipRegion (int xi, int yi, int xf, int yf)
 Define a valid clip region. More...
 
void Close (void)
 Close cursor system. More...
 
char Create (char *imgfile, char type=CTYPE_NORMAL)
 Create a new cursor from an external image file(BMP/PNG) More...
 
char Create (SDL_Surface *surf, char type=CTYPE_NORMAL)
 Create a new cursor from a given surface. More...
 
void Delete (char id)
 Delete a cursor. More...
 
void Hide (void)
 Hide current cursor. More...
 
void Info ()
 Print a lot of useful cursor interface information. Very useful for debugging purposes.
 
void Init (void)
 Initialize cursor system. More...
 
void Invalidate (void)
 When the background cursor will be changed, it invalidates current background restore and stores the new one. Call immediately after blit the new background.
 
char Load (char *fDPF, char *nameIPF, char type=CTYPE_NORMAL)
 Load a cursor from an IPF stored on a DPF(using a filename) More...
 
char Load (int idDPF, char *nameIPF, char type=CTYPE_NORMAL)
 Load a cursor from an IPF stored on a DPF(using an idDPF) More...
 
void Select (char id)
 Select a cursor and define it as current cursor. More...
 
void SetPosition (int x, int y)
 Set a new cursor position. More...
 
void SetSmooth (char value)
 Enable or disable smooth movement. More...
 
void Show (void)
 Show current cursor. More...
 

Friends

class CRM32Pro_CFont
 
class CRM32Pro_CSprite
 
class CRM32Pro_CTile
 
class CRM32Pro_IPrimitives
 
class CRM32Pro_Main
 

Member Function Documentation

void CRM32Pro_ICursor::AutoRestore ( char  value)

Enable or disable auto background restore.

This setting will override previous auto restore value.
If you used ACCEL_HARDSMOOTH(which will try to set a double-buffer) acceleration mode, it is disabled by default.
On other modes, is enabled by default.
So, if you are blitting and updating all your graphics stuff, you should disable the auto restore to avoid non-desidered effects and to help to improve the performance a little bit. OpenGL modes will disable this feature and avoid to enable it.

Parameters
value0 to disable auto restore, any value to enable it.
void CRM32Pro_ICursor::ChangeType ( char  id,
char  type 
)

Change the type of given cursor.

Parameters
idcursor id to change the type
typetype of cursor, by default is normal blit mode(See definition of CTYPE_xx)
Examples:
Example03_GUI.cpp.
void CRM32Pro_ICursor::ClipRegion ( int  xi,
int  yi,
int  xf,
int  yf 
)

Define a valid clip region.

Parameters
xicoordinate X from up-left corner of clip region
yicoordinate Y from up-left corner of clip region
xfcoordinate X from down-right corner of clip region
yfcoordinate Y from down-right corner of clip region
void CRM32Pro_ICursor::Close ( void  )

Close cursor system.

Give cursor control to SDL and free all created cursors

char CRM32Pro_ICursor::Create ( char *  filename,
char  type = CTYPE_NORMAL 
)

Create a new cursor from an external image file(BMP/PNG)

With both type image files,BMP and PNG, colorkey is always the RGB value of the pixel at (0,0) and alpha per-surface is always disabled.
But if the PNG has alpha per-pixel, it will use it.

Parameters
filenameImage file name, with its full path, containing the cursor
typetype of cursor, by default is normal blit mode(See definition of CTYPE_xx)
Returns
-1 Failed
any other value from 0 to 31, the cursor's ID
char CRM32Pro_ICursor::Create ( SDL_Surface *  surf,
char  type = CTYPE_NORMAL 
)

Create a new cursor from a given surface.

Alpha per surface with or without colorkey and alpha per pixel will be the same of the given surface.
If colorkey or alpha per pixel are not set, colorkey will be the RGB value of the pixel at (0,0).

Parameters
surfpointer to surface to create the cursor.
typetype of cursor, by default is normal blit mode(See definition of CTYPE_xx)
Returns
-1 Failed
any other value from 0 to 31, the cursor's ID
void CRM32Pro_ICursor::Delete ( char  id)

Delete a cursor.

Parameters
idcursor id to be deleted
Examples:
Example01_BasicCode.cpp, Example03_GUI.cpp, Example12_DRTS.cpp, and SpacePong.cpp.
void CRM32Pro_ICursor::Hide ( void  )

Hide current cursor.

It call to CRM32Pro.RenderNeeded() to enable the next render

Examples:
SpacePong.cpp.
void CRM32Pro_ICursor::Init ( void  )

Initialize cursor system.

It needs a valid CRM32Pro.screen. Take cursor control from SDL.
It activates autorestore with normal video modes but turn off with SDL_DOUBLEBUF.

Examples:
Example01_BasicCode.cpp, Example03_GUI.cpp, Example12_DRTS.cpp, and SpacePong.cpp.
char CRM32Pro_ICursor::Load ( char *  fDPF,
char *  nameIPF,
char  type = CTYPE_NORMAL 
)

Load a cursor from an IPF stored on a DPF(using a filename)

Alpha per surface with or without colorkey and alpha per pixel will be the same of the given IPF.
If colorkey and alpha per pixel are not set, colorkey will be the RGB value of the (0,0) surface position.

Parameters
fDPFDPF name to open and load image cursor
nameIPFimage name (IPF) to load as cursor
typetype of cursor, by default is normal blit mode(See definition of CTYPE_xx)
Returns
-1 Failed
any other value from 0 to 31, the cursor's ID
Examples:
Example01_BasicCode.cpp, Example03_GUI.cpp, Example12_DRTS.cpp, and SpacePong.cpp.
char CRM32Pro_ICursor::Load ( int  idDPF,
char *  nameIPF,
char  type = CTYPE_NORMAL 
)

Load a cursor from an IPF stored on a DPF(using an idDPF)

Alpha per surface with or without colorkey and alpha per pixel will be the same of the given IPF.
If colorkey and alpha per pixel are not set, colorkey will be the RGB value of the (0,0) surface position.

Parameters
idDPFID of the opened DPF
nameIPFimage name (IPF) to load as cursor
typetype of cursor, by default is normal blit mode(See definition of CTYPE_xx)
Returns
-1 Failed
any other value from 0 to 31, the cursor's ID
void CRM32Pro_ICursor::Select ( char  id)

Select a cursor and define it as current cursor.

Parameters
idcursor id to select as current
Examples:
Example01_BasicCode.cpp, Example03_GUI.cpp, Example12_DRTS.cpp, and SpacePong.cpp.
void CRM32Pro_ICursor::SetPosition ( int  x,
int  y 
)

Set a new cursor position.

Parameters
xdesired new x position
ydesired new y position
void CRM32Pro_ICursor::SetSmooth ( char  value)

Enable or disable smooth movement.

By default it is enabled.

Parameters
value0 to disable smooth movement, any value to enable it.
void CRM32Pro_ICursor::Show ( void  )

Show current cursor.

It call to CRM32Pro.RenderNeeded() to enable the next render

Examples:
SpacePong.cpp.

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