Mistrel, I've attached a screen capture of the junk IDs returned by PureGDK and the code that generates it. Note: the std::map is defined as <int,int>, with the second int the returned object IDs.
EDIT: Just reread your post about the reproducible code. I've commented out everything that I could think of that might affect the code, but it occurs even when it's at it's most barebones.
Current code(heavily commented):
//PureGDK includes
#include <include/puregdk/core/puregdk.h>
#include <include\initPureGDK.h>
#include <include\simpleWindow.h>
//Windows library linkage
//#pragma comment(lib,"winmm.lib")
#include <include\puregdk\plugins\puregdk-plugins.h>
//Personal includes
#include <include\D13_Wrapper\D13_Wrapper.h>
//Wasteland includes
//#include <include\Wtld\AI\AI.h>
//#include <include\Wtld\StateManager.h>
//#include <include\Wtld\InputManager.h>
//#include <include\Wtld\Menus.h>
//IrrKlang include and library link
//#include <irrKlang.h>
//#pragma comment(lib,"irrKlang.lib")
//CEGUI includes
//#include <CEGUI.h>
#include <RendererModules\Direct3D9\CEGUIDirect3D9Renderer.h>
//debug includes
#include <iostream>
//#include <OIS.h>
//#pragma comment(lib,"dxguid.lib")
//Just a simple rotating cube example.
int __stdcall WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{
typedef IDirect3D9* (__cdecl *GetDirect3D)(void);
typedef IDirect3DDevice9* (__cdecl *GetDirect3DDevice)(void);
HWND hWnd;
if(!initPureGDK("gdkengine.dll"))
{
return 1;
}
hWnd=openWindow(0,0,800,600,"PureGDK Test");
pgdk::dbOpenScreen(hWnd,0,0,800,600,32);
ShowWindow(hWnd,SW_SHOW);
GetDirect3D getDirect3D = (GetDirect3D)
GetProcAddress(GetModuleHandle("DBProSetupDebug.dll"),
"?GetDirect3D@@YAPAUIDirect3D9@@XZ");
GetDirect3DDevice getDirect3DDevice = (GetDirect3DDevice)
GetProcAddress(GetModuleHandle("DBProSetupDebug.dll"),
"?GetDirect3DDevice@@YAPAUIDirect3DDevice9@@XZ");
IDirect3D9* d3d9 = getDirect3D();
IDirect3DDevice9* d3dDevice9 = getDirect3DDevice();
//-------------
//PureGDK Setup
//-------------
pgdk::dbSyncRate(60);
pgdk::dbAutoCamOff();
pgdk::dbBackdropOn();
std::string dir_exe=get_DirExe();
std::string cwd=get_CWD();
std::string what="Success!";
//camera setup
pgdk::dbSetCurrentCamera(0);
pgdk::dbSetCameraRange(1.0f,1000.0f);
d13::dbPositionCamera(0,d13::vec::vector3df(-100,0,-100));
d13::dbPointCamera(0,d13::vec::vector3df(100.0f,0,100.0f),false);
/*
//-----------
//CEGUI setup
//-----------
//CEGUI renderer
CEGUI::Direct3D9Renderer* ceguiRender=&CEGUI::Direct3D9Renderer::bootstrapSystem(d3dDevice9);
//CEGUI Resource provider setup
CEGUI::DefaultResourceProvider* resProv=(CEGUI::DefaultResourceProvider*)CEGUI::System::getSingleton().getResourceProvider();
resProv->setResourceGroupDirectory("CEGUI",(cwd+"Media/CEGUI_Data/"));
CEGUI::Imageset::setDefaultResourceGroup("CEGUI");
CEGUI::Font::setDefaultResourceGroup("CEGUI");
CEGUI::Scheme::setDefaultResourceGroup("CEGUI");
CEGUI::WidgetLookManager::setDefaultResourceGroup("CEGUI");
CEGUI::WindowManager::setDefaultResourceGroup("CEGUI");
CEGUI::ScriptModule::setDefaultResourceGroup("CEGUI");
CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
if(parser->isPropertyPresent("SchemaDefaultResourceGroup"))
parser->setProperty("SchemaDefaultResourceGroup","CEGUI");
//CEGUI look'n'feel setup
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
CEGUI::WindowManager& ceguiWMgr=CEGUI::WindowManager::getSingleton();
//Main menu testing suite
MainMenu menuTest;
OptionsMenu optTest;
//OIS and InputManager setup ->
InputManager* inputManager=InputManager::getInstance(hWnd);
OIS::InputManager* oisManager=NULL;
OIS::Keyboard* oisKeyboard=NULL;
OIS::Mouse* oisMouse=NULL;
OIS::ParamList list;
std::ostringstream wnd;
wnd << hWnd;
list.insert(std::make_pair(std::string("WINDOW"),wnd.str()));
oisManager=OIS::InputManager::createInputSystem((size_t)hWnd);
oisManager->enableAddOnFactory(OIS::InputManager::AddOn_All);
oisKeyboard=(OIS::Keyboard*)oisManager->createInputObject(OIS::OISKeyboard,true);
oisMouse=(OIS::Mouse*)oisManager->createInputObject(OIS::OISMouse,true);
oisKeyboard->setEventCallback(inputManager);
oisMouse->setEventCallback(inputManager);
const OIS::MouseState &ms=oisMouse->getMouseState();
RECT handleSize;
GetWindowRect(hWnd,&handleSize);
ms.height=(handleSize.bottom-handleSize.top);
ms.width=(handleSize.right-handleSize.left);
inputManager->setOIS(oisMouse,oisKeyboard);
//<- OIS and InputManager setup
menuTest.Setup();
int result=menuTest.Run();
if(result==3)
{
//run options menu
optTest.Setup();
result=optTest.Run();
}
timeBeginPeriod(1);
float old_time=(float)timeGetTime();
float time=(float)timeGetTime();
float elapsed=time-old_time;
pgdk::dbCreateObjectSphere(10.0f,12,12,1);
*/
int oID=pgdk::dbCreateObjectCube(10.0f,1);
do
{
//Input Capture for both OIS and Wtld
//inputManager->capture();
//Just something to do
pgdk::dbControlCameraUsingArrowKeys(0,4.0f,2.5f);
//Rendering everything
pgdk::dbSync();
}while(windowEvent() != WM_CLOSE && !pgdk::dbKeyState(VK_ESCAPE));
//timeEndPeriod(5);
pgdk::dbCloseScreen();
//OIS::InputManager::destroyInputSystem(oisManager);
//ceguiRender->destroySystem();
return 0;
}
In regards to the strange namespaces, the pgdk namespace contains all original PureGDK functions. The d13 namespace contains all of my wrapper functions and classes.
@WLGfx: Actually, putting all the PureGDK functions into a different namespace actually wasn't all that hard. All I did was put
at the beginning of each header and source file and closed it at the end with
. Since PureGDK isn't statically linked to your program, you can pretty much edit the interface code to your heart's content.