Creating a plain object in DarkGDK

A plain is a mesh object that can be used as ground in your game scene. To create a plain object, use the dbMakeObjectPlain function.

Syntax:

dbMakeObjectPlain(object id,plain width,plain height);

Example:
dbMakeObjectPlain(1,100,100);

By default an object is drawn in gray. You can add colors to your plain object by Using the dbColorObject function which has the following syntax:

dbColorObject(object id, color);

Colors can be defined by using the dbRGB function which has the following syntax:

dbRGB(red,green,blue);

Wherein red, green, and blue are numbers that ranges from 0-255.

The following codes demonstrates dbMakeObjectPlain and dbColorObject at work:

// Dark GDK - The Game Creators - www.thegamecreators.com

// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application

// whenever using Dark GDK you must ensure you include the header file
#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 );
//Creates a 400 X 200 plain object with an object id of 1 and 
dbMakeObjectPlain(1,400,200);
//Applies a red color to our plain
dbColorObject(1,dbRGB(255,0,0));
//Positions the camera on the side of our object
dbPositionCamera(-1,-600,-100);
// our main loop
while ( LoopGDK ( ) )
{
// update the screen
dbSync ( );
}
//deletes all objects
for ( int i = 1; i < 50; i++ )
dbDeleteObject ( i );
// return back to windows
return;
}