int MainMenu::runScene() { int buttonPressed = -2; SystemRenderUpdater sysRenderer; SystemLogicUpdater sysLogic; SceneManager* sceneMan = SceneManager::GetSceneManager(); auto planets = LoadTitleScreenProps(); while (true) { InputManager::getInstance()->update(); buttonPressed = checkButtons(); if (!konamiUnlocked) checkKonami(); switch (buttonPressed) { case BUTTON_PLAY: removeButtons(); sceneMan->RemoveAllObjects(); return SCENE_LOBBY; case BUTTON_QUIT: removeButtons(); return SCENE_END; } sysRenderer.RenderUpdate(GameObjects.alive_objects); sysLogic.LogicUpdate(GameObjects.alive_objects); SceneManager::GetSceneManager()->AssembleScene(); } }
void TextLineAdjuster::update(Observable*) { if (updating_) return; updating_ = true; bool need = needButtons(); if (need != have_) { if (need) addButtons(); else removeButtons(); reallocate(); redraw(); have_ = ! have_; } updating_ = false; }
void TrackButtons::slotUpdateTracks() { #if 0 RG_DEBUG << "TrackButtons::slotUpdateTracks()"; static QTime t; RG_DEBUG << " elapsed: " << t.restart(); #endif if (!m_doc) return; Composition &comp = m_doc->getComposition(); const int newNbTracks = comp.getNbTracks(); //RG_DEBUG << "TrackButtons::slotUpdateTracks > newNbTracks = " << newNbTracks; // If a track or tracks were deleted if (newNbTracks < m_tracks) { // For each deleted track, remove a button from the end. for (int i = m_tracks; i > newNbTracks; --i) removeButtons(i - 1); } else if (newNbTracks > m_tracks) { // if added // For each added track for (int i = m_tracks; i < newNbTracks; ++i) { Track *track = m_doc->getComposition().getTrackByPosition(i); if (track) { // Make a new button QFrame *trackHBox = makeButton(track); if (trackHBox) { trackHBox->show(); // Add the new button to the layout. m_layout->insertWidget(i, trackHBox); m_trackHBoxes.push_back(trackHBox); } } else RG_DEBUG << "TrackButtons::slotUpdateTracks - can't find TrackId for position " << i; } } m_tracks = newNbTracks; if (m_tracks != (int)m_trackHBoxes.size()) RG_DEBUG << "WARNING TrackButtons::slotUpdateTracks(): m_trackHBoxes.size() != m_tracks"; if (m_tracks != (int)m_trackLabels.size()) RG_DEBUG << "WARNING TrackButtons::slotUpdateTracks(): m_trackLabels.size() != m_tracks"; // For each track for (int i = 0; i < m_tracks; ++i) { Track *track = comp.getTrackByPosition(i); if (!track) continue; // *** Set Track Size *** // Track height can change when the user moves segments around and // they overlap. m_trackHBoxes[i]->setMinimumSize(labelWidth(), trackHeight(track->getId())); m_trackHBoxes[i]->setFixedHeight(trackHeight(track->getId())); } populateButtons(); // This is necessary to update the widgets's sizeHint to reflect any change in child widget sizes // Make the TrackButtons QFrame big enough to hold all the track buttons. // Some may have grown taller due to segments that overlap. // Note: This appears to no longer be needed. But it doesn't hurt. adjustSize(); }