*******************************************************************************/
#include "Dispatch.hh"
-#include "Engine.hh"
#include "Error.hh"
#include "Image.hh"
#include "Log.hh"
setCursorVisible(attribs.cursorVisible);
setCursorGrab(attribs.cursorGrab);
setVideoMode(attribs.mode);
+
+ video = this;
}
void Video::recreateContext()
Video::~Video()
{
SDL_FreeSurface(mContext);
+
+ if (video == this) video = 0;
}
mAttribs.mode[1] = mode[1];
mAttribs.mode[2] = mode[2];
-#if defined(_WIN32) || defined(__WIN32__)
- // 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::getInstance().dispatch("video.newcontext");
-
+#if !defined(linux) && !defined(__linux) && !defined(__linux__)
logInfo("video context recreated");
+ core.dispatch("video.newcontext");
#endif
}
- else throw Error(Error::SDL_VIDEOMODE);
+ else Error(Error::SDL_VIDEOMODE).raise();
}
}
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;
cursorVisible = true;
cursorGrab = false;
- Settings& settings = Settings::getInstance();
-
std::vector<long> colors;
settings.get("colorbuffers", colors);
if (colors.size() > 0) colorBuffer[0] = colors[0];
}
else
{
- while (*(modes + 1)) ++modes; // skip to the last
-
mode[0] = (*modes)->w;
mode[1] = (*modes)->h;
Mf::logInfo << "choosing native resolution "
}
+Video* video = 0;
+
+
} // namespace Mf
/** vim: set ts=4 sw=4 tw=80: *************************************************/