void ParticleSystem::PushOpenGLStates(sf::RenderWindow& target) const { // Switch to manual OpenGL handling, save SFML's state target.SaveGLStates(); target.SetActive(); // Switch blend mode, depending on glow effect if (mGlow) glBlendFunc(GL_SRC_ALPHA, GL_ONE); else glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); // Store attributes and assign them glPushAttrib(GL_DEPTH_BITS | GL_TEXTURE_BIT); glDisable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, mTexture->id); // Initialize projection matrix (2D view) glMatrixMode(GL_PROJECTION); glPushMatrix(); detail::SetupOpenGL2DView(target.GetView()); // Initialize modelview matrix (will be edited in Particle::Render()) glMatrixMode(GL_MODELVIEW); glPushMatrix(); }
void KeyboardMenu::Display(sf::RenderWindow& Window, VerticalPositions VPos, HorizontalPositions HPos) { Window.SetActive(true); sf::String DisplayString; DisplayString.SetFont(font); DisplayString.SetSize(default_size); DisplayString.SetColor(sf::Color::Red); int startHeight; int Height; if(menu_options.size() > 10) { throw std::runtime_error("Not Implemented: Option List Larger than 10"); } else { if(VPos == VerticalPositions::TOP) { startHeight = Height = 10; for(int i = 0; i < menu_options.size(); i++) { DisplayString.SetText(key_list[i].OutputString + " : " + menu_options[i]); set_string_position(DisplayString, Height, Window.GetWidth()); Window.Draw(DisplayString); Height += default_size + 10; } } else { startHeight = Height = Window.GetHeight() - 10; for(int i = menu_options.size() - 1; i >= 0; i--) { DisplayString.SetText(key_list[i].OutputString + " : " + menu_options[i]); Height -= DisplayString.GetRect().GetHeight(); set_string_position(DisplayString, Height, Window.GetWidth()); Window.Draw(DisplayString); Height -= 10; } } } }