X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=5a5b0f10bc7b8481649b32633c44ef89bc31931c;hb=253b1aa9cfce1e8b1fc12b74d96a7808f615d783;hp=e064f99d2362aad372358a5665b4b947c526ad5b;hpb=9e06cb73424ca3f0eb971350c5dfb3cdaec0d5bf;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index e064f99..5a5b0f1 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -237,21 +237,25 @@ void initGL(){ } static void toggleFullscreen(){ - SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); - //~ SDL_Surface* screen=SDL_GetVideoSurface(); - //~ Uint32 flags=screen->flags; - //~ screen=SDL_SetVideoMode(0,0,0,flags^SDL_FULLSCREEN); - //~ if(!screen) - //~ screen=SDL_SetVideoMode(0,0,0,flags); - //~ if(!screen) - //~ exit(1); - //~ //reload opengl state - //~ initGL(); - //~ for(std::vector::iterator it=Game::textures.begin(); it!=Game::textures.end(); it++) { - //~ it->load(); - //~ } - //~ pgame->text.BuildFont(); - //~ pgame->LoadScreenTexture(); + if(!SDL_WM_ToggleFullScreen(SDL_GetVideoSurface())){ + SDL_Surface* screen=SDL_GetVideoSurface(); + Uint32 flags=screen->flags; + screen=SDL_SetVideoMode(0,0,0,flags^SDL_FULLSCREEN); + if(!screen) + screen=SDL_SetVideoMode(0,0,0,flags); + if(!screen) + exit(1); + //reload opengl state + initGL(); + Texture::reloadAll(); + if(text) + text->BuildFont(); + if(firstload){ + screentexture=0; + LoadScreenTexture(); + } + screentexture2=0; + } } static void sdlEventProc(const SDL_Event &e) @@ -892,8 +896,10 @@ static bool load_png(const char *file_name, TGAImageRec &tex) png_byte **row_pointers = NULL; FILE *fp = fopen(file_name, "rb"); - if (fp == NULL) + if (fp == NULL) { + cerr << file_name << " not found" << endl; return(NULL); + } png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) @@ -957,8 +963,11 @@ static bool load_png(const char *file_name, TGAImageRec &tex) tex.sizeY = height; tex.bpp = 32; retval = true; - + png_done: + if(!retval) { + cerr << "There was a problem loading " << file_name << endl; + } png_destroy_read_struct(&png_ptr, &info_ptr, NULL); if (fp) fclose(fp);