added cleaner exit on quit event by Choupom

This commit is contained in:
oy 2010-12-11 22:04:50 +01:00
parent eb569e60bd
commit ecd7afd9ff
4 changed files with 8 additions and 7 deletions

View file

@ -1856,7 +1856,8 @@ void CClient::Run()
}
// update input
Input()->Update();
if(Input()->Update())
break; // SDL_QUIT
// update sound
Sound()->Update();

View file

@ -108,7 +108,7 @@ int CInput::KeyState(int Key)
return m_aInputState[m_InputCurrent][Key];
}
void CInput::Update()
int CInput::Update()
{
if(m_InputGrabbed && !Graphics()->WindowActive())
MouseModeAbsolute();
@ -185,9 +185,7 @@ void CInput::Update()
// other messages
case SDL_QUIT:
// TODO: cleaner exit
exit(0); // ignore_convention
break;
return 1;
}
//
@ -201,6 +199,8 @@ void CInput::Update()
}
}
return 0;
}

View file

@ -31,7 +31,7 @@ public:
int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; }
virtual void Update();
virtual int Update();
};
#endif

View file

@ -83,7 +83,7 @@ class IEngineInput : public IInput
MACRO_INTERFACE("engineinput", 0)
public:
virtual void Init() = 0;
virtual void Update() = 0;
virtual int Update() = 0;
};
extern IEngineInput *CreateEngineInput();