1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Fixed bug #722. GuiBase::Run is now mostly in its old state. (before rev 2062) One disadvantage is now that the FPS Counter doesn't work in battle.

This commit is contained in:
beegee1
2011-04-13 19:52:56 +00:00
parent 3c5a0fd4ce
commit d6bd8514e7
3 changed files with 24 additions and 19 deletions

View File

@@ -1328,11 +1328,21 @@ void CPlayerInterface::update()
if(adventureInt && !adventureInt->selection && GH.topInt() == adventureInt) if(adventureInt && !adventureInt->selection && GH.topInt() == adventureInt)
return; return;
// Handles mouse and key input
GH.updateTime();
GH.handleEvents();
if(adventureInt && !adventureInt->isActive() && adventureInt->scrollingDir) //player forces map scrolling though interface is disabled if(adventureInt && !adventureInt->isActive() && adventureInt->scrollingDir) //player forces map scrolling though interface is disabled
GH.totalRedraw(); GH.totalRedraw();
else else
GH.simpleRedraw(); GH.simpleRedraw();
// draw the mouse cursor and update the screen
// todo: bad way of updating the cursor, update screen should be the last statement of the rendering process
CCS->curh->draw1();
CSDL_Ext::update(screen);
CCS->curh->draw2();
pim->unlock(); pim->unlock();
} }

View File

@@ -351,7 +351,17 @@ void CGPreGame::update()
if(SEL) if(SEL)
SEL->update(); SEL->update();
// draw the mouse cursor and update the screen
// todo: bad way of updating the cursor, update screen should be the last statement of the rendering process
CCS->curh->draw1();
CSDL_Ext::update(screen);
CCS->curh->draw2();
GH.topInt()->show(screen); GH.topInt()->show(screen);
// Handles mouse and key input
GH.updateTime();
GH.handleEvents();
} }
CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map<ui32, std::string> *Names /*= NULL*/) CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map<ui32, std::string> *Names /*= NULL*/)

View File

@@ -105,7 +105,8 @@ IShowActivable * CGuiHandler::topInt()
void CGuiHandler::totalRedraw() void CGuiHandler::totalRedraw()
{ {
this->invalidateTotalRedraw = true; //this->invalidateTotalRedraw = true;
internalTotalRedraw();
} }
void CGuiHandler::internalTotalRedraw() void CGuiHandler::internalTotalRedraw()
@@ -314,7 +315,8 @@ void CGuiHandler::handleMouseMotion(SDL_Event *sEvent)
void CGuiHandler::simpleRedraw() void CGuiHandler::simpleRedraw()
{ {
this->invalidateSimpleRedraw = true; //this->invalidateSimpleRedraw = true;
internalSimpleRedraw();
} }
void CGuiHandler::internalSimpleRedraw() void CGuiHandler::internalSimpleRedraw()
@@ -368,27 +370,10 @@ void CGuiHandler::run()
if(curInt) if(curInt)
curInt->update(); // calls a update and drawing process of the loaded game interface object at the moment curInt->update(); // calls a update and drawing process of the loaded game interface object at the moment
// Handles mouse and key input
GH.updateTime();
GH.handleEvents();
// Redraws the GUI only once during rendering
if (this->invalidateTotalRedraw == true)
internalTotalRedraw();
if (this->invalidateSimpleRedraw == true)
internalSimpleRedraw();
if (conf.cc.showFPS) if (conf.cc.showFPS)
drawFPSCounter(); drawFPSCounter();
mainFPSmng->framerateDelay(); // holds a constant FPS mainFPSmng->framerateDelay(); // holds a constant FPS
// draw the mouse cursor and update the screen
// todo: bad way of updating the cursor, update screen should be the last statement of the rendering process
CCS->curh->draw1();
CSDL_Ext::update(screen);
CCS->curh->draw2();
} }
} HANDLE_EXCEPTION } HANDLE_EXCEPTION
} }