1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| #include <Ogre.h>
using namespace Ogre;
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
try
{
Root* root=new Root();
if(!root->restoreConfig())
{
if(!root->showConfigDialog())
{
delete root;
return -1;
}
}
RenderWindow* fenetreprincipale = NULL;
SceneManager* scenemanager = NULL;
fenetreprincipale = root->initialise(false, "Test");
scenemanager = root->createSceneManager(ST_GENERIC, "Scene1");
ConfigFile ressource;
ressource.load("resources.cfg");
ConfigFile::SectionIterator iterator = ressource.getSectionIterator();
String secNom, typeArch, cheminArch;
while(iterator.hasMoreElements())
{
secNom = iterator.peekNextKey();
ConfigFile::SettingsMultiMap *settings = iterator.getNext();
ConfigFile::SettingsMultiMap::iterator it;
for (it=settings->begin(); it!=settings->end();++it)
{
typeArch = it->first;
cheminArch = it->second;
ResourceGroupManager::getSingleton().addResourceLocation(cheminArch,typeArch,secNom);
}
}
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Entity* pEntity=scenemanager->createEntity("Ogre Head","OgreHead.mesh");
SceneNode* pNode=scenemanager->getRootSceneNode()->createChildSceneNode("Node");
pNode->attachObject(pEntity);
delete root;
}
catch(Ogre::Exception e)
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox(NULL,(LPCSTR) e.getFullDescription().c_str(),
"Erreur d'initialisation de l'objet Root",MB_OK|MB_ICONERROR|MB_TASKMODAL);
#else
std::cerr << "Une exception a été levée: " << e.getFullDescription().c_str() << std::endl;
#endif
}
return 0;
} |
Partager