Hello! I've finally got DarkGDK installed
I've had a few problems trying to get it to work with Visual Studio 2010 and the February 2010 SDK, but I finally gave in, uninstalled everything and used the 2008 compiler, and the August 2007 sdk.
Anyways, it's nice to have it finally working, I've made a simple 'Spinning Cube program', and now I'm trying to get functions to work. They don't work as I expect. The only programming languages I've used are dbpro, php and a little of python, whenever I've declared functions in these languages they've always been at the end of the program/script.
Now that I'm trying to use c++ functions, I get an error placing them at the end of the source. I'm trying to create a simple timer based movement function with this code:
#include "DarkGDK.h"
#include <iostream>
using namespace std;
float angX;
float factor;
int tlast;
void DarkGDK (void){
dbMakeObjectCube( 1, 1.0 );
tbm();
while( LoopGDK() ){
angX = angX + 1.0*factor;
dbYRotateObject( 1, angX );
dbSync();
};
dbDeleteObject( 1 );
return;
}
void tbm(){
int diff;
int t;
t = dbTimer();
diff = t - tlast;
tlast = t;
factor = diff/1000.0;
}
Upon compiling this code I get an error saying ''tbm': identifier not found'. But if I place it at the start, just after my variable declarations, it compiles fine. (Although doesn't work as expected, not sure why atm
EDIT: the tbm function was outside the loop, hehe )
So, why question is, do I have to declare all functions at the start of a program?
On top of this, I'm also wondering why all GDK commands must be in the
void DarkGDK (void) brace, the tutorials don't mention anything about that.
Thanks