static void update_lists(struct List *player, struct List *game) { int i; d_text_surface_reset(lobby.list_players); d_text_surface_reset(lobby.list_games); d_text_surface_color_next(lobby.list_players, 255, 255, 255); d_text_surface_string_append(lobby.list_players, "Players in lobby\n\n"); d_text_surface_color_next(lobby.list_games, 255, 255, 255); d_text_surface_string_append(lobby.list_games, "LAN Games\n\n"); #if 0 for(i = 0; i < players; i++) { /*if(i == lobby.selected_player) { d_text_surface_color_next(lobby.list_players, 255, 0, 0); } else {*/ d_text_surface_color_next(lobby.list_players, 255, 255, 255); /*}*/ d_text_surface_string_append(lobby.list_players, player[i]); } #endif for(i = 0; game; i++, game = game->next) { if(i == lobby.selected_game) { d_text_surface_color_next(lobby.list_games, 255, 0, 0); } else { d_text_surface_color_next(lobby.list_games, 255, 255, 255); } d_text_surface_string_append(lobby.list_games, ((struct LobbyHost *) (game->value))->name); if(i == 0) d_text_surface_string_append(lobby.list_games, "\n"); else d_text_surface_string_append(lobby.list_games, "'s game\n"); } }
static void update_player_list(DARNIT_TEXT_SURFACE *surface, char player[][PROTO_PLAYER_NAME]) { int i; d_text_surface_reset(surface); d_text_surface_color_next(surface, 255, 255, 255); d_text_surface_string_append(surface, "Players in game\n\n"); for(i = 0; i < FARMER_COUNT; i++) { if(!player[i][0]) continue; d_text_surface_color_next(surface, 255, 255, 255); d_text_surface_string_append(surface, player[i]); d_text_surface_char_append(surface, "\n"); } }
void colorTest(DARNIT_TEXT_SURFACE *surface) { int i; char tmp[2]; d_text_surface_reset(surface); srand(time(NULL)); for (i = 0; i < 16; i++) { d_text_surface_color_next(surface, rand()&0xFF, rand()&0xFF, rand()&0xFF); sprintf(tmp, "%c", 'A' + i); d_text_surface_char_append(surface, tmp); } return; }
void lobby_init() { lobby.line = d_render_line_new(1, 2); d_render_line_move(lobby.line, 0, config.platform.screen_w - 320, 0, config.platform.screen_w - 320, config.platform.screen_h); lobby.list_players = d_text_surface_color_new(config.font_std, 2048, 300, 64, 0); lobby.list_games = d_text_surface_color_new(config.font_std, 2048, 300, config.platform.screen_w - 300, 0); lobby_join.list_players = d_text_surface_color_new(config.font_std, 2048, 300, 64, 0); lobby_host.start_game = d_text_surface_color_new(config.font_std, 32, 300, 64, config.platform.screen_h - 96); d_text_surface_color_next(lobby_host.start_game, 255, 0, 0); d_text_surface_string_append(lobby_host.start_game, "Press enter to start game"); update_lists(NULL, lobby_client.client); lobby_playername.text_playername = d_text_surface_new(config.font_std, 64, 1024, 64, 64); lobby_playername.inputfield_playername = d_menu_textinput_new(64, 128, config.font_std, config.player_name, PROTO_PLAYER_NAME - 1, config.platform.screen_w); d_text_surface_string_append(lobby_playername.text_playername, "Enter your player name:"); lobby.selected_game = 0; lobby.selected_player = 0; }
int texteffect_add(const char *str, int time, int x, int y, int linel, unsigned r, unsigned g, unsigned b) { unsigned i; int j; if (ws.te.max_te == ws.te.te_used) texteffect_expand(); for (i = 0; i < ws.te.max_te; i++) { if (ws.te.te[i].time_left) continue; else break; } j = 0; y -= d_font_string_geometrics_o(ws.te.font, str, linel, &j); ws.te.te[i].s = d_text_surface_color_new(ws.te.font, strlen(str), linel, x - (j >> 1), y); ws.te.te[i].time_left = time; ws.te.te[i].total_time = time; d_text_surface_color_next(ws.te.te[i].s, r, g, b); d_text_surface_string_append(ws.te.te[i].s, str); ws.te.te_used++; return i; }