void PauseMenuMode::Start() { mButtonPressed = -1; // get the last frame rendered glReadBuffer(GL_FRONT); //glPixelStorei(GL_PACK_ALIGNMENT,1); unsigned char *buf = (unsigned char *)malloc(sizeof(char) * 3 * mGameWindow->GetWidth() * mGameWindow->GetHeight()); glReadPixels(0, 0, mGameWindow->GetWidth(), mGameWindow->GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, buf); // bind it to a texture glGenTextures(1, &mBackgroundTexture); glBindTexture(GL_TEXTURE_2D, mBackgroundTexture); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, mGameWindow->GetWidth(), mGameWindow->GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, buf); free(buf); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); mNextMode = NULL; InputManager *im = mGameWindow->GetInputManager(); im->AddKeyEvent(&mResume, SDLK_ESCAPE); im->AddMouseEvent(&mClick, IM_MOUSE_LEFT_BUTTON); im->ResetAllInputEvents(); mGameWindow->SetOrthographicProjection(); }
void CharacterSelectMode::Start() { mButtonPressed = -1; glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); mNextMode = NULL; InputManager *im = mGameWindow->GetInputManager(); im->AddMouseEvent(&mClick, IM_MOUSE_LEFT_BUTTON); im->ResetAllInputEvents(); mGameWindow->SetOrthographicProjection(); Vector3 zeroVec; mSarge.Initialize(mWorldMode, 10, 10, 0, 0, 0, 0, zeroVec, zeroVec, 0); mScrappy.Initialize(mWorldMode, 10, 10, 0, 0, 0, 0, zeroVec, zeroVec, 0); }