From: <mk...@us...> - 2003-07-22 16:38:14
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv25160/Source Modified Files: LogoScreen.cpp Log Message: Index: LogoScreen.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/LogoScreen.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** LogoScreen.cpp 26 Jun 2003 09:25:23 -0000 1.10 --- LogoScreen.cpp 22 Jul 2003 16:38:10 -0000 1.11 *************** *** 33,36 **** --- 33,37 ---- #include "LogoScreen.h" + #include "Exception.h" #include "Config.h" *************** *** 59,65 **** std::string path = simdata::ospath::join(image_path, "CSPLogo.bmp"); m_image = SDL_LoadBMP(path.c_str()); ! if (m_image == NULL) ! { ! std::cout << "Unable to load bitmap " << path << std::endl; } } --- 60,65 ---- std::string path = simdata::ospath::join(image_path, "CSPLogo.bmp"); m_image = SDL_LoadBMP(path.c_str()); ! if (m_image == NULL) { ! throw csp::DataError("Unable to load bitmap " + path); } } *************** *** 67,101 **** void LogoScreen::onExit() { ! SDL_FreeSurface(m_image); } void LogoScreen::onRender() { ! if (!m_image) ! return; ! ! SDL_Rect src, dest; ! src.x = 0; ! src.y = 0; ! src.w = m_image->w; ! src.h = m_image->h; ! dest.x = 0; ! dest.y = 0; ! dest.w = m_image->w; ! dest.h = m_image->h; ! glViewport(0, 0, m_width, m_height); ! glMatrixMode(GL_PROJECTION); ! glLoadIdentity(); ! glOrtho(0.0, m_width, 0.0, m_height, -1.0, 1.0); ! // this centers the bitmap in case its a different size then the screen. ! glRasterPos2i( ((m_width - m_image->w) >> 1), ! m_height - ((m_height - m_image->h) >> 1) ); ! glPixelZoom(1.0,-1.0); ! glDrawPixels(m_image->w, m_image->h, GL_RGB, GL_UNSIGNED_BYTE, m_image->pixels); } --- 67,102 ---- void LogoScreen::onExit() { ! if (m_image) { ! SDL_FreeSurface(m_image); ! } } void LogoScreen::onRender() { ! if (!m_image) return; ! SDL_Rect src, dest; ! src.x = 0; ! src.y = 0; ! src.w = m_image->w; ! src.h = m_image->h; ! dest.x = 0; ! dest.y = 0; ! dest.w = m_image->w; ! dest.h = m_image->h; ! glViewport(0, 0, m_width, m_height); ! glMatrixMode(GL_PROJECTION); ! glLoadIdentity(); ! glOrtho(0.0, m_width, 0.0, m_height, -1.0, 1.0); ! // this centers the bitmap in case its a different size then the screen. ! glRasterPos2i( ((m_width - m_image->w) >> 1), ! m_height - ((m_height - m_image->h) >> 1) ); ! glPixelZoom(1.0,-1.0); ! ! glDrawPixels(m_image->w, m_image->h, GL_RGB, GL_UNSIGNED_BYTE, m_image->pixels); } |