CRM32Pro SDK
v5.22
|
CRM32Pro. More...
CRM32Pro.
Main library interface.
Classes | |
struct | sConfig |
Main config struct. You can manually fill it or using CRM32Pro.LoadConfig() loading an external XML. More... | |
Public Member Functions | |
void | AudioInfo () |
Uses ILogSystem to dump audio subsystem information. | |
int | Blit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) |
Perform a fast blit from source surface to the destination surface. More... | |
void | CleanUp (void) |
Clean up update system to avoid events and timing propagation. More... | |
int | ConAddCmdHandler (char *cmdname, char *cmdhelp, int(*my_func)(vector< string > *)) |
Add a new command handler to the console. More... | |
void | ConCmd (char *) |
Send the given command to the console. More... | |
void | ConDisable () |
Disable the console. | |
void | ConEnable () |
Enable the console. | |
int | ConFeatures (int features=-1) |
Set/Get advance feature flags for the console system. More... | |
Uint8 | ConGetAlpha () |
Get the alpha value of the console. More... | |
Uint32 | ConGetBgColor () |
Get the background color of the console. More... | |
SDL_Surface * | ConGetBgImage () |
Get the background image of the console. More... | |
CRM32Pro_CFont * | ConGetFont () |
Get the font of the console. More... | |
SDL_Rect * | ConGetRect () |
Get the console rect. More... | |
Uint8 | ConisEnabled () |
Check if the console is enabled. More... | |
Sint8 | ConisVisible () |
Check if the console is visible. More... | |
void | ConMove (Sint16 x, Sint16 y) |
Move the console. More... | |
void | ConNewCmdLine () |
Output a CR/LF into the console. | |
void | ConPrint (char *format,...) |
Output a message into the console. More... | |
void | ConResize (Sint16 w, Sint16 h) |
Resize the console. More... | |
void | ConSetAlpha (Uint8 alpha) |
Set the alpha value for the console. More... | |
void | ConSetBgColor (Uint8 red, Uint8 green, Uint8 blue) |
Set the background color of the console. More... | |
void | ConSetBgColor (Uint32 rgb) |
Set the background color of the console. More... | |
void | ConSetBgImage (char *fileDPF, char *name) |
Set the background image for the console. More... | |
void | ConSetBgImage (int idDPF, char *name) |
Set the background image for the console. More... | |
void | ConSetFont (char *fileDPF, char *name) |
Set the font for the console. More... | |
void | ConSetFont (int idDPF, char *name) |
Set the font for the console. More... | |
void | ConSetVisible (Sint8 value) |
Set the visibility of the console. More... | |
void | ConTitle (char *) |
Set the console title. More... | |
void | ConvPrint (char *format, va_list args) |
Output a message into the console. More... | |
unsigned int | CRC32 (char *buffer, int Size) |
Calculate CRC32 of given buffer with given size. More... | |
unsigned int | CRC32 (char *filename) |
Calculate CRC32 of given file. More... | |
int | DwAddWatch (char *name, int *integervar, double *doublevar=NULL) |
Add a new var watch to the debug window. More... | |
void | DwDisable () |
Disable the debug window. | |
void | DwEnable () |
Enable the debug window. | |
Uint8 | DwGetAlpha () |
Get the alpha value of the debug window. More... | |
Uint32 | DwGetBgColor () |
Get the background color of the debug window. More... | |
SDL_Surface * | DwGetBgImage () |
Get the background image of the debug window. More... | |
CRM32Pro_CFont * | DwGetFont () |
Get the font of the debug window. More... | |
SDL_Rect * | DwGetRect () |
Get the debug window rect. More... | |
Uint8 | DwisEnabled () |
Check if the debug window is enabled. More... | |
Sint8 | DwisVisible () |
Check if the debug window is visible. More... | |
void | DwMove (Sint16 x, Sint16 y) |
Move the debug window. More... | |
int | DwRemoveWatch (char *name) |
Remove a watch from the debug window. More... | |
void | DwResize (Sint16 w, Sint16 h) |
Resize the debug window. More... | |
void | DwSetAlpha (Uint8 alpha) |
Set the alpha value for the debug window. More... | |
void | DwSetBgColor (Uint8 red, Uint8 green, Uint8 blue) |
Set the background color of the debug window. More... | |
void | DwSetBgColor (Uint32 rgb) |
Set the background color of the debug window. More... | |
void | DwSetBgImage (char *fileDPF, char *name) |
Set the background image for the debug window. More... | |
void | DwSetBgImage (int idDPF, char *name) |
Set the background image for the debug window. More... | |
void | DwSetFont (char *fileDPF, char *name) |
Set the font for the debug window. More... | |
void | DwSetFont (int idDPF, char *name) |
Set the font for the debug window. More... | |
void | DwSetVisible (Sint8 value) |
Set the visibility of the debug window. More... | |
void | DwTitle (char *) |
Set the debug window title. More... | |
void | FreeSurface (SDL_Surface *&) |
Frees a SDL_Surface. More... | |
char * | GetCopyright () |
Get copyright string. | |
char * | GetKeyName (int iKey) |
Return the name of the pressed key using a single character. More... | |
int | GetKeyPressed (int iDelay=SDL_DEFAULT_REPEAT_DELAY) |
Return the first pressed key found. More... | |
int | GetKeystate (int keysym) |
Get current state of the given key. More... | |
float | GetLogicTime () |
Get current logic time. More... | |
char * | GetVersion () |
Get version string. | |
int | Init (unsigned int flags) |
Initialize all internal systems. More... | |
int | IsGL () |
Check if glSDL is enabled and running. More... | |
int | IsRenderNeeded () |
Query to the engine if a full render is needed on the client side. More... | |
int | IsTexture (SDL_Surface *surf) |
Check if the given surface is an OpenGL texture. More... | |
int | LoadConfig (char *fileDPF, char *fileXML, sConfig *conf=NULL) |
Load the config stored on given XML. More... | |
int | MakeDirectory (char *fullpath) |
Create a directory. More... | |
void | PrintVersion () |
Print version and compiled date to log system(ILogSystem) | |
void | Quit (void) |
Close all internal systems. More... | |
Uint32 | Rand () |
Generates a random 32bits integer. More... | |
double | RandReal () |
Generates a random 64bits real number. More... | |
void | RandSeed (unsigned int seed) |
Initializes random number generator with a seed. More... | |
void | RenderNeeded (int bMode=UPDATEFRAME_NEXT) |
Change the way the render engine works. More... | |
int | RequireVersion (int iMajor, int iMinor) |
Check given version against library version. More... | |
int | SaveConfig (char *fileDPF, char *fileXML, sConfig *conf=NULL) |
Save the given config to a DPF/XML. More... | |
void | SetRenderCallback (void(*myRenderFunc)(int bLogicUpdate)) |
Set a callback function to blit your graphics at Rendering Frame Rate. More... | |
int | SetVideoMode (void) |
Setup selected video mode given by Config struct. More... | |
int | Surface2Texture (SDL_Surface *surf) |
Convert a surface into a texture. For OpenGL modes (glSDL). More... | |
int | SurfaceAutomaticConversion (int) |
Manage surface automatic conversion of all CRM32Pro subsystems. More... | |
void | SurfaceInfo (SDL_Surface *surface) |
Uses ILogSystem to dump surface information. More... | |
int | Update (SDL_Event *ev=NULL) |
Update all systems: graphics,events,timing... More... | |
void | VideoInfo () |
Uses ILogSystem to dump video subsystem information. | |
int | XMLAttributeGet (int id, char *name, char **value) |
Get the string value of the given attribute. More... | |
int | XMLAttributeGet (int id, char *name, int *value) |
Get the integer value of the given attribute. More... | |
int | XMLAttributeGet (int id, char *name, double *value) |
Get the double value of the given attribute. More... | |
int | XMLAttributeRemove (int id, char *name) |
Remove an attribute. More... | |
int | XMLAttributeSet (int id, char *name, char *value) |
Set a string value of a given attribute. If that attribute does not exist, a new one is created. More... | |
int | XMLAttributeSet (int id, char *name, int value) |
Set an integer value of a given attribute. If that attribute does not exist, a new one is created. More... | |
int | XMLAttributeSet (int id, char *name, double value) |
Set a double value of a given attribute. If that attribute does not exist, a new one is created. More... | |
void | XMLClose (int id) |
Close a given XML. More... | |
char * | XMLCommentGet (int id) |
Return the first comment of current node(if any) More... | |
int | XMLCommentRemove (int id) |
Remove the first comment contained on current node. More... | |
int | XMLCommentSet (int id, char *value) |
Add a new comment to current node. More... | |
int | XMLCreate (char *mainnode) |
Create a new XML document. More... | |
int | XMLNodeChild (int id) |
Point to the first child node of the XML. More... | |
int | XMLNodeCreate (int id, char *name) |
Create a new node on current pointer and set it as new current. More... | |
int | XMLNodeFirst (int id) |
Point to the first node of the XML (the root node). More... | |
char * | XMLNodeGetName (int id) |
Get the name of current node. More... | |
int | XMLNodeNext (int id) |
Point to the next node of the XML. More... | |
int | XMLNodeParent (int id) |
Point to the parent node of the XML. More... | |
int | XMLNodePointTo (int id, int nparam, char *,...) |
Search and point to a given node or subnode of any level. More... | |
int | XMLNodePrev (int id) |
Point to the previous node of the XML. More... | |
int | XMLNodeRemove (int id) |
Remove current node pointed to and all its nodes and attributes. More... | |
int | XMLNodeRename (int id, char *name) |
Rename current node pointed to. More... | |
int | XMLNodeRestore (int id) |
Restore previously stored node pointer position. More... | |
int | XMLNodeStore (int id) |
Store internally current node pointer position. More... | |
int | XMLOpen (char *filename) |
Open a XML file. More... | |
int | XMLOpen (char *fileDPF, char *blockname) |
Open a XML file stored on a DPF(using filename) More... | |
int | XMLOpen (int idDPF, char *blockname) |
Open a XML file stored on a DPF(idDPF) More... | |
int | XMLSave (int id, char *filename) |
Save a given XML to external file. More... | |
int | XMLSave (int id, char *fileDPF, char *blockname) |
Save a given XML to a DPF(using filename) More... | |
int | XMLSave (int id, int idDPF, char *blockname) |
Save a given XML to a DPF(using idDPF) More... | |
char * | XMLTextGet (int id) |
Return text contained on current node. More... | |
int | XMLTextRemove (int id) |
Remove text contained on current node. More... | |
int | XMLTextSet (int id, char *value) |
Add a new text to the existing text node(if any). More... | |
Public Attributes | |
Uint8 | iAutoSurfRecovery |
Flag to set on/off auto surface recovery.It is automatically setup in DirectX hardware mode. | |
Uint32 | iStartTime |
Store the start ticks(SDL_GetTicks()) when CRM32Pro was initialized. | |
Uint8 | mouse_buttons |
Current state of mouse's buttons. Updated automatically in CRM32Pro.Update(). Used as a mask when testing mouse buttons, usually as follow: -Left mouse button (CRM32PRO_BUTTON_LEFT) -Middle mouse button (CRM32PRO_BUTTON_MIDDLE) -Right mouse button (CRM32PRO_BUTTON_RIGHT) It also stores buttons combinations. | |
Uint8 | mouse_prevbuttons |
Previous state of mouse's buttons. Updated automatically in CRM32Pro.Update(). | |
int | mouse_x |
Mouse X position. Updated automatically. | |
int | mouse_y |
Mouse Y position. Updated automatically. | |
SDL_Surface * | screen |
Main screen surface. You always have to use it to blit your graphics. | |
int CRM32Pro_Main::Blit | ( | SDL_Surface * | src, |
SDL_Rect * | srcrect, | ||
SDL_Surface * | dst, | ||
SDL_Rect * | dstrect | ||
) |
Perform a fast blit from source surface to the destination surface.
It can be used instead of SDL_BlitSurface() when your destination surface is CRM32Pro.screen as it supports built-in cursor system.
src | source surface. |
srcrect | pointer to source rect or NULL to copy the entire surface. |
dst | destination surface. |
dstrect | pointer to destination rect or NULL to copy at (0,0). |
void CRM32Pro_Main::CleanUp | ( | void | ) |
Clean up update system to avoid events and timing propagation.
A good habit is to call it after SetRenderCallback() method and before to enter the loop where CRM32Pro.Update() is called
int CRM32Pro_Main::ConAddCmdHandler | ( | char * | cmdname, |
char * | cmdhelp, | ||
int(*)(vector< string > *) | my_func | ||
) |
Add a new command handler to the console.
cmdname | Command name |
cmdhelp | Command help or brief description |
my_func | Pointer to your handler. It must accept a pointer to a vector<string> where the parameters will be allocated. It must return 1 if the parameters were Ok, otherwise it must return 0. |
void CRM32Pro_Main::ConCmd | ( | char * | scmd | ) |
Send the given command to the console.
If the command exists, it will be processed as it was written in the console
scmd | Command with optional parameters to be processed |
int CRM32Pro_Main::ConFeatures | ( | int | newfeatures = -1 | ) |
Set/Get advance feature flags for the console system.
Check CONFEATURE_x defines to know which features are currently supported.
To avoid to modify any current flag and just get the current ones, use the value of -1 (default value)
newfeatures | Integer with desired flags enabled. It performs a XOR so trying to enable an already enabled flag will disable it. |
Uint8 CRM32Pro_Main::ConGetAlpha | ( | ) |
Get the alpha value of the console.
Uint32 CRM32Pro_Main::ConGetBgColor | ( | ) |
Get the background color of the console.
SDL_Surface * CRM32Pro_Main::ConGetBgImage | ( | ) |
Get the background image of the console.
CRM32Pro_CFont * CRM32Pro_Main::ConGetFont | ( | ) |
Get the font of the console.
SDL_Rect * CRM32Pro_Main::ConGetRect | ( | ) |
Get the console rect.
Uint8 CRM32Pro_Main::ConisEnabled | ( | ) |
Check if the console is enabled.
Sint8 CRM32Pro_Main::ConisVisible | ( | ) |
Check if the console is visible.
void CRM32Pro_Main::ConMove | ( | Sint16 | x, |
Sint16 | y | ||
) |
Move the console.
x | new x position on screen |
y | new y position on screen |
void CRM32Pro_Main::ConPrint | ( | char * | format, |
... | |||
) |
Output a message into the console.
format | format parameter as printf function |
void CRM32Pro_Main::ConResize | ( | Sint16 | w, |
Sint16 | h | ||
) |
Resize the console.
w | width of the console. Minimum of 150 |
h | height of the console. Minimum of 100 |
void CRM32Pro_Main::ConSetAlpha | ( | Uint8 | alpha | ) |
Set the alpha value for the console.
alpha | a value ranging from 64 (almost-transparent) to 255 (full-opaque) |
void CRM32Pro_Main::ConSetBgColor | ( | Uint8 | red, |
Uint8 | green, | ||
Uint8 | blue | ||
) |
Set the background color of the console.
red | Red component value(0-255) |
green | Green component value(0-255) |
blue | Blue component value(0-255) |
void CRM32Pro_Main::ConSetBgColor | ( | Uint32 | rgb | ) |
Set the background color of the console.
rgb | Uin32 with the red,green and blue components |
void CRM32Pro_Main::ConSetBgImage | ( | char * | fileDPF, |
char * | name | ||
) |
Set the background image for the console.
fileDPF | DPF filename that contains the image |
name | name of the image stored on the DPF |
void CRM32Pro_Main::ConSetBgImage | ( | int | idDPF, |
char * | name | ||
) |
Set the background image for the console.
idDPF | valid idDPF that contains the image |
name | name of the image stored on the DPF |
void CRM32Pro_Main::ConSetFont | ( | char * | fileDPF, |
char * | name | ||
) |
Set the font for the console.
fileDPF | DPF filename that contains the font |
name | name of the font stored on the DPF |
void CRM32Pro_Main::ConSetFont | ( | int | idDPF, |
char * | name | ||
) |
Set the font for the console.
idDPF | valid idDPF that contains the font |
name | name of the font stored on the DPF |
void CRM32Pro_Main::ConSetVisible | ( | Sint8 | value | ) |
Set the visibility of the console.
This will cause the rendering of the console. It must be enabled first.
value | 0 hide the console or 1 to show it |
void CRM32Pro_Main::ConTitle | ( | char * | title | ) |
Set the console title.
In order to override the default title, call this method before ConEnable().
title | pointer to the title string |
void CRM32Pro_Main::ConvPrint | ( | char * | format, |
va_list | args | ||
) |
Output a message into the console.
format | pointer to string with format parameters. Same as printf() function |
args | pointer to the va_list. Same as vprintf() function |
unsigned int CRM32Pro_Main::CRC32 | ( | char * | buffer, |
int | size | ||
) |
Calculate CRC32 of given buffer with given size.
buffer | pointer to buffer to calculate its CRC32 |
size | size in bytes of given buffer |
unsigned int CRM32Pro_Main::CRC32 | ( | char * | fname | ) |
Calculate CRC32 of given file.
fname | path and filename of the file to calculate its CRC32 |
int CRM32Pro_Main::DwAddWatch | ( | char * | name, |
int * | integervar, | ||
double * | doublevar = NULL |
||
) |
Add a new var watch to the debug window.
name | A pointer to the name of the watch. It will works also as an identifier. |
integervar | A pointer to an integer var |
doublevar | A pointer to a double var |
Uint8 CRM32Pro_Main::DwGetAlpha | ( | ) |
Get the alpha value of the debug window.
Uint32 CRM32Pro_Main::DwGetBgColor | ( | ) |
Get the background color of the debug window.
SDL_Surface * CRM32Pro_Main::DwGetBgImage | ( | ) |
Get the background image of the debug window.
CRM32Pro_CFont * CRM32Pro_Main::DwGetFont | ( | ) |
Get the font of the debug window.
SDL_Rect * CRM32Pro_Main::DwGetRect | ( | ) |
Get the debug window rect.
Uint8 CRM32Pro_Main::DwisEnabled | ( | ) |
Check if the debug window is enabled.
Sint8 CRM32Pro_Main::DwisVisible | ( | ) |
Check if the debug window is visible.
void CRM32Pro_Main::DwMove | ( | Sint16 | x, |
Sint16 | y | ||
) |
Move the debug window.
x | new x position on screen |
y | new y position on screen |
int CRM32Pro_Main::DwRemoveWatch | ( | char * | name | ) |
Remove a watch from the debug window.
name | A pointer to the name of the watch. |
void CRM32Pro_Main::DwResize | ( | Sint16 | w, |
Sint16 | h | ||
) |
Resize the debug window.
w | width of the debug window. Minimum of 150 |
h | height of the debug window. Minimum of 150 |
void CRM32Pro_Main::DwSetAlpha | ( | Uint8 | alpha | ) |
Set the alpha value for the debug window.
alpha | a value ranging from 64 (almost-transparent) to 255 (full-opaque) |
void CRM32Pro_Main::DwSetBgColor | ( | Uint8 | red, |
Uint8 | green, | ||
Uint8 | blue | ||
) |
Set the background color of the debug window.
red | Red component value(0-255) |
green | Green component value(0-255) |
blue | Blue component value(0-255) |
void CRM32Pro_Main::DwSetBgColor | ( | Uint32 | rgb | ) |
Set the background color of the debug window.
rgb | Uin32 with the red,green and blue components |
void CRM32Pro_Main::DwSetBgImage | ( | char * | fileDPF, |
char * | name | ||
) |
Set the background image for the debug window.
fileDPF | DPF filename that contains the image |
name | name of the image stored on the DPF |
void CRM32Pro_Main::DwSetBgImage | ( | int | idDPF, |
char * | name | ||
) |
Set the background image for the debug window.
idDPF | valid idDPF that contains the image |
name | name of the image stored on the DPF |
void CRM32Pro_Main::DwSetFont | ( | char * | fileDPF, |
char * | name | ||
) |
Set the font for the debug window.
fileDPF | DPF filename that contains the font |
name | name of the font stored on the DPF |
void CRM32Pro_Main::DwSetFont | ( | int | idDPF, |
char * | name | ||
) |
Set the font for the debug window.
idDPF | valid idDPF that contains the font |
name | name of the font stored on the DPF |
void CRM32Pro_Main::DwSetVisible | ( | Sint8 | value | ) |
Set the visibility of the debug window.
This will cause the rendering of the debug window. It must be enabled first.
value | 0 hide the debug window or 1 to show it |
void CRM32Pro_Main::DwTitle | ( | char * | title | ) |
Set the debug window title.
title | pointer to the title string |
void CRM32Pro_Main::FreeSurface | ( | SDL_Surface *& | srf | ) |
Frees a SDL_Surface.
Use it instead SDL_FreeSurface() to be informed of attempts to free a NULL surface.
srf | pointer to the surface to delete. |
char * CRM32Pro_Main::GetKeyName | ( | int | iKey | ) |
Return the name of the pressed key using a single character.
It improves a bit the output of SDL_GetKeyName() taking into account special characters and capital letters
In order to get proper output of some symbols (%,{, |, } and ~), capital letters and numeric keypad, is better to use together with the output of GetKeyPressed()
iKey | ASCII code of a key |
int CRM32Pro_Main::GetKeyPressed | ( | int | iDelay = SDL_DEFAULT_REPEAT_DELAY | ) |
Return the first pressed key found.
This method is also updated internally by Update() following the same way as GetKeystate().
It converts a pressed key to a plain format: shift+number, shift+character and numeric keypad are converted to the ASCII code
If no conversion is needed, it return the normal SDLK_xxx symbol. It checks from SDLK_BACKSPACE to SDLK_F15,
basically all the available key symbols on SDL.
iDelay | minimum delay in milliseconds to specify how long a key must be pressed before it repeats again. By default it is SDL_DEFAULT_REPEAT_DELAY |
int CRM32Pro_Main::GetKeystate | ( | int | keysym | ) |
Get current state of the given key.
Update() will automatically get a snapshot of the current keyboard state, and to access to that raw snapshot you can use this method.
keysym | Desired key to get its state. Use the SDLK_xxx symbols defined on SDL_keysym.h. |
float CRM32Pro_Main::GetLogicTime | ( | ) |
Get current logic time.
Internal setting.
int CRM32Pro_Main::Init | ( | unsigned int | flags | ) |
Initialize all internal systems.
It replaces to SDL_Init() although internally it does a call to SDL_Init(flags)
Select optimized path depending on the CPU.
int CRM32Pro_Main::IsGL | ( | ) |
Check if glSDL is enabled and running.
int CRM32Pro_Main::IsRenderNeeded | ( | ) |
Query to the engine if a full render is needed on the client side.
int CRM32Pro_Main::IsTexture | ( | SDL_Surface * | surf | ) |
Check if the given surface is an OpenGL texture.
surf | Surface to be checked |
int CRM32Pro_Main::LoadConfig | ( | char * | fileDPF, |
char * | fileXML, | ||
sConfig * | conf = NULL |
||
) |
Load the config stored on given XML.
fileDPF | DPF with the stored XML. NULL if it is not stored on a DPF(it is an external XML file). Supports optional paths. |
fileXML | External XML file name or name of the XML inside the DPF. Supports optional paths with the config settings. |
conf | Pointer to sConfig struct to store the settings. By default it is pointed to CRM32Pro.Config. |
int CRM32Pro_Main::MakeDirectory | ( | char * | fullpath | ) |
Create a directory.
It extract the path discarding the filename and extension.
Supports subdirectories using '\' or '/' as separators.
fullpath |
void CRM32Pro_Main::Quit | ( | void | ) |
Close all internal systems.
It replaces to SDL_Quit()
Uint32 CRM32Pro_Main::Rand | ( | ) |
Generates a random 32bits integer.
double CRM32Pro_Main::RandReal | ( | ) |
Generates a random 64bits real number.
void CRM32Pro_Main::RandSeed | ( | unsigned int | seed | ) |
Initializes random number generator with a seed.
seed | any unsigned integer from [0,4294967295] interval |
void CRM32Pro_Main::RenderNeeded | ( | int | bMode = UPDATEFRAME_NEXT | ) |
Change the way the render engine works.
Note that if the screen has SDL_DOUBLEBUFFER feature enabled, the render mode will be fixed to UPDATEFRAME_ALWAYS
bMode | UPDATEFRAME_NONE Disable previous mode and avoid to render next frame |
bMode | UPDATEFRAME_NEXT Enable the render of the next frame |
bMode | UPDATEFRAME_ALWAYS Disable previous mode and enable full render on all frames |
int CRM32Pro_Main::RequireVersion | ( | int | iMajor, |
int | iMinor | ||
) |
Check given version against library version.
iMajor | required major version |
iMinor | required minor version |
int CRM32Pro_Main::SaveConfig | ( | char * | fileDPF, |
char * | fileXML, | ||
sConfig * | conf = NULL |
||
) |
Save the given config to a DPF/XML.
fileDPF | DPF filename to store the XML. NULL if it will store on an external XML file. Supports optional paths. |
fileXML | External XML file name or name of the XML to be stored on a DPF. Supports optional paths with the config settings. |
conf | Pointer to sConfig struct to read its settings. By default it is pointed to CRM32Pro.Config. |
void CRM32Pro_Main::SetRenderCallback | ( | void(*)(int bLogicUpdate) | myRenderFunc | ) |
Set a callback function to blit your graphics at Rendering Frame Rate.
Use NULL if you want to remove a previous callback function.
Instead of use this callback,you can also call to your graphics blitting function from loop events when you get an EVENT_LOGICWAIT type.
But you will get the best results using a callback function.
myRenderFunc | pointer to your graphics blitting function. bLogicUpdate will be 1 after a logic update. |
int CRM32Pro_Main::SetVideoMode | ( | void | ) |
Setup selected video mode given by Config struct.
It tries to assign an icon and a title (the icon surface will be internally removed).
In addition, it creates the Integrated Console and the Debug Window objects.
If CRM32Pro.screen is already present, before to set it again, it removes previous screen if the new set worked.
It replaces to SDL_SetVideoMode() function.
int CRM32Pro_Main::Surface2Texture | ( | SDL_Surface * | surf | ) |
Convert a surface into a texture. For OpenGL modes (glSDL).
If an arbitrary surface is loaded using external methods to CRM32Pro or the colorkey is modified, a good practice is to convert it to a texture at the loading time. Before to call to this method, a call to SDL_DisplayFormat() is needed.
surf | Surface to be converted to a texture |
int CRM32Pro_Main::SurfaceAutomaticConversion | ( | int | iMode | ) |
Manage surface automatic conversion of all CRM32Pro subsystems.
By default, it should be always enabled but in same specific cases (working with SDL_SWSURFACE), could be useful to disable it but do not forget to enable it as soon as you did your task.
This is an important and internal setting and some subsystems may not work or crash if it is disabled.
iMode | 0 for disabling it and 1 for enabling it |
void CRM32Pro_Main::SurfaceInfo | ( | SDL_Surface * | surface | ) |
Uses ILogSystem to dump surface information.
surface | surface to gather and print information |
int CRM32Pro_Main::Update | ( | SDL_Event * | ev = NULL | ) |
Update all systems: graphics,events,timing...
It replaces to SDL_Flip() and SDL_PollEvent(). It updates cursor,buttons and all internal variables.
You can set Logical and Rendering frames rates using ITimeSystem. This method will delay the program execution to fit the Logical Frame Rate,
in addition, if you want to use the Rendering Frame Rate, you have to use SetRenderCallback() to set your graphics update function.
The right way to use in your code is:
- without events control: while(CRM32Pro.Update());
- with events control: while(CRM32Pro.Update(&event)) { your events handling code }
ev | pointer to SDL_Event struct, by default is NULL. |
int CRM32Pro_Main::XMLAttributeGet | ( | int | id, |
char * | name, | ||
char ** | value | ||
) |
Get the string value of the given attribute.
id | ID of the XML |
name | name of attribute |
value | pointer to string to get the value. Null if does not exist. |
int CRM32Pro_Main::XMLAttributeGet | ( | int | id, |
char * | name, | ||
int * | value | ||
) |
Get the integer value of the given attribute.
id | ID of the XML |
name | name of attribute |
value | pointer to int to get the value. Null if does not exist. |
int CRM32Pro_Main::XMLAttributeGet | ( | int | id, |
char * | name, | ||
double * | value | ||
) |
Get the double value of the given attribute.
id | ID of the XML |
name | name of attribute |
value | pointer to double to get the value. Null if does not exist. |
int CRM32Pro_Main::XMLAttributeRemove | ( | int | id, |
char * | name | ||
) |
Remove an attribute.
id | ID of the XML |
name | name of attribute |
int CRM32Pro_Main::XMLAttributeSet | ( | int | id, |
char * | name, | ||
char * | value | ||
) |
Set a string value of a given attribute. If that attribute does not exist, a new one is created.
id | ID of the XML |
name | name of attribute |
value | new string value of given attribute |
int CRM32Pro_Main::XMLAttributeSet | ( | int | id, |
char * | name, | ||
int | value | ||
) |
Set an integer value of a given attribute. If that attribute does not exist, a new one is created.
id | ID of the XML |
name | name of attribute |
value | new integer value of given attribute |
int CRM32Pro_Main::XMLAttributeSet | ( | int | id, |
char * | name, | ||
double | value | ||
) |
Set a double value of a given attribute. If that attribute does not exist, a new one is created.
id | ID of the XML |
name | name of attribute |
value | new double value of given attribute |
void CRM32Pro_Main::XMLClose | ( | int | id | ) |
Close a given XML.
id | ID of the XML |
char * CRM32Pro_Main::XMLCommentGet | ( | int | id | ) |
Return the first comment of current node(if any)
id | ID of the XML |
int CRM32Pro_Main::XMLCommentRemove | ( | int | id | ) |
Remove the first comment contained on current node.
If you want to remove all comments on a given node, call this method while you get 1 as returned value.
id | ID of the XML |
int CRM32Pro_Main::XMLCommentSet | ( | int | id, |
char * | value | ||
) |
Add a new comment to current node.
If a comment already exists, it will be pushed down and the new comment will be the first one.
id | ID of the XML |
value | string with desired comment |
int CRM32Pro_Main::XMLCreate | ( | char * | mainnode | ) |
Create a new XML document.
mainnode | string with the name of the main node |
int CRM32Pro_Main::XMLNodeChild | ( | int | id | ) |
Point to the first child node of the XML.
It only changes the pointer if it can found a valid node.
id | ID of the XML |
int CRM32Pro_Main::XMLNodeCreate | ( | int | id, |
char * | name | ||
) |
Create a new node on current pointer and set it as new current.
id | ID of the XML |
name | string with the name |
int CRM32Pro_Main::XMLNodeFirst | ( | int | id | ) |
Point to the first node of the XML (the root node).
It only changes the pointer if it can found a valid node.
id | ID of the XML |
char * CRM32Pro_Main::XMLNodeGetName | ( | int | id | ) |
Get the name of current node.
id | ID of the XML |
int CRM32Pro_Main::XMLNodeNext | ( | int | id | ) |
Point to the next node of the XML.
It only changes the pointer if it can found a valid node.
id | ID of the XML |
int CRM32Pro_Main::XMLNodeParent | ( | int | id | ) |
Point to the parent node of the XML.
It only changes the pointer if it can found a valid node.
id | ID of the XML |
int CRM32Pro_Main::XMLNodePointTo | ( | int | id, |
int | deep, | ||
char * | element, | ||
... | |||
) |
Search and point to a given node or subnode of any level.
It only changes the pointer when all element given point to valid node.
id | ID of the XML |
deep | number of parameters of 'element' given |
element | variable number of node/subnode |
int CRM32Pro_Main::XMLNodePrev | ( | int | id | ) |
Point to the previous node of the XML.
It only changes the pointer if it can found a valid node.
id | ID of the XML |
int CRM32Pro_Main::XMLNodeRemove | ( | int | id | ) |
Remove current node pointed to and all its nodes and attributes.
id | ID of the XML |
int CRM32Pro_Main::XMLNodeRename | ( | int | id, |
char * | name | ||
) |
Rename current node pointed to.
id | ID of the XML |
name | string with the new name |
int CRM32Pro_Main::XMLNodeRestore | ( | int | id | ) |
Restore previously stored node pointer position.
There is only one slot per each XML
id | ID of the XML |
int CRM32Pro_Main::XMLNodeStore | ( | int | id | ) |
Store internally current node pointer position.
There is only one slot per each XML so it only keeps the node pointer of the last time we call this method
id | ID of the XML |
int CRM32Pro_Main::XMLOpen | ( | char * | filename | ) |
Open a XML file.
filename | name of XML file |
int CRM32Pro_Main::XMLOpen | ( | char * | fileDPF, |
char * | name | ||
) |
Open a XML file stored on a DPF(using filename)
To open a XML from a DPF, CRM32Pro must be initialized.
fileDPF | name of DPF file that contains to the XML |
name | name of the stored XML |
int CRM32Pro_Main::XMLOpen | ( | int | idDPF, |
char * | name | ||
) |
Open a XML file stored on a DPF(idDPF)
To open a XML from a DPF, CRM32Pro must be initialized.
idDPF | ID of the opened DPF |
name | name of the stored XML |
int CRM32Pro_Main::XMLSave | ( | int | id, |
char * | filename | ||
) |
Save a given XML to external file.
id | ID of the XML |
filename | name of file to store the XML |
int CRM32Pro_Main::XMLSave | ( | int | id, |
char * | fileDPF, | ||
char * | blockname | ||
) |
Save a given XML to a DPF(using filename)
To save a XML in to a DPF, CRM32Pro must be initialized.
If an XML already exists, it will be replaced with the new one.
id | ID of the XML |
fileDPF | name of DPF to store the XML |
blockname | name of the block to store the XML, ideally, it could terminate with .xml |
int CRM32Pro_Main::XMLSave | ( | int | id, |
int | idDPF, | ||
char * | blockname | ||
) |
Save a given XML to a DPF(using idDPF)
To save a XML in to a DPF, CRM32Pro must be initialized.
If an XML already exists, it will be replaced with the new one.
id | ID of the XML |
idDPF | ID of the opened DPF |
blockname | name of the block to store the XML, ideally, it could terminate with .xml |
char * CRM32Pro_Main::XMLTextGet | ( | int | id | ) |
Return text contained on current node.
Note that it only works in the first text block found:
<mynode>
Text1 -> First text block
Text2 -> First text block
Text3 -> First text block
<subnode>
Text1 of Subnode
</subnode>
Text4 -> This is a second text block due to exist after a subnode
Text5 -> This is a second text block due to exist after a subnode
</mynode>
id | ID of the XML |
int CRM32Pro_Main::XMLTextRemove | ( | int | id | ) |
Remove text contained on current node.
Note that it only works in the first text block found:
<mynode>
Text1 -> First text block
Text2 -> First text block
Text3 -> First text block
<subnode>
Text1 of Subnode
</subnode>
Text4 -> This is a second text block due to exist after a subnode
Text5 -> This is a second text block due to exist after a subnode
</mynode>
id | ID of the XML |
int CRM32Pro_Main::XMLTextSet | ( | int | id, |
char * | value | ||
) |
Add a new text to the existing text node(if any).
Note that it only works in the first text block found:
<mynode>
Text1 -> First text block
Text2 -> First text block
Text3 -> First text block
<subnode>
Text1 of Subnode
</subnode>
Text4 -> This is a second text block due to exist after a subnode
Text5 -> This is a second text block due to exist after a subnode
</mynode>
id | ID of the XML |
value | string with desired text |