A menu that uses animations can now choose not to throttle FPS to 35. This means credits and feature unlocked are now smoother

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4251 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2009-12-06 02:19:37 +00:00
parent 62f3ea1411
commit 957fc9281b
7 changed files with 18 additions and 1 deletions

View File

@@ -42,6 +42,8 @@ using namespace GUIEngine;
Screen::Screen(const char* file)
{
throttleFPS = true;
m_mouse_x = 0;
m_mouse_y = 0;
this->m_filename = file;

View File

@@ -93,6 +93,8 @@ namespace GUIEngine
bool m_render_3d;
public:
bool throttleFPS;
ptr_vector<Widget, HOLD> m_widgets;
// current mouse position, read-only...

View File

@@ -78,7 +78,7 @@ float MainLoop::getLimitedDt()
// Throttle fps if more than maximum, which can reduce
// the noise the fan on a graphics card makes.
// When in menus, reduce FPS much, it's not necessary to push to the maximum for plain menus
const int max_fps = (StateManager::get()->getGameState() == GUIEngine::GAME ? UserConfigParams::m_max_fps : 35);
const int max_fps = (StateManager::get()->throttleFPS() ? 35 : UserConfigParams::m_max_fps);
const int current_fps = (int)(1000.0f/dt);
if( current_fps > max_fps )
{

View File

@@ -77,6 +77,8 @@ namespace GUIEngine
{
reset();
throttleFPS = false;
std::string creditsfile = file_manager->getDataDir() + "/CREDITS";
std::ifstream file( creditsfile.c_str() ) ;

View File

@@ -18,6 +18,7 @@ FeatureUnlockedCutScene::FeatureUnlockedCutScene() : Screen("feature_unlocked.st
{
setNeeds3D(true);
throttleFPS = false;
m_unlocked_kart = NULL;
m_unlocked_thing_picture = NULL;
}

View File

@@ -18,7 +18,9 @@
#include "states_screens/state_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/screen.hpp"
#include "input/input_manager.hpp"
#include "states_screens/dialogs/race_paused_dialog.hpp"
#include "utils/translation.hpp"
@@ -100,6 +102,11 @@ void StateManager::resetActivePlayers()
m_active_players.clearWithoutDeleting();
}
bool StateManager::throttleFPS()
{
return m_game_mode != GUIEngine::GAME && GUIEngine::getCurrentScreen()->throttleFPS;
}
void StateManager::escapePressed()
{
// in input sensing mode

View File

@@ -44,6 +44,7 @@ class StateManager : public GUIEngine::AbstractStateManager
void updateActivePlayerIDs();
public:
ptr_vector<ActivePlayer, HOLD>& getActivePlayers();
ActivePlayer* getActivePlayer(const int id);
@@ -59,6 +60,8 @@ public:
int activePlayerCount();
void resetActivePlayers();
bool throttleFPS();
void escapePressed();
//void eventCallback(GUIEngine::Widget* widget, const std::string& name);