I took some code directly from DBP and converted the basics of it to DarkGDK, so I thought. I'm getting some build errors, and my ship just sits there with no control(Arrows supposed to move it). I'm new to the GDK, i'm probably not using the variables right since that seems to be a major change from DBP.
Here is my code:
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff ();
dbHideMouse ();
dbBackdropOn ();
//setup map
dbSetCameraRange (2.5,50000);
dbLoadObject ("sky/cielo.x",666);
dbPositionObject (666,256,30,0);
dbSetObjectTexture (666,2,1);
dbSetObjectLight (666,0);
dbSetObjectCull (666,0);
dbYRotateObject (666,270);
dbScaleObject (666,95000,95000,95000);
dbSetObjectCollisionOff (666);
dbSetAmbientLight (1);
dbMakeLight (1);
dbPositionLight (1,0,0,0);
dbColorLight (1,255,0,0);
dbSetLightRange (1,600000);
dbMakeLight (2);
dbPositionLight (2,40000,0,40000);
dbColorLight (2,255,255,255);
dbSetLightRange (2,300000);
dbMakeLight (3);
dbColorLight (3,255,255,255);
dbSetLightRange (3,10000);
dbSetNormalizationOn ();
//Make Player
//dbLoadObject ("player/ship_1.x",15);
dbMakeObjectCube(15,5);
dbXRotateObject (15,-90);
dbScaleObject (15,400,400,400);
dbLoadImage ("player/spheremap.jpg",15);
dbSetSphereMappingOn (15,15);
//setup speed
int speed = 10;
int speedmax = 30;
int speedmin = 0;
int speedchg = 1;
float plyr_bank = 0;
float plyr_turn = 0;
// our main loop
while ( LoopGDK ( ) )
{
//variables
float px = dbObjectPositionX (15);
float py = dbObjectPositionY (15);
float pz = dbObjectPositionZ (15);
//control speed
if (dbControlKey( )) int speed=speed+1;
if (dbShiftKey( )) int speed=speed-1;
if (speed > speedmax)int speed = speedmax;
if (speed < speedmin)int speed = speedmin;
dbMoveObject (15,speed);
//Navigation
if(dbLeftKey( )) float plyr_turn = dbCurveValue(-2, plyr_turn, 10);
if (dbRightKey( )) float plyr_turn = dbCurveValue(2, plyr_turn, 10);
dbYRotateObject (15, dbWrapValue(dbObjectAngleY(15)+plyr_turn));
if (dbLeftKey( )) float plyr_bank = dbCurveValue(50, plyr_bank, 25);
if (dbRightKey( )) float plyr_bank = dbCurveValue(-50, plyr_bank, 25);
//if mx# = 0 then plyr_bank# = curvevalue(0, plyr_bank#, 25)
dbYRotateObject (15,plyr_bank);
//set camera
dbSetCameraToObjectOrientation (15);
dbPositionCamera (px, py+50, pz);
dbMoveCamera (-100);
//skybox position
float camx=dbCameraPositionX();
float camy=dbCameraPositionY();
float camz=dbCameraPositionZ();
dbPositionObject (666,camx, camy, camz);
dbSync ( );
}
return;
}
And here is my build:
------ Build started: Project: MapTest3, Configuration: Debug Win32 ------
Compiling...
Main.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(86) : warning C4805: '==' : unsafe mix of type 'int' and type 'bool' in operation
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(87) : warning C4805: '==' : unsafe mix of type 'int' and type 'bool' in operation
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(90) : warning C4805: '==' : unsafe mix of type 'int' and type 'bool' in operation
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(91) : warning C4805: '==' : unsafe mix of type 'int' and type 'bool' in operation
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(78) : warning C4700: uninitialized local variable 'speed' used
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(79) : warning C4700: uninitialized local variable 'speed' used
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(86) : warning C4700: uninitialized local variable 'plyr_turn' used
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(87) : warning C4700: uninitialized local variable 'plyr_turn' used
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(90) : warning C4700: uninitialized local variable 'plyr_bank' used
c:\documents and settings\administrator\my documents\visual studio 2008\projects\maptest3\maptest3\main.cpp(91) : warning C4700: uninitialized local variable 'plyr_bank' used
Linking...
LINK : Debug\MapTest3.exe not found or not built by the last incremental link; performing full link
Embedding manifest...
Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\MapTest3\MapTest3\Debug\BuildLog.htm"
MapTest3 - 0 error(s), 10 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Any suggestions?