1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

centralize cursor drawing

This commit is contained in:
AlexVinS 2014-07-03 15:10:01 +04:00
parent 022f71c26e
commit e521e6687a
4 changed files with 19 additions and 13 deletions

View File

@ -1582,9 +1582,7 @@ void CPlayerInterface::update()
GH.drawFPSCounter();
// draw the mouse cursor and update the screen
CCS->curh->drawWithScreenRestore();
CSDL_Ext::update(screen);
CCS->curh->drawRestored();
CCS->curh->render();
}
int CPlayerInterface::getLastIndex( std::string namePrefix)

View File

@ -543,9 +543,7 @@ void CGPreGame::update()
GH.drawFPSCounter();
// draw the mouse cursor and update the screen
CCS->curh->drawWithScreenRestore();
CSDL_Ext::update(screen);
CCS->curh->drawRestored();
CCS->curh->render();
}
void CGPreGame::openCampaignScreen(std::string name)

View File

@ -223,6 +223,14 @@ void CCursorHandler::centerCursor()
SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE);
}
void CCursorHandler::render()
{
drawWithScreenRestore();
CSDL_Ext::update(screen);
drawRestored();
}
CCursorHandler::~CCursorHandler()
{
if(help)

View File

@ -32,6 +32,13 @@ class CCursorHandler
CAnimImage * dndObject; //if set, overrides currentCursor
bool showing;
/// Draw cursor preserving original image below cursor
void drawWithScreenRestore();
/// Restore original image below cursor
void drawRestored();
/// Simple draw cursor
void draw(SDL_Surface *to);
public:
/// position of cursor
int xpos, ypos;
@ -53,13 +60,8 @@ public:
* cursor. CursorHandler takes ownership of object
*/
void dragAndDropCursor (CAnimImage * image);
/// Draw cursor preserving original image below cursor
void drawWithScreenRestore();
/// Restore original image below cursor
void drawRestored();
/// Simple draw cursor
void draw(SDL_Surface *to);
void render();
void shiftPos( int &x, int &y );
void hide() { showing=0; };