For example: conversion of ''Explosion Demo'' from DBPro to DarkGDK.
int t1, t2, t3, buttonPress1=0, screenWidth=1920, screenHeight=1080;
void* expolsionPrototype=NULL; void* newExplosion=NULL;
void DarkGDK ( void )
{
dbSetWindowLayout(0,0,0);
dbSetDisplayModeAntialias (screenWidth,screenHeight,dbScreenDepth(),1,4,0);}
dbMaximiseWindow();
dbAutoCamOff();
dbBackdropOn(); dbColorBackdrop(dbRgb(0,0,0));
dbSetCameraRange (0.5f, 60000.0f);
dbSetCameraFOV(0,31.0f);
float x=0.0f; y=75.0f; z=0.0f;
dbPositionCamera (x, y, z);
dbPointCamera (x, 0.0f, z);
dbSync();
SP_Init();
;/////////////////////////////////////////////////////////////////////////////////////
int textureExplosion = 1;
int textureFlash = 2;
int textureSpark1 = 4;
int textureSpark2 = 5;
int textureWave = 6;
dbLoadImage("media\\explosion.bmp",textureExplosion);
dbLoadImage("media\\flash.bmp",textureFlash);
dbLoadImage("media\\spark1.bmp",textureSpark1);
dbLoadImage("media\\point.bmp",textureSpark2);
dbLoadImage("media\\wave.bmp",textureWave);
// we create a prototype system
expolsionPrototype = SP_CreateSystem (true,0,0,0);
SP_SetSystemAutodelete (expolsionPrototype,true);
SP_ScaleSystem (expolsionPrototype,5);
//***********************************************************************************
//************************* SET THE SMOKE PARAMETERS ********************************
//***********************************************************************************
void * smokeGroup = SP_AddGroup (expolsionPrototype,15,0,0,0);
SP_SetLifeTime (smokeGroup, 2.5f, 3.0f);
void * smokeRenderer = SP_SetQuadRenderer (smokeGroup,textureExplosion,81,81,2,2,2);
// for performance reasons we set our renderer shared so all instances will use this renderer (we don't need a new renderer each time a new explosion is created...)
void * smokeSizeInterpolator = SP_AddInterpolator (smokeGroup, SP_PARAM_SCALE, 0.6f, 0.8f, 1.0f, 1.4f);
void * smokeTextureInterpolator = SP_AddInterpolator (smokeGroup, SP_PARAM_ATLAS_DIMENSIONS, 0, 4, 1);
void * angleInterpolator = SP_AddInterpolator (smokeGroup, SP_PARAM_ANGLE, 0.0f, 1.57f, 0.0f, 1.57f);
// we also share the interpolators...
// set a complex graph color interpolator
unsigned int ent1 = SP_RGBA(51,51,51,0);
unsigned int ent2 = SP_RGBA(51,51,51,102);
unsigned int ent3 = SP_RGBA(51,51,51,153);
unsigned int ent4 = SP_RGBA(51,51,51,102);
unsigned int ent5 = SP_RGBA(51,51,51,153);
unsigned int ent6 = SP_RGBA(51,51,51,0);
void * colorGraph = SP_AddRGBAGraph(smokeGroup);
SP_AddRGBAGraphEntry (colorGraph, 0.0f, ent1);
SP_AddRGBAGraphEntry (colorGraph, 0.4f, ent2, ent3); // <- rnd colors between ent2-ent3
SP_AddRGBAGraphEntry (colorGraph, 0.6f, ent4, ent5); // <- rnd colors between ent4-ent5
SP_AddRGBAGraphEntry (colorGraph, 1.0f, ent6);
// only one emitter
void * smokeEmitter = SP_AddRandomEmitter (smokeGroup, -1, 0.02f, 0.04f, 15, SP_SphereZone(0,0,0,0.6f));
// and a gravity modifier.
void * smokeGrav = SP_AddGravityModifier (smokeGroup, 0.0f, 0.05f, 0.0f);
//***********************************************************************************
//************************* SET THE FLAME PARAMETERS ********************************
//***********************************************************************************
void * flameGroup = SP_AddGroup (expolsionPrototype,15,0,0,0);
SP_SetLifeTime (flameGroup, 1.5f, 2.0f);
void * flameRenderer = SP_SetQuadRenderer (flameGroup,textureExplosion,91,91,2,2,2);
// interpolators :
// set a graph interpolator for the scale parameter
void * sizeInterpolator = SP_AddParamGraph (flameGroup, SP_PARAM_SCALE); //void * sizeInterpolator = SP_AddInterpolator (flameGroup, SP_PARAM_SCALE);
SP_AddParamGraphEntry (sizeInterpolator, 0.0f, 0.25f);
SP_AddParamGraphEntry (sizeInterpolator, 0.02f, 0.6f, 0.8f);
SP_AddParamGraphEntry (sizeInterpolator, 1.0f, 1.0f, 1.4f);
void * FTextureInterpolator = SP_AddInterpolator (flameGroup, SP_PARAM_ATLAS_DIMENSIONS, 0, 4, 1);
void * FangleInterpolator = SP_AddInterpolator (flameGroup, SP_PARAM_ANGLE, 0, 1.57f, 0, 1.57f);
// color graph
void * rgbaGraph = SP_AddRGBAGraph (flameGroup);
SP_AddRGBAGraphEntry (rgbaGraph, 0.5f, 0xFF8033FF);
SP_AddRGBAGraphEntry (rgbaGraph, 1.0f, 0x33333300);
// and finally the flame emitter
void * flameEmitter = SP_AddNormalEmitter (flameGroup, -1, 0.06f, 0.1f, 15, SP_SphereZone(0,0,0,0.4f), SP_PointZone(0,0,0));
//***********************************************************************************
//************************* SET THE FLASH PARAMETERS ********************************
//***********************************************************************************
void * flashGroup = SP_AddGroup (expolsionPrototype,3,0,0,0);
// set a very short lifetime , as it is just a flash
SP_SetLifeTime (flashGroup, 0.5f, 0.5f);
void * flashRenderer = SP_SetQuadRenderer (flashGroup,textureFlash,91,91,1,1,2);
// only the scale parameter is interpolated
void * flahGraph1 = SP_AddParamGraph (flashGroup, SP_PARAM_SCALE);
SP_AddParamGraphEntry (flahGraph1, 0.0f, 0.25f);
SP_AddParamGraphEntry (flahGraph1, 0.1f, 1.0f, 2.0f);
// color graph for the flash
void * flahGraph2 = SP_AddRGBAGraph (flashGroup);
SP_AddRGBAGraphEntry (flahGraph2, 0.0f, SP_RGBA(128,128,128,255));
SP_AddRGBAGraphEntry (flahGraph2, 0.4f, SP_RGBA(128,128,128,0));
// and an emitter
void * flashEmitter = SP_AddStaticEmitter (flashGroup, -1, 3, SP_SphereZone(0,0,0,0.4f));
//***********************************************************************************
//************************* SET THE SPARK1 PARAMETERS *******************************
//***********************************************************************************
void * spark1Group = SP_AddGroup (expolsionPrototype,20,0,0,0);
SP_SetLifeTime (spark1Group, 0.1f, 1.0f);
// set the quads size to x = 0.05 and y = 1.0 (thin lines)
void * spark1Renderer = SP_SetQuadRenderer (spark1Group,textureSpark1,5.55f,91,1,1,2);
// And now we do something really cool but very advanced. Set the quads orientation in this renderer to be aligned to a direction.
SP_SetQuadOrientation (spark1Renderer, SP_DIRECTION_ALIGNED, 1,0,0, 0,1,0);
// scale parameter
void * spark1size = SP_AddInterpolator (spark1Group, SP_PARAM_SCALE, 0.2f, 0.4f, 0);
// color interpolator
void * spark1Rgba = SP_AddRGBAInterpolator (spark1Group, SP_RGBA(128,128,128,255), SP_RGBA(128,128,128,0), 0);
// spark1 emitter :
void * spark1Emitter = SP_AddNormalEmitter (spark1Group, -1, 2.0f, 3.0f, 20, SP_PointZone(0,0,0), SP_PointZone(0,0,0));
// spark1 gravity force :
void * spark1Grav = SP_AddGravityModifier (spark1Group, 0.0f, -1.5f, 0.0f);
//***********************************************************************************
//************************* SET THE SPARK2 PARAMETERS *******************************
//***********************************************************************************
void * spark2Group = SP_AddGroup (expolsionPrototype,400,0,0,0);
SP_SetLifeTime (spark2Group, 1.0f, 3.0f);
void * spark2Renderer = SP_SetQuadRenderer (spark2Group,textureSpark2, 2.42f, 2.42f, 1,1,2);
// generating colors for the random color interpolator.
unsigned int color1 = SP_RGBA(255,255,178,255);
unsigned int color2 = SP_RGBA(255,255,178,255);
unsigned int color3 = SP_RGBA(255,76,76,0);
unsigned int color4 = SP_RGBA(255,255,76,0);
// color interpolator
void * spark2Rgba = SP_AddRGBAInterpolator (spark2Group, color1, color2, color3, color4);
// emitter
void * spark2Emitter = SP_AddNormalEmitter (spark2Group, -1, 0.4f, 0.8f, 400, SP_PointZone(0,0,0), SP_PointZone(0,0,0));
// gravity force
void * spark2Grav = SP_AddGravityModifier (spark2Group, 0.0f, -0.3f, 0.0f);
//***********************************************************************************
//************************* SET THE WAVE PARAMETERS *********************************
//***********************************************************************************
void * waveGroup = SP_AddGroup (expolsionPrototype,1,0,0,0);
SP_SetLifeTime (waveGroup, 0.8f, 0.8f);
void * waveRenderer = SP_SetQuadRenderer (waveGroup,textureWave,91,91,1,1,2);
// we set our quads orientation to fixed (Not facing to the camera but have a fixed orientation defined by up and look vectors)
SP_SetQuadOrientation (waveRenderer, SP_FIXED_ORIENTATION, 1,0,0, 0,1,0);
void * waveSize = SP_AddInterpolator (waveGroup, SP_PARAM_SCALE, 0,4,0);
void * waveColor = SP_AddRGBAInterpolator (waveGroup, SP_RGBA(128,128,128,211), SP_RGBA(128,128,128,0), 0);
// set the emitter's tank to 1.Only one wave is emited.
void * waveEmitter = SP_AddStaticEmitter (waveGroup, -1, 1, SP_PointZone(0,0,0));
;/////////////////////////////////////////////////////////////////////////////////////
while (LoopGDK())
{
t1=dbMouseX(); t2=dbMouseY(); t3=dbMouseClick();
if (t3!=1) {buttonPress1=0;}
if (t3==1 && buttonPress1==0)
{ buttonPress1=1;
newExplosion = SP_CopySystem (expolsionPrototype, 0.0f, 0.0f, 0.0f);
//newExplosion = SP_LoadSystem("Explosion.xml",100); SP_CopySystem (newExplosion, 2.0f, 1.0f, 0.0f);
}
dbSync();
}
SP_DeleteSystem (expolsionPrototype);
if (SP_SystemExists(newExplosion)) {SP_DeleteSystem (newExplosion);}
return;
}