Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

F9 / F10 cycles only through available players

git-svn-id: http://infon.googlecode.com/svn/trunk@196 8171fb75-e542-0410-96e4-03d5dd800671
  • Loading branch information...
commit 22a2f0a18ae73c7f14ee9ca8ff0aecbd654b80af 1 parent 5090d0a
@dividuum authored
Showing with 28 additions and 7 deletions.
  1. +28 −7 sdl_gui.c
View
35 sdl_gui.c
@@ -80,14 +80,28 @@ static void handle_events() {
if (event.key.keysym.mod & KMOD_ALT)
video_fullscreen_toggle();
break;
- case SDLK_F9:
- if (--highlight_player < -1)
- highlight_player = infon->max_players;
+ case SDLK_F9: {
+ int new_highlight = highlight_player;
+ do {
+ if (--new_highlight < -1)
+ new_highlight = infon->max_players - 1;
+ } while (new_highlight != highlight_player &&
+ new_highlight != -1 &&
+ !infon->get_player(new_highlight));
+ highlight_player = new_highlight;
break;
- case SDLK_F10:
- if (++highlight_player >= infon->max_players)
- highlight_player = -1;
+ }
+ case SDLK_F10: {
+ int new_highlight = highlight_player;
+ do {
+ if (++new_highlight >= infon->max_players)
+ new_highlight = -1;
+ } while (new_highlight != highlight_player &&
+ new_highlight != -1 &&
+ !infon->get_player(new_highlight));
+ highlight_player = new_highlight;
break;
+ }
case SDLK_F11: send_events ^= 1;
sdl_scroll_message(send_events ? "Forwarding input"
: "Stopped forwarding input");
@@ -339,7 +353,14 @@ static void draw_player_row() {
// Name / Punkte
static char buf[18];
- snprintf(buf, sizeof(buf), "%2d. %4d %s", n + 1, player->score, player->name);
+ size_t namelen = strlen(player->name);
+ int offset = 0;
+ if (namelen > 9) {
+ offset = (render_real_time / 500) % ((namelen - 8)*2);
+ if (offset >= (namelen - 8))
+ offset = (namelen - 8)*2-1 - offset;
+ }
+ snprintf(buf, sizeof(buf), "%2d. %4d %s", n + 1, player->score, player->name + offset);
video_write(player_displayed * 128 + 16,
video_height() - 30,
buf);
Please sign in to comment.
Something went wrong with that request. Please try again.