First of all You have to copy the 3D object, and the object to be glued in th project directory and then when u run it,it will ask you for the character file name,type and press enter and then type the file name of the object to be glued,and press enter.ENJOYYY!!!!
#include "DarkGDK.h"
#include <string.h>
float XAngleCamera = 0.0f;
float Max = 0.0f;
float Cam_Distance = 50.0f;
int xr = 0;
int yr = 0;
int zr = 0;
int daInt = 0;
int daFrame = 0;
char my_String[60];
char my_String2[60];
float LimbScaling = 100.0f;
int Cam_Height = 50;
void displayText (void);
void limbViewer (void);
void updateCamera (void);
// 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 );
dbInk(dbRGB(0,175,0),dbRGB(0,0,0));
dbColorBackdrop(dbRGB(68,133,157));
dbText(5,100,"Controls");
dbText(5,120,"Left click to rotate Camera");
dbText(5,140,"Use Mouse Wheel to zoom");
dbText(5,160,"i and o on the numpad to scale equipment model");
dbText(5,180,"ins home PgUp PgDwn end del are used to rotat the eqipment model.");
dbText(5,200,"W A S D are used to control the character model animation");
dbText(5,220,"Press and hold control with combo of the keys mentioned above for slower model animation");
dbText(5,5,"Character File Name:");
dbText(5,20,"Equipment File Name:");
dbSync ( );
dbSetCursor(160,5);
strcpy(my_String,dbInput());
dbSetCursor(160,20);
strcpy(my_String2,dbInput());
dbSync();
dbLoadObject(my_String,1);
dbLoadObject(my_String2,3);
/*dbLoadObject ( "Colonel-X.X", 1 );
dbLoadObject ( "Atomiser.x", 3 );
dbScaleObject(3,50,50,50);
dbScaleObject(1,100,75,100);*/
dbPerformChecklistForObjectLimbs(1);
dbPositionObject(1,0,0,0);
dbPositionObject(3,0,0,0);
dbSetObjectSpecular(3,1);
dbMakeObjectSphere(2,0.001,1,1);
dbSetObjectSpeed(1,40);
// our main loop
while ( LoopGDK ( ) )
{
displayText ();
limbViewer ();
updateCamera ();
dbSetObjectFrame(1,daFrame);
dbGlueObjectToLimb(3,1,daInt);
//dbScaleObject(3,LimbScaling,LimbScaling,LimbScaling);
dbRotateObject(3,xr,yr,zr);
if(dbControlKey())dbWait(100);
dbSync ( );
}
return;
}
void displayText (void)
{
dbInk(dbRGB(0,0,0),dbRGB(0,0,0));
dbBox(2.5,2.5,250,125);
dbInk(dbRGB(0,175,0),dbRGB(0,0,0));
dbText(5,5,"Total Limbs:");
dbText(110,5,dbStr(dbChecklistQuantity()));
dbText(5,20,"Int Value:");
dbText(95,20,dbStr(daInt));
dbText(5,35,"Limb Description:");
dbText(145,35,dbChecklistString(daInt));
dbText(5,50,"Limb Name:");
dbText(95,50,dbLimbName(1,daInt));
dbText(5,65,"Limb Scaling:");
dbText(105,65,dbStr(LimbScaling));
dbText(5,80,"Limb Rotation");
dbText(115,80,dbStr(xr));
dbText(155,80,dbStr(yr));
dbText(195,80,dbStr(zr));
dbText(5,95,"Total Frames:");
dbText(115,95,dbStr(dbTotalObjectFrames(1)));
dbText(5,110,"CurrentFrame:");
dbText(135,110,dbStr(dbObjectFrame(1)));
}
void limbViewer(void)
{
//Checklist Control
if(dbUpKey()) daInt += 1;
if(dbDownKey()) daInt -= 1;
if(daInt>dbChecklistQuantity()) daInt = dbChecklistQuantity();
if(daInt<1) daInt = 1;
//Limbness
if (dbKeyState(23)) LimbScaling -= 1;
if (dbKeyState(24)) LimbScaling += 1;
//Frames Control
if (dbKeyState(17)) daFrame += 1;
if (dbKeyState(31)) daFrame -= 1;
if (dbKeyState(30)) daFrame -= 10;
if (dbKeyState(32)) daFrame += 10;
//Rotations
if (dbKeyState(210)) xr += 1;
if (dbKeyState(211)) xr -= 1;
if (dbKeyState(199)) yr += 1;
if (dbKeyState(207)) yr -= 1;
if (dbKeyState(201)) zr += 1;
if (dbKeyState(209)) zr -= 1;
}
void updateCamera (void)
{
if(dbMouseClick() == 2) Cam_Height = Cam_Height-dbMouseMoveY()/2;
//Camera Mount
dbPositionObject(2,dbObjectPositionX(1),dbObjectPositionY(1) + Cam_Height,dbObjectPositionZ(1));
//Camera
dbPositionCamera(dbObjectPositionX(2),dbObjectPositionY(2),dbObjectPositionZ(2));
XAngleCamera = dbObjectAngleX(2);
Max = dbObjectAngleX(2) + dbMouseMoveY()/2;
if(dbMouseClick() == 1)
{
dbRotateCamera(dbObjectAngleX(2),dbObjectAngleY(2),dbObjectAngleZ(2));
dbRotateObject(2,Max,dbObjectAngleY(2) + dbMouseMoveX()/2,dbObjectAngleZ(2));
dbMoveCamera( -Cam_Distance );
}
else
{
dbMoveCamera( -Cam_Distance );
}
}