mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
centralize cursor drawing
This commit is contained in:
@ -1582,9 +1582,7 @@ void CPlayerInterface::update()
|
|||||||
GH.drawFPSCounter();
|
GH.drawFPSCounter();
|
||||||
|
|
||||||
// draw the mouse cursor and update the screen
|
// draw the mouse cursor and update the screen
|
||||||
CCS->curh->drawWithScreenRestore();
|
CCS->curh->render();
|
||||||
CSDL_Ext::update(screen);
|
|
||||||
CCS->curh->drawRestored();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPlayerInterface::getLastIndex( std::string namePrefix)
|
int CPlayerInterface::getLastIndex( std::string namePrefix)
|
||||||
|
@ -543,9 +543,7 @@ void CGPreGame::update()
|
|||||||
GH.drawFPSCounter();
|
GH.drawFPSCounter();
|
||||||
|
|
||||||
// draw the mouse cursor and update the screen
|
// draw the mouse cursor and update the screen
|
||||||
CCS->curh->drawWithScreenRestore();
|
CCS->curh->render();
|
||||||
CSDL_Ext::update(screen);
|
|
||||||
CCS->curh->drawRestored();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGPreGame::openCampaignScreen(std::string name)
|
void CGPreGame::openCampaignScreen(std::string name)
|
||||||
|
@ -223,6 +223,14 @@ void CCursorHandler::centerCursor()
|
|||||||
SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE);
|
SDL_EventState(SDL_MOUSEMOTION, SDL_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCursorHandler::render()
|
||||||
|
{
|
||||||
|
drawWithScreenRestore();
|
||||||
|
CSDL_Ext::update(screen);
|
||||||
|
drawRestored();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CCursorHandler::~CCursorHandler()
|
CCursorHandler::~CCursorHandler()
|
||||||
{
|
{
|
||||||
if(help)
|
if(help)
|
||||||
|
@ -32,6 +32,13 @@ class CCursorHandler
|
|||||||
CAnimImage * dndObject; //if set, overrides currentCursor
|
CAnimImage * dndObject; //if set, overrides currentCursor
|
||||||
bool showing;
|
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:
|
public:
|
||||||
/// position of cursor
|
/// position of cursor
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
@ -54,12 +61,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void dragAndDropCursor (CAnimImage * image);
|
void dragAndDropCursor (CAnimImage * image);
|
||||||
|
|
||||||
/// Draw cursor preserving original image below cursor
|
void render();
|
||||||
void drawWithScreenRestore();
|
|
||||||
/// Restore original image below cursor
|
|
||||||
void drawRestored();
|
|
||||||
/// Simple draw cursor
|
|
||||||
void draw(SDL_Surface *to);
|
|
||||||
|
|
||||||
void shiftPos( int &x, int &y );
|
void shiftPos( int &x, int &y );
|
||||||
void hide() { showing=0; };
|
void hide() { showing=0; };
|
||||||
|
Reference in New Issue
Block a user