I'm a bit unsure how to use the dbTAN thing, would be great with some help. This is what i have so far but it's not working (no conversion from 'float (__cdecl *)(float)' to 'float')
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff();
dbMaximizeWindow();
dbLoadObject("map.x", 2);
int map = 2;
dbPositionObject(map, 0, 600, 300);
dbScaleObject(map, 1000, 1000, 1000);
dbColorObject(map, 255);
dbLoadObject("tank.x", 1);
int tank = 1;
dbRotateCamera(0, 0, 0);
dbPositionCamera(0, 0, -2000);
float xHit;
float yHit;
bool objectPlaced = false;
bool targetPlaced = false;
float delta_x;
float delta_y;
// our main loop
while ( LoopGDK ( ) )
{
if (dbMouseClick() == 2)
{
dbPickObject( dbMouseX (), dbMouseY (), map, map );
xHit = dbGetPickVectorX() + dbCameraPositionX();
yHit = dbGetPickVectorY() + dbCameraPositionY();
targetPlaced = true;
}
if (targetPlaced == true)
{
delta_x = dbObjectPositionX(tank) - xHit;
delta_y = dbObjectPositionY(tank) - yHit;
dbTAN(delta_x/delta_y);
if (dbObjectAngleZ(tank) == dbTan)
{
dbText(250, 300, "Rotated.");
}
else
{
dbRotateObject(tank, dbObjectAngleX(tank), dbObjectAngleY(tank), dbObjectAngleZ(tank) + 0.5);
}
/*if (dbObjectPositionY(tank) < yHit)
{
dbMoveObjectUp(tank, 1);
}
if (dbObjectPositionY(tank) > yHit)
{
dbMoveObjectDown(tank, 1);
}
if (dbObjectPositionX(tank) < xHit)
{
dbMoveObjectRight(tank, 1);
}
if (dbObjectPositionX(tank) > xHit)
{
dbMoveObjectLeft(tank, 1);
}*/
}
if (dbObjectPositionY(tank) >= yHit -50 && dbObjectPositionY(tank) <= yHit +50
&& dbObjectPositionX(tank) >= xHit -50 && dbObjectPositionX(tank) <= xHit +50)
{
dbText(250, 250, "Position Matches.");
targetPlaced = false;
}
// update the screen
dbSync ( );
}
// return back to windows
return;
}