Public Member Functions | Friends

CRM32Pro_ICursor Class Reference
[MODULE 6: ICursor v2.82, manage cursor actions.]

ICursor. More...


Detailed Description

ICursor.

Interface to manage cursor.

List of all members.

Public Member Functions

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

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:
value 0 to disable auto restore, any value to enable it.
void CRM32Pro_ICursor::ChangeType ( char  id,
char  type 
)

Change the type of given cursor.

Parameters:
id cursor id to change the type
type type 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:
xi coordinate X from up-left corner of clip region
yi coordinate Y from up-left corner of clip region
xf coordinate X from down-right corner of clip region
yf coordinate 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 ( 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:
surf pointer to surface to create the cursor.
type type 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 ( 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:
filename Image file name, with its full path, containing the cursor
type type 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:
id cursor 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:
fDPF DPF name to open and load image cursor
nameIPF image name (IPF) to load as cursor
type type 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:
idDPF ID of the opened DPF
nameIPF image name (IPF) to load as cursor
type type 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:
id cursor 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:
x desired new x position
y desired new y position
void CRM32Pro_ICursor::SetSmooth ( char  value  ) 

Enable or disable smooth movement.

By default it is enabled.

Parameters:
value 0 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:
 All Classes Functions Variables