Added a more user friendly messagebox when network errors are encountered. Added fix for Fullscreen OpenGL Mode

This commit is contained in:
Mark Vejvoda
2010-03-17 16:27:17 +00:00
parent 7468e314d1
commit f0133ba260
2 changed files with 13 additions and 6 deletions

View File

@@ -50,7 +50,7 @@ Program::ShowMessageProgramState::ShowMessageProgramState(Program *program, cons
ProgramState(program) { ProgramState(program) {
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
userWantsExit = false;
msgBox.init("Ok"); msgBox.init("Ok");
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -85,6 +85,7 @@ void Program::ShowMessageProgramState::mouseDownLeft(int x, int y) {
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
program->exit(); program->exit();
userWantsExit = true;
} }
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -244,7 +245,7 @@ void Program::setState(ProgramState *programState)
//if(Socket::enableDebugText) printf("In [%s::%s] END\n",__FILE__,__FUNCTION__); //if(Socket::enableDebugText) printf("In [%s::%s] END\n",__FILE__,__FUNCTION__);
} }
void Program::exit(){ void Program::exit() {
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -345,11 +346,14 @@ void Program::showMessage(const char *msg) {
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
this->programState = new ShowMessageProgramState(this, msg); SDL_ShowCursor(SDL_ENABLE);
//SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
ShowMessageProgramState *showMsg = new ShowMessageProgramState(this, msg);
this->programState = showMsg;
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
while(Window::handleEvent()) { while(Window::handleEvent() && showMsg->wantExit() == false) {
loop(); loop();
} }
@@ -360,7 +364,8 @@ void Program::showMessage(const char *msg) {
//if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); //if(Socket::enableDebugText) printf("In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
init(window); //MainWindow *mainWindow= new MainWindow(this);
init(this->window);
setState(originalState); setState(originalState);
//this->programState = originalState; //this->programState = originalState;

View File

@@ -56,7 +56,7 @@ public:
virtual void mouseUpLeft(int x, int y){}; virtual void mouseUpLeft(int x, int y){};
virtual void mouseDownRight(int x, int y){}; virtual void mouseDownRight(int x, int y){};
virtual void mouseDoubleClickLeft(int x, int y){}; virtual void mouseDoubleClickLeft(int x, int y){};
virtual void mouseMove(int x, int y, const MouseState *mouseState){}; virtual void mouseMove(int x, int y, const MouseState *mouseState) {};
virtual void keyDown(char key){}; virtual void keyDown(char key){};
virtual void keyUp(char key){}; virtual void keyUp(char key){};
virtual void keyPress(char c){}; virtual void keyPress(char c){};
@@ -76,6 +76,7 @@ private:
int mouseY; int mouseY;
int mouse2dAnim; int mouse2dAnim;
string msg; string msg;
bool userWantsExit;
public: public:
ShowMessageProgramState(Program *program, const char *msg); ShowMessageProgramState(Program *program, const char *msg);
@@ -84,6 +85,7 @@ private:
virtual void mouseDownLeft(int x, int y); virtual void mouseDownLeft(int x, int y);
virtual void mouseMove(int x, int y, const MouseState &mouseState); virtual void mouseMove(int x, int y, const MouseState &mouseState);
virtual void update(); virtual void update();
virtual bool wantExit() { return userWantsExit; }
}; };