]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Video.cc
refactoring needed for win32 crash
[chaz/yoink] / src / Moof / Video.cc
index 544e172ad7a00dac196867689e69c8429fd7e0be..9e74acbf2b75dae0b09cb53f17883ed1eb4063b8 100644 (file)
@@ -27,7 +27,6 @@
 *******************************************************************************/
 
 #include "Dispatch.hh"
-#include "Engine.hh"
 #include "Error.hh"
 #include "Image.hh"
 #include "Log.hh"
@@ -76,6 +75,8 @@ void Video::init(const Attributes& attribs)
        setCursorVisible(attribs.cursorVisible);
        setCursorGrab(attribs.cursorGrab);
        setVideoMode(attribs.mode);
+
+       video = this;
 }
 
 void Video::recreateContext()
@@ -110,6 +111,8 @@ void Video::setOpenGLAttributes()
 Video::~Video()
 {
        SDL_FreeSurface(mContext);
+
+       if (video == this) video = 0;
 }
 
 
@@ -132,8 +135,7 @@ void Video::setVideoMode(const long mode[3])
                        // on win32, creating a new context via SDL_SetVideoMode will wipe
                        // out the GL state, so we gotta notify everyone to reload their
                        // state after the change
-                       engine.dispatch("video.newcontext");
-
+                       core.dispatch("video.newcontext");
                        logInfo("video context recreated");
 #endif
                }
@@ -296,7 +298,7 @@ int Video::getHeight() const
 
 Video::Attributes::Attributes()
 {
-       // Set some sane GL and window defaults (see SDL_video.c:217)
+       // set some sane GL and window defaults (see SDL_video.c:217)
        colorBuffer[0] = 3;
        colorBuffer[1] = 3;
        colorBuffer[2] = 2;
@@ -322,8 +324,6 @@ Video::Attributes::Attributes()
        cursorVisible = true;
        cursorGrab = false;
 
-       Settings& settings = Settings::getInstance();
-
        std::vector<long> colors;
        settings.get("colorbuffers", colors);
        if (colors.size() > 0) colorBuffer[0] = colors[0];
@@ -395,6 +395,9 @@ Video::Attributes::Attributes()
 }
 
 
+Video* video = 0;
+
+
 } // namespace Mf
 
 /** vim: set ts=4 sw=4 tw=80: *************************************************/
This page took 0.023084 seconds and 4 git commands to generate.