Removed custom Carbon message pump

actorid
Nikolay Kasyanov 12 years ago
parent adf54cb735
commit 3fded2d8bf

@ -23,29 +23,9 @@
#include <cstdlib> #include <cstdlib>
#include <stdexcept> #include <stdexcept>
#if defined(__APPLE__) && !defined(__LP64__)
#include <Carbon/Carbon.h>
#endif
using namespace Ogre; using namespace Ogre;
using namespace OEngine::Render; using namespace OEngine::Render;
#if defined(__APPLE__) && !defined(__LP64__)
CustomRoot::CustomRoot(const Ogre::String& pluginFileName,
const Ogre::String& configFileName,
const Ogre::String& logFileName)
: Ogre::Root(pluginFileName, configFileName, logFileName)
{}
bool CustomRoot::isQueuedEnd() const
{
return mQueuedEnd;
}
#endif
void OgreRenderer::cleanup() void OgreRenderer::cleanup()
{ {
delete mFader; delete mFader;
@ -68,34 +48,7 @@ void OgreRenderer::cleanup()
void OgreRenderer::start() void OgreRenderer::start()
{ {
//TODO: Check if we still need to do this if we're using SDL's
//message pump
#if defined(__APPLE__) && !defined(__LP64__)
// OSX Carbon Message Pump
do {
EventRef event = NULL;
EventTargetRef targetWindow;
targetWindow = GetEventDispatcherTarget();
// If we are unable to get the target then we no longer care about events.
if (!targetWindow) return;
// Grab the next event while possible
while (ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &event) == noErr)
{
// Dispatch the event
SendEventToEventTarget(event, targetWindow);
ReleaseEvent(event);
}
if (!mRoot->renderOneFrame()) {
break;
}
} while (!mRoot->isQueuedEnd());
#else
mRoot->startRendering(); mRoot->startRendering();
#endif
} }
void OgreRenderer::loadPlugins() void OgreRenderer::loadPlugins()
@ -188,11 +141,7 @@ void OgreRenderer::configure(const std::string &logPath,
// Disable logging // Disable logging
log->setDebugOutputEnabled(false); log->setDebugOutputEnabled(false);
#if defined(__APPLE__) && !defined(__LP64__)
mRoot = new CustomRoot("", "", "");
#else
mRoot = new Root("", "", ""); mRoot = new Root("", "", "");
#endif
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX) #if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
loadPlugins(); loadPlugins();

@ -27,18 +27,12 @@
#include "OgreTexture.h" #include "OgreTexture.h"
#include <OgreWindowEventUtilities.h> #include <OgreWindowEventUtilities.h>
#if defined(__APPLE__) && !defined(__LP64__)
#include <OgreRoot.h>
#endif
struct SDL_Window; struct SDL_Window;
struct SDL_Surface; struct SDL_Surface;
namespace Ogre namespace Ogre
{ {
#if !defined(__APPLE__) || defined(__LP64__)
class Root; class Root;
#endif
class RenderWindow; class RenderWindow;
class SceneManager; class SceneManager;
class Camera; class Camera;
@ -60,26 +54,11 @@ namespace OEngine
std::string icon; std::string icon;
}; };
#if defined(__APPLE__) && !defined(__LP64__)
class CustomRoot : public Ogre::Root {
public:
bool isQueuedEnd() const;
CustomRoot(const Ogre::String& pluginFileName = "plugins.cfg",
const Ogre::String& configFileName = "ogre.cfg",
const Ogre::String& logFileName = "Ogre.log");
};
#endif
class Fader; class Fader;
class OgreRenderer class OgreRenderer
{ {
#if defined(__APPLE__) && !defined(__LP64__)
CustomRoot *mRoot;
#else
Ogre::Root *mRoot; Ogre::Root *mRoot;
#endif
Ogre::RenderWindow *mWindow; Ogre::RenderWindow *mWindow;
SDL_Window *mSDLWindow; SDL_Window *mSDLWindow;
SDL_Surface *mWindowIconSurface; SDL_Surface *mWindowIconSurface;

Loading…
Cancel
Save