If you use
dbPickObject( dbMouseX( ), dbMouseY( ), 1, 11 );
That includes object 1 as well [1,11].
It should say something like,
dbPickObject( dbMouseX( ), dbMouseY( ), 2, 11 );
or just
dbPickObject( dbMouseX( ), dbMouseY( ), 11, 11 );
So just object 11 is checked.
And so this runs properly:
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff( );
dbSetDisplayMode( 800, 600, 16 );
dbSetWindowOn( );
// make an objects
dbMakeObjectCube( 1, 1.0f );
dbMakeObjectCube( 11, 1.0f );
dbPositionObject( 11, 0.0f, 5.0f, 10.0f );
dbMakeObjectCube( 12, 1.0f );
dbPositionObject( 12, 2.0f, 5.0f, 10.0f );
dbPositionObject( 1, 0.0f, 0.0f, 5.0f );
// our main loop
while ( LoopGDK ( ) )
{
if( dbMouseClick( ) )
{
int obj = dbPickObject( dbMouseX( ), dbMouseY( ), 1, 1 );
if( obj )
dbText( 300, 400, "Play Box 1 Pressed" );
}
if( dbMouseClick( ) )
{
int obj = dbPickObject( dbMouseX( ), dbMouseY( ), 11, 11 );
if( obj )
dbText( 300, 400, "Play Box 2 Pressed" );
}
if( dbMouseClick( ) )
{
int obj = dbPickObject( dbMouseX( ), dbMouseY( ), 12, 12 );
if( obj )
dbText( 300, 400, "Play Box 3 Pressed" );
}
// update the screen
dbSync ( );
}
// return back to windows
return;
}