//----------------------------------------------------------------------------// void CEGuiBaseApplication::initialiseResourceGroupDirectories (const CEGUI::String& dataPathPrefixOverride) { // initialise the required dirs for the DefaultResourceProvider CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*> (CEGUI::System::getSingleton().getResourceProvider()); initDataPathPrefix(dataPathPrefixOverride); CEGUI::String dataPathPrefix(getDataPathPrefix()); /* for each resource type, set a resource group directory. We cast strings to "const CEGUI::utf8*" in order to support general Unicode strings, rather than only ASCII strings (even though currently they're all ASCII). */ rp->setResourceGroupDirectory("schemes", dataPathPrefix + "/schemes/"); rp->setResourceGroupDirectory("imagesets", dataPathPrefix + "/imagesets/"); rp->setResourceGroupDirectory("fonts", dataPathPrefix + "/fonts/"); rp->setResourceGroupDirectory("layouts", dataPathPrefix + "/layouts/"); rp->setResourceGroupDirectory("looknfeels", dataPathPrefix + "/looknfeel/"); rp->setResourceGroupDirectory("lua_scripts", dataPathPrefix + "/lua_scripts/"); rp->setResourceGroupDirectory("schemas", dataPathPrefix + "/xml_schemas/"); rp->setResourceGroupDirectory("animations", dataPathPrefix + "/animations/"); }
//----------------------------------------------------------------------------// void CEGuiBaseApplication::initialiseResourceGroupDirectories() { // initialise the required dirs for the DefaultResourceProvider CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*> (CEGUI::System::getSingleton().getResourceProvider()); const char* dataPathPrefix = getDataPathPrefix(); char resourcePath[PATH_MAX]; // for each resource type, set a resource group directory sprintf(resourcePath, "%s/%s", dataPathPrefix, "schemes/"); rp->setResourceGroupDirectory("schemes", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "imagesets/"); rp->setResourceGroupDirectory("imagesets", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "fonts/"); rp->setResourceGroupDirectory("fonts", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "layouts/"); rp->setResourceGroupDirectory("layouts", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "looknfeel/"); rp->setResourceGroupDirectory("looknfeels", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "lua_scripts/"); rp->setResourceGroupDirectory("lua_scripts", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "xml_schemas/"); rp->setResourceGroupDirectory("schemas", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "animations/"); rp->setResourceGroupDirectory("animations", resourcePath); }
//----------------------------------------------------------------------------// CEGuiD3D10BaseApplication::CEGuiD3D10BaseApplication() : pimpl(new CEGuiBaseApplicationImpl), d_lastTime(GetTickCount()), d_frames(0), d_FPS(0) { if (pimpl->d_window = Win32AppHelper::createApplicationWindow(800, 600)) { if (initialiseDirect3D(800, 600, true)) { // set the swap chain ptr into window data so we can get access // later. This is a bit of a hack, but saved us redesigning the // entire framework just for this. SetWindowLongPtr(pimpl->d_window, GWLP_USERDATA, (LONG_PTR)pimpl->d_swapChain); if (Win32AppHelper::initialiseDirectInput(pimpl->d_window, pimpl->d_directInput)) { pimpl->d_renderer = new CEGUI::DirectX10Renderer(pimpl->d_device, 0); // initialise the gui system new CEGUI::System(pimpl->d_renderer); // initialise the required dirs for the DefaultResourceProvider CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*> (CEGUI::System::getSingleton().getResourceProvider()); const char* dataPathPrefix = getDataPathPrefix(); char resourcePath[PATH_MAX]; // for each resource type, set a resource group directory sprintf(resourcePath, "%s/%s", dataPathPrefix, "schemes/"); rp->setResourceGroupDirectory("schemes", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "imagesets/"); rp->setResourceGroupDirectory("imagesets", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "fonts/"); rp->setResourceGroupDirectory("fonts", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "layouts/"); rp->setResourceGroupDirectory("layouts", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "looknfeel/"); rp->setResourceGroupDirectory("looknfeels", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "lua_scripts/"); rp->setResourceGroupDirectory("lua_scripts", resourcePath); #if defined(CEGUI_WITH_XERCES) && (CEGUI_DEFAULT_XMLPARSER == XercesParser) sprintf(resourcePath, "%s/%s", dataPathPrefix, "XMLRefSchema/"); rp->setResourceGroupDirectory("schemas", resourcePath); #endif CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative); return; } cleanupDirect3D(); } DestroyWindow(pimpl->d_window); } else { MessageBox(0, Win32AppHelper::CREATE_WINDOW_ERROR, Win32AppHelper::APPLICATION_NAME, MB_ICONERROR|MB_OK); } throw std::runtime_error("Windows Direct3D 10 application failed to " "initialise."); }
/************************************************************************* Constructor. *************************************************************************/ CEGuiOpenGLBaseApplication::CEGuiOpenGLBaseApplication() { // fake args for glutInit int argc = 1; const char* argv = "SampleApp"; // Do GLUT init glutInit(&argc, (char**)&argv); glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGBA); glutInitWindowSize(800, 600); glutInitWindowPosition(100, 100); glutCreateWindow("Crazy Eddie's GUI Mk-2 - Sample Application"); glutSetCursor(GLUT_CURSOR_NONE); d_renderer = new CEGUI::OpenGLRenderer(1024); new CEGUI::System(d_renderer); glutDisplayFunc(&CEGuiOpenGLBaseApplication::drawFrame); glutReshapeFunc(&CEGuiOpenGLBaseApplication::reshape); glutMotionFunc(&CEGuiOpenGLBaseApplication::mouseMotion); glutPassiveMotionFunc(&CEGuiOpenGLBaseApplication::mouseMotion); glutMouseFunc(&CEGuiOpenGLBaseApplication::mouseButton); glutKeyboardFunc(&CEGuiOpenGLBaseApplication::keyChar); glutSpecialFunc(&CEGuiOpenGLBaseApplication::keySpecial); #ifdef __FREEGLUT_EXT_H__ glutMouseWheelFunc(&CEGuiOpenGLBaseApplication::handleMouseWheel_freeglut); #endif // Set the clear color glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // initialise the required dirs for the DefaultResourceProvider CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*> (CEGUI::System::getSingleton().getResourceProvider()); #ifndef __APPLE__ const char* dataPathPrefix = getDataPathPrefix(); char resourcePath[PATH_MAX]; // for each resource type, set a resource group directory sprintf(resourcePath, "%s/%s", dataPathPrefix, "schemes/"); rp->setResourceGroupDirectory("schemes", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "imagesets/"); rp->setResourceGroupDirectory("imagesets", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "fonts/"); rp->setResourceGroupDirectory("fonts", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "layouts/"); rp->setResourceGroupDirectory("layouts", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "looknfeel/"); rp->setResourceGroupDirectory("looknfeels", resourcePath); sprintf(resourcePath, "%s/%s", dataPathPrefix, "lua_scripts/"); rp->setResourceGroupDirectory("lua_scripts", resourcePath); #if defined(CEGUI_WITH_XERCES) && (CEGUI_DEFAULT_XMLPARSER == XercesParser) sprintf(resourcePath, "%s/%s", dataPathPrefix, "XMLRefSchema/"); rp->setResourceGroupDirectory("schemas", resourcePath); #endif #else rp->setResourceGroupDirectory("schemes", "datafiles/schemes/"); rp->setResourceGroupDirectory("imagesets", "datafiles/imagesets/"); rp->setResourceGroupDirectory("fonts", "datafiles/fonts/"); rp->setResourceGroupDirectory("layouts", "datafiles/layouts/"); rp->setResourceGroupDirectory("looknfeels", "datafiles/looknfeel/"); rp->setResourceGroupDirectory("lua_scripts", "datafiles/lua_scripts/"); #if defined(CEGUI_WITH_XERCES) && (CEGUI_DEFAULT_XMLPARSER == XercesParser) rp->setResourceGroupDirectory("schemas", "XMLRefSchema/"); #endif #endif }