Hello all,
Here's what i come up with to controll with w,a,s,d and X,Y with mouse. Is there some kind of bug doing this? because the camera will flip out of know where...
#include "dinput.h"
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn();
dbSyncRate ( 60 );
dbAutoCamOff();
dbSetCameraRange ( 1, 5000 );
dbMakeMatrix(10,2000,2000,100,100);
//dbMakeMatrix ( 1, 200 ,1 , 200 );
dbPositionCamera ( 250,10, 250 );
// camera variables
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
while ( LoopGDK() )
{
if ( dbKeyState ( DIK_W ) )
{
//dbPitchCameraUp(90);
dbMoveCamera ( 1 );
//dbPitchCameraDown ( 90 );
}
if ( dbKeyState ( DIK_S ) )
{
//dbPitchCameraDown(90);
dbMoveCamera ( -1 );
//dbPitchCameraUp ( 90 );
}
if ( dbKeyState ( DIK_A ) )
{
dbTurnCameraLeft ( 90 );
dbMoveCamera ( 1 );
dbTurnCameraRight ( 90 );
}
if ( dbKeyState ( DIK_D ) )
{
dbTurnCameraRight ( 90 );
dbMoveCamera ( 1 );
dbTurnCameraLeft ( 90 );
}
// create a rotation axis based on mouse movement
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.4f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
dbSync();
}
return;
}
Here i am!!!