Add 'global' idle for demo mode

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11202 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-05-07 23:59:16 +00:00
parent c74fa3fcf0
commit b12e73fe5c
3 changed files with 18 additions and 8 deletions

View File

@ -653,6 +653,7 @@ namespace GUIEngine
#include "guiengine/screen.hpp"
#include "guiengine/skin.hpp"
#include "guiengine/widget.hpp"
#include "modes/demo_world.hpp"
#include "modes/world.hpp"
#include "states_screens/race_gui_base.hpp"
@ -1168,6 +1169,20 @@ namespace GUIEngine
g_driver->enableMaterial2D(false);
if (gamestate == MENU)
{
if (DemoWorld::updateIdleTimeAndStartDemo(elapsed_time))
{
return;
}
}
else
{
DemoWorld::resetIdleTime();
}
} // render
// -----------------------------------------------------------------------

View File

@ -30,6 +30,7 @@
#include "guiengine/widgets/list_widget.hpp"
#include "guiengine/widgets/ribbon_widget.hpp"
#include "input/input_manager.hpp"
#include "modes/demo_world.hpp"
#include "modes/world.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/profiler.hpp"
@ -657,6 +658,8 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
if (event.GUIEvent.Caller == NULL) return EVENT_LET;
const s32 id = event.GUIEvent.Caller->getID();
DemoWorld::resetIdleTime();
switch (event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:

View File

@ -136,13 +136,6 @@ void MainMenuScreen::init()
// ----------------------------------------------------------------------------
void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
{
// If a demo mode is started, do nothing more
if(DemoWorld::updateIdleTimeAndStartDemo(delta))
{
//StateManager::get()->popMenu();
return;
}
IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons");
if (addons_icon != NULL)
{
@ -186,7 +179,6 @@ void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
const int playerID)
{
DemoWorld::resetIdleTime();
// most interesting stuff is in the ribbons, so start there
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);