I mean I need my particles emission position should follow my mouse. In examples there is an example that shows how to do that, but i have 1024*768 screen resolution. And i can`t understand where did they get the numbers. 320 is the half of screen width but what 200 means?
// Dark GDK - The Game Creators - www.thegamecreators.com
// include Dark GDK header file
#include "DarkGDK.h"
// main entry point for program
void DarkGDK ( void )
{
// switch to media directory
dbSetDir ( "media\\" );
// set sync rate
dbSyncOn ( );
dbSyncRate ( 0 );
int ImageNumber = 1;
int ImageNumberB = 2;
// load images
dbLoadImage ( "fire.bmp", ImageNumber );
dbLoadImage ( "sky\\spacesphere.jpg", ImageNumberB );
// load sky box
dbLoadObject ( "sky\\ss.x", 1 );
dbScaleObject ( 1,150,150,150 );
dbSetObject ( 1,1,1,1,1,0,0,0 );
dbSetObjectTexture ( 1,2,1 );
// set camera properties
dbSetCameraRange ( 1,10000 );
dbPositionObject ( 1, 0, 3, 0 );
dbYRotateObject ( 1,180 );
// make a new box
dbMakeObjectBox ( 2,100,20,50 );
dbPositionObject ( 2,0,-25,50 );
dbTextureObject ( 2,ImageNumberB );
dbGhostObjectOn ( 2,2 );
// create particles
int ParticleNumber = 1;
dbMakeParticles ( ParticleNumber, ImageNumber, 50, 20.0f );
dbPositionParticles ( ParticleNumber, 0, -58, 0 );
dbColorParticles ( ParticleNumber, 255, 128, 0 );
dbSetParticleEmissions ( ParticleNumber, 10 );
dbSetParticleSpeed ( ParticleNumber, 0.01f );
dbSetParticleGravity ( ParticleNumber, 2 );
// position camera
dbPositionCamera ( 0,3,0 );
dbPointCamera ( 0,3,400 );
// main loop
while ( LoopGDK ( ) )
{
// quit on escape key
if ( dbEscapeKey ( ) )
return;
// adjust particle positions
dbPositionParticleEmissions ( ParticleNumber, ( dbMouseX ( ) - 320 ) / 40.0f * 20, ( 200 - dbMouseY ( ) ) / 40.0f * 20, 10 * 20 );
// change colours on mouse click
if ( dbMouseClick ( ) )
{
dbColorParticles ( ParticleNumber, dbRnd ( 255 ), dbRnd ( 255 ), dbRnd ( 255 ) );
}
// update screen
dbSync ( );
}
}
Dark GDK IS THE BEST!!!!