- fixed the cursor bug mentioned by claymore
This commit is contained in:
parent
c088889e7c
commit
343fdb70b2
|
@ -372,6 +372,7 @@ void Program::setState(ProgramState *programState, bool cleanupOldState)
|
||||||
|
|
||||||
bool msgBoxEnabled = msgBox.getEnabled();
|
bool msgBoxEnabled = msgBox.getEnabled();
|
||||||
|
|
||||||
|
bool showingOSCursor = isCursorShowing();
|
||||||
if(dynamic_cast<Game *>(programState) != NULL) {
|
if(dynamic_cast<Game *>(programState) != NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
@ -426,14 +427,16 @@ void Program::setState(ProgramState *programState, bool cleanupOldState)
|
||||||
updateCameraTimer.reset();
|
updateCameraTimer.reset();
|
||||||
fpsTimer.reset();
|
fpsTimer.reset();
|
||||||
|
|
||||||
Config &config = Config::getInstance();
|
if(showingOSCursor == false) {
|
||||||
if(config.getBool("No2DMouseRendering","false") == false) {
|
Config &config = Config::getInstance();
|
||||||
showCursor(false);
|
if(config.getBool("No2DMouseRendering","false") == false) {
|
||||||
}
|
showCursor(false);
|
||||||
sleep(0);
|
}
|
||||||
|
sleep(0);
|
||||||
|
|
||||||
if(dynamic_cast<Intro *>(programState) != NULL && msgBoxEnabled == true) {
|
if(dynamic_cast<Intro *>(programState) != NULL && msgBoxEnabled == true) {
|
||||||
showCursor(true);
|
showCursor(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
|
@ -131,6 +131,7 @@ int getScreenH();
|
||||||
|
|
||||||
void sleep(int millis);
|
void sleep(int millis);
|
||||||
|
|
||||||
|
bool isCursorShowing();
|
||||||
void showCursor(bool b);
|
void showCursor(bool b);
|
||||||
bool isKeyDown(int virtualKey);
|
bool isKeyDown(int virtualKey);
|
||||||
string getCommandLine();
|
string getCommandLine();
|
||||||
|
|
|
@ -848,23 +848,17 @@ void sleep(int millis) {
|
||||||
SDL_Delay(millis);
|
SDL_Delay(millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCursor(bool b) {
|
bool isCursorShowing() {
|
||||||
//int x,y;
|
|
||||||
//if(b) {
|
|
||||||
//SDL_GetMouseState( &x, &y );
|
|
||||||
//}
|
|
||||||
int state = SDL_ShowCursor(SDL_QUERY);
|
int state = SDL_ShowCursor(SDL_QUERY);
|
||||||
if( (state == SDL_DISABLE && b == false) ||
|
return (state == SDL_ENABLE);
|
||||||
(state == SDL_ENABLE && b == true)) {
|
}
|
||||||
|
|
||||||
|
void showCursor(bool b) {
|
||||||
|
if(isCursorShowing() == b) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_ShowCursor(b == true ? SDL_ENABLE : SDL_DISABLE);
|
SDL_ShowCursor(b == true ? SDL_ENABLE : SDL_DISABLE);
|
||||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
|
||||||
//if(b == true) {
|
|
||||||
//SDL_WM_GrabInput(SDL_GRAB_OFF);
|
|
||||||
//SDL_WarpMouse(x,y);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isKeyDown(int virtualKey) {
|
bool isKeyDown(int virtualKey) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user