CGenericCanvas::CGenericCanvas(GCContext Context, wstring name): CGCBase(NULL) { FCanvas = this; _className = "CGenericCanvas"; FName = name; FContext = Context; FCurrentView = NULL; FStates = 0; #ifdef _WINDOWS InitializeCriticalSection(&FLock); #else g_static_rec_mutex_init(&FLock); #endif FListener.canvas = this; FModel = new CGCModel(this); FModel->addListener(&FListener); FAnimationManager = new CAnimationManager(this); determineExtensions(); initializeOpenGLExtensions(); // Set a new lock on the font manager (and create it by the way if not yet done). lockFontManager(); }
GraphicsDevice::GraphicsDevice(const ivec2 &windowSize, bool fullscreen, bool resizable, bool showcursor, const char * title) : windowSurface(0), dimensions(0,0), nearClip(0.1f), farClip(100.0f) { attr = generateDefaultAttributes(); setAttributes(); if(title) { SDL_WM_SetCaption(title, title); } else { SDL_WM_SetCaption("SDL App", "SDL App"); } windowSurface = SDL_SetVideoMode(windowSize.x, windowSize.y, 0, SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | (resizable?SDL_RESIZABLE:0) | (fullscreen?SDL_FULLSCREEN:0)); #ifdef _WIN32 /* See: <http://listas.apesol.org/pipermail/sdl-libsdl.org/2002-July/028824.html> Sometimes, after calling SDL_SetVideoMode, MessageBox and standard assert (which calls MessageBox internally) will return immediately without displaying a message box window. */ flushMessageQueue(); #endif assert(windowSurface && "Couldn't create window!"); initializeOpenGLExtensions(); resizeOpenGLViewport(windowSize, nearClip, farClip); SDL_ShowCursor(showcursor ? SDL_ENABLE : SDL_DISABLE); }