If you are anything like me, you probably hate the way you create objects, camera, images, and other entities in DBP and GDK. The way you have to number things gets so frustrating. Well, I got the free version of GDK, and since it takes no advantage of C++'s OO features, I am working on something that does.
Doesn't do alot so far, but you can make objects and manipulate them using OO.
Here are some examples:
GDK:
dbMakeObjectCube( obj, size );
dbPositionObject( obj, x, y, z );
OO GDK:
OOGDK::Object::Cube MyCube( size_optional );
MyCube.Position( x, y, z );
GDK:
dbMakeObjectSphere( obj, size );
dbScaleObject( obj, x, y, z );
dbText( 0, 0, dbStr( dbObjectPositionX( obj ) ) );
OOGDK:
OOGDK::Object::Sphere A_Sphere( size_optional );
A_Sphere.Scale( x, y, z );
dbText( 0, 0, dbStr( A_Sphere.Pos.X() ) );
You may not want to use it, since you are likely used to the DBP way of making things, and since this has no documentation yet, but if I get anywhere with it, I will write up some help stuff and release it.
C&C please
[edit]
Version 1 Uploaded. I will create a simple demo to go with it later, in the meantime, fool about with it a bit yourself, the intellisense should help.
If you want to see all available commands, press Ctrl+Atl+J to get to the Object Browser, find your project, open it up and look through all the classes.
Simply include "OOGDK.h" to your project to get it working.
[edit]
Here's a demo to try. By the way, the crappy 3rd person camera is just GDK's way of doing it. Personally, I would do it different (so it would properly work), but hey, such is life.
// Required headers
#include "DarkGDK.h"
// Object Oriented GDK
#include "OOGDK.h"
// Entry point
void DarkGDK( void )
{
// Setup
dbSyncOn();
dbSyncRate( 60 );
dbSetDisplayMode( 1440, 900, 32 );
dbMaximizeWindow();
// Main Camera
Camera MainCam; // Creates a camera
MainCam.SetCurrent(); // Sets as main camera
MainCam.SetRange( 1,0x7fffffff ); // Sets near and far range
// Player object
Cube Player; // Creates a cube and automatically scales to 100. You can add a parameter for the size if you like
Player.Scale( 50.0f, 100.0f, 50.0f ); // Scale the cube so it's quite tall
// Create a matrix (not OO yet)
dbMakeMatrix( 1, 10000.0f, 10000.0f, 50, 50 );
// Main Loop
while ( LoopGDK() )
{
// Control the player
Player.Move( (float)( dbUpKey() - dbDownKey() ) * 10.0f ); // Move object using up and down arrowkeys
Player.Turn( - (float)( dbLeftKey() - dbRightKey() ) * 3.0f ); // Turns the object (automatically left)
// 3rd person camera
MainCam.Follow( Player.GetPos(), dbWrapValue( Player.GetAng().Y() ), 600.0f, 300.0f, 20.0f, 0 ); // Follow player. Notice that only 1 param is needed for coords.
// Refresh
dbSync();
}
// Return to windows
return;
}
"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers