Beispiel #1
0
void EventKeys (unsigned int key, bool special, bool release, int x, int y) {
    if (release) return;
    switch (key) {
    case 13:
        if (curr_focus < 1 && ready < 1) StartRace ();
        else Winsys.SetMode (EVENT_SELECT);
        break;
    case 27:
        Winsys.SetMode (EVENT_SELECT);
        break;
    case SDLK_TAB:
        if (ready > 0) {
            curr_focus = 2;
        } else {
            if (curr_focus < 1) curr_focus = 1;
            else curr_focus = 0;
        }
        break;
    case SDLK_LEFT:
        if (curr_focus < 1) curr_focus = 1;
        break;
    case SDLK_RIGHT:
        if (curr_focus == 1) curr_focus = 0;
        break;
    case SDLK_u:
        param.ui_snow = !param.ui_snow;
        break;
    }
}
void CEvent::Mouse (int button, int state, int x, int y) {
	if (state != 1) return;

	TWidget* clicked = ClickGUI(x, y);
	if(clicked == textbuttons[0]) {
		if (ready < 1)
			StartRace ();
	} else if(clicked == textbuttons[1] || clicked == textbuttons[2])
		State::manager.RequestEnterState (EventSelect);
}
Beispiel #3
0
void EventMouseFunc (int button, int state, int x, int y ) {
    int foc, dr;
    if (state != 1) return;

    GetFocus (x, y, &foc, &dr);
    if (ready < 1) {
        if (foc >= 0) {
            if (foc == 0) StartRace ();
            else Winsys.SetMode (EVENT_SELECT);
        }
    } else Winsys.SetMode (EVENT_SELECT);
}
void CEvent::Keyb (unsigned int key, bool special, bool release, int x, int y) {
    if (release) return;
	switch (key) {
	case SDLK_RETURN:
		if (curr_focus == textbuttons[0] && ready < 1) StartRace ();
		else State::manager.RequestEnterState (EventSelect);
		break;
	case SDLK_ESCAPE:
		State::manager.RequestEnterState (EventSelect);
		break;
	case SDLK_TAB:
		if (ready > 0) {
			curr_focus = textbuttons[2];
		} else {
			if (curr_focus == textbuttons[0]) curr_focus = textbuttons[1]; else curr_focus = textbuttons[0];
		}
		break;
	case SDLK_LEFT: if (curr_focus == textbuttons[0]) curr_focus = textbuttons[1]; break;
	case SDLK_RIGHT: if (curr_focus == textbuttons[1]) curr_focus = textbuttons[0]; break;
	case SDLK_u: param.ui_snow = !param.ui_snow; break;
	}
}