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:
parent
022f71c26e
commit
e521e6687a
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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; };
|
||||
|
Loading…
Reference in New Issue
Block a user