X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=2593dd2f5acfcf3026be1d655ee35c54de11ff13;hb=68a192ca5b9f81833abb24501e22a590678f68b9;hp=f428eeb316f5b49587097ec58240fecbf4a69eb9;hpb=a375412650ede30883327dba34b3feafd9a3bf38;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index f428eeb3..2593dd2f 100644 --- a/src/events.c +++ b/src/events.c @@ -206,9 +206,15 @@ void EventLoop(void) playfield_cursor_set = FALSE; } +#if 0 HandleNoEvent(); +#endif } +#if 1 + HandleNoEvent(); +#endif + /* don't use all CPU time when idle; the main loop while playing has its own synchronization and is CPU friendly, too */ @@ -427,7 +433,9 @@ void HandleWindowEvent(WindowEvent *event) event_name, event->data1, event->data2); #endif - if (event->event == SDL_WINDOWEVENT_EXPOSED) + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->event == SDL_WINDOWEVENT_RESIZED || + event->event == SDL_WINDOWEVENT_EXPOSED) SDLRedrawWindow(); #if 0 @@ -513,6 +521,7 @@ void HandleFingerEvent(FingerEvent *event) int max_events = 10; #endif +#if 0 #if DEBUG_EVENTS Error(ERR_DEBUG, "FINGER EVENT: finger was %s, touch ID %lld, finger ID %lld, x/y %f/%f, dx/dy %f/%f, pressure %f", event->type == EVENT_FINGERPRESS ? "pressed" : @@ -523,6 +532,7 @@ void HandleFingerEvent(FingerEvent *event) event->dx, event->dy, event->pressure); #endif +#endif #if 0 int x = (int)(event->x * video.width); @@ -603,12 +613,13 @@ void HandleTextEvent(TextEvent *event) Key key = getKeyFromKeyName(text); #if DEBUG_EVENTS - Error(ERR_DEBUG, "TEXT EVENT: text == '%s' [%d byte(s), '%c'/%d], resulting key == %d (%s)", + Error(ERR_DEBUG, "TEXT EVENT: text == '%s' [%d byte(s), '%c'/%d], resulting key == %d (%s) [%04x]", text, strlen(text), text[0], (int)(text[0]), key, - getKeyNameFromKey(key)); + getKeyNameFromKey(key), + GetKeyModState()); #endif // if (game_status != GAME_MODE_PLAYING && GetKeyModState() != KMOD_None) @@ -1413,7 +1424,13 @@ void HandleNoEvent() { HandleButton(0, 0, -button_status, button_status); +#if 0 return; +#endif + } + else + { + HandleJoystick(); } #if defined(NETWORK_AVALIABLE) @@ -1421,7 +1438,28 @@ void HandleNoEvent() HandleNetworking(); #endif - HandleJoystick(); + switch (game_status) + { + case GAME_MODE_MAIN: + DrawPreviewLevelAnimation(); + DoAnimation(); + break; + + case GAME_MODE_LEVELS: + case GAME_MODE_LEVELNR: + case GAME_MODE_SETUP: + case GAME_MODE_INFO: + case GAME_MODE_SCORES: + DoAnimation(); + break; + + case GAME_MODE_EDITOR: + HandleLevelEditorIdle(); + break; + + default: + break; + } } static int HandleJoystickForAllPlayers() @@ -1498,18 +1536,20 @@ void HandleJoystick() HandleHallOfFame(0, 0, dx, dy, !newbutton); break; +#if 0 case GAME_MODE_EDITOR: HandleLevelEditorIdle(); break; +#endif case GAME_MODE_PLAYING: if (tape.playing || keyboard) newbutton = ((joy & JOY_BUTTON) != 0); #if 0 - if (local_player->LevelSolved_GameEnd && newbutton) + if (newbutton && local_player->LevelSolved_GameEnd) #else - if (AllPlayersGone && newbutton) + if (newbutton && AllPlayersGone) #endif { GameEnd();