You can get the GDK to report errors to you in numerical form.
This code for instance, will report a 7008 (Object does not exist) after the object has been deleted and when you attempt to delete the object again:
#include "DarkGDK.h"
#include "GlobStruct.h"
// Start of error definitions
class CRuntimeErrorHandler
{
public:
DWORD dwErrorCode;
};
extern CRuntimeErrorHandler* g_pErrorHandler;
// End of error definitions
void DarkGDK()
{
// Start of error initialisation
g_pErrorHandler = new CRuntimeErrorHandler;
g_pErrorHandler->dwErrorCode = 0;
g_pGlob->g_pErrorHandlerRef = g_pErrorHandler;
// End of error initialisation
// turn on sync rate and set maximum rate to 60 fps
dbSyncOff ( );
dbSyncRate ( 60 );
dbMakeObjectCube(1, 1.0);
// our main loop
while ( LoopGDK ( ) )
{
dbSetCursor(0, 0);
// Display the error code
dbPrint( LONGLONG(g_pErrorHandler->dwErrorCode) );
dbRotateObject(1,
dbWrapValue(dbObjectAngleX(1)+1.0f),
dbWrapValue(dbObjectAngleY(1)+1.0f),
dbWrapValue(dbObjectAngleZ(1)+1.0f));
if (dbSpaceKey())
dbDeleteObject(1);
// update the screen
dbSync();
}
// return back to windows
return;
}
Just hold space - the object will be deleted in the first frame, but in the next frame will raise an error when it tries to rotate the object or delete it a second time.