C++ can do what DBP can do in a similar way (plus a lot more, of course). The only real difference to start with is the syntax.
Take the following DBPro code:
` This is a comment. Now, lets create an object
obj as integer
obj = CreateCube( 100 )
` Z position of object
z as float
z = 0
` Main loop
do
` Move
inc z
position object obj, 0, 0, z
sync
loop
function NewObject()
id = 1
while object exist( id )
inc id
endwhile
endfunction id
function CreateCube( size as float )
obj = NewObject()
make object cube obj, size
endfunction obj
And in DarkGDK (note that you need a main() function as a staring point)
#include <DarkGDK.h>
// A comment
int NewObject()
{
int id = 1;
while ( dbObjectExist( id ) )
id++
return id;
}
int CreateCube( float size )
{
int obj = NewObject();
dbMakeObjectCube( obj, size );
return obj;
}
// Start here
void main()
{
int obj = CreateCube( 100.0f );
float z = 0.0f;
while ( true )
{
z++;
dbPositionObject( obj, 0.0f, 0.0f, z );
dbSync();
}
}
It's not too hard to get used to these basics. Strings may through you a little because they will introduce you to pointers, but once you understand their advantage, you'll see why they're used
"everyone forgets a semi-colon sometimes." - Phaelax