void CGameConfig::Keyb (unsigned int key, bool special, bool release, int x, int y) {
	if (release) return;

	if (key != SDLK_UP && key != SDLK_DOWN)
		KeyGUI(key, 0, release);
	switch (key) {
		case SDLK_q:
			State::manager.RequestQuit();
			break;
		case SDLK_ESCAPE:
			State::manager.RequestEnterState (*State::manager.PreviousState());
			break;
		case SDLK_RETURN:
			if (textbuttons[0]->focussed())
				State::manager.RequestEnterState (*State::manager.PreviousState());
			else if (textbuttons[1]->focussed())
				SetConfig ();
			break;
		case SDLK_UP:
			DecreaseFocus();
			break;
		case SDLK_DOWN:
			IncreaseFocus();
			break;
	}
}
Esempio n. 2
0
TWidget* KeyGUI(unsigned int key, unsigned int mod, bool released) {
	if (!released) {
		switch (key) {
			case SDLK_TAB:
				IncreaseFocus();
				break;
			default:
				break;
		}
	}
	if (focussed == -1)
		return 0;
	Widgets[focussed]->Key(key, mod, released);
	return Widgets[focussed];
}