void frontnet_draw_comport_selected(struct GuiButton *gbtn) { if (net_comport_index_active == -1) frontnet_draw_small_scroll_selection_box(gbtn, frontend_button_caption_font(gbtn, 0), 0); else frontnet_draw_small_scroll_selection_box(gbtn, frontend_button_caption_font(gbtn, 0), get_net_comport_text(net_comport_index_active)); }
void frontnet_draw_current_message(struct GuiButton *gbtn) { static TbClockMSec last_time = 0; static TbBool print_with_cursor = 1; struct PlayerInfo *player; int font_idx; char text[2048]; // Blink cursor - switch state every 100ms if (LbTimerClock() >= last_time + 100) { print_with_cursor = !print_with_cursor; last_time = LbTimerClock(); } // Get player player = get_my_player(); if (player_invalid(player)) { return; } // Prepare text buffer and font snprintf(text, sizeof(text), "%s%s", player->mp_message_text, print_with_cursor?"_":""); font_idx = frontend_button_caption_font(gbtn, 0); // And draw the message frontnet_draw_scroll_selection_box(gbtn, font_idx, text); }
void frontnet_draw_net_session_players(struct GuiButton *gbtn) { int i; i = frontend_button_caption_font(gbtn, 0); lbDisplay.DrawFlags = 0; LbTextSetFont(frontend_font[i]); int tx_units_per_px; tx_units_per_px = gbtn->height * 16 / (2*LbTextLineHeight()); const struct TbSprite *spr; spr = &frontend_sprite[21]; int fs_units_per_px; fs_units_per_px = gbtn->height * 16 / (2*(spr->SHeight*13/8)); int height; height = LbTextLineHeight() * tx_units_per_px / 16; long netplyr_idx; int shift_y; netplyr_idx = net_player_scroll_offset; for (shift_y=0; shift_y < gbtn->height; shift_y += height, netplyr_idx++) { const char *text; text = net_player[netplyr_idx].name; if (netplyr_idx >= net_number_of_enum_players) break; spr = &frontend_sprite[21+netplyr_idx]; i = height - spr->SHeight * fs_units_per_px / 16; LbSpriteDrawResized(gbtn->scr_pos_x, gbtn->scr_pos_y + shift_y + abs(i)/2, fs_units_per_px, spr); LbTextSetWindow(gbtn->scr_pos_x, shift_y + gbtn->scr_pos_y, gbtn->width - spr->SWidth * fs_units_per_px / 16, height); LbTextDrawResized(spr->SWidth * fs_units_per_px / 16, 0, tx_units_per_px, text); } }
void frontend_draw_invert_mouse(struct GuiButton *gbtn) { int font_idx; font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button); LbTextSetFont(frontend_font[font_idx]); LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, gbtn->height); int tx_units_per_px; tx_units_per_px = gbtn->height * 16 / LbTextLineHeight(); const char *text; if (settings.first_person_move_invert) { text = get_string(GUIStr_On); } else { text = get_string(GUIStr_Off); } LbTextDrawResized(0, 0, tx_units_per_px, text); }
void frontnet_draw_messages(struct GuiButton *gbtn) { int font_idx; font_idx = frontend_button_caption_font(gbtn, 0); LbTextSetFont(frontend_font[font_idx]); lbDisplay.DrawFlags = 0; // While setting scale, aim for 4 lines of text int tx_units_per_px; tx_units_per_px = gbtn->height * 16 / (4*LbTextLineHeight()); struct TbSprite *spr; spr = &frontend_sprite[21]; int fs_units_per_px; fs_units_per_px = gbtn->height * 16 / (4*(spr->SHeight*13/8)); int font_height; font_height = LbTextLineHeight() * tx_units_per_px / 16; int y; y = 0; int netmsg_id; for (netmsg_id=net_message_scroll_offset; netmsg_id < net_number_of_messages; netmsg_id++) { if (y + font_height/2 > gbtn->height) break; struct NetMessage *nmsg; nmsg = &net_message[netmsg_id]; int num_active; num_active = 0; int i; for (i = nmsg->plyr_idx; i > 0; i--) { if ( net_player_info[i].active) num_active++; } spr = &frontend_sprite[21+num_active]; i = font_height - spr->SHeight * fs_units_per_px / 16; LbSpriteDrawResized(gbtn->scr_pos_x, y + gbtn->scr_pos_y + (i >> 1), fs_units_per_px, spr); LbTextSetWindow(gbtn->scr_pos_x, y + gbtn->scr_pos_y, gbtn->width, min(font_height, gbtn->height-y)); LbTextDrawResized(spr->SWidth * fs_units_per_px / 16, 0, tx_units_per_px, nmsg->text); y += font_height; } }
void frontend_draw_load_game_button(struct GuiButton *gbtn) { int i; i = frontend_load_game_button_to_index(gbtn); if (i < 0) return; // Select font to draw int font_idx; font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button); LbTextSetFont(frontend_font[font_idx]); lbDisplay.DrawFlags = Lb_TEXT_HALIGN_LEFT; // Set drawing window and draw the text int tx_units_per_px; tx_units_per_px = (gbtn->height*13/11) * 16 / LbTextLineHeight(); int height; height = LbTextLineHeight() * tx_units_per_px / 16; LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height); LbTextDrawResized(0, 0, tx_units_per_px, save_game_catalogue[i].textname); }
void frontnet_draw_session_button(struct GuiButton *gbtn) { long sessionIndex; long febtn_idx; long height; febtn_idx = (long)gbtn->content; sessionIndex = net_session_scroll_offset + febtn_idx - 45; if ((sessionIndex < 0) || (sessionIndex >= net_number_of_sessions)) return; int font_idx; font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button); LbTextSetFont(frontend_font[font_idx]); lbDisplay.DrawFlags = 0; int tx_units_per_px; tx_units_per_px = gbtn->height * 16 / LbTextLineHeight(); height = LbTextLineHeight() * tx_units_per_px / 16; LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height); LbTextDrawResized(0, 0, tx_units_per_px, net_session[sessionIndex]->text); }
void frontnet_draw_service_button(struct GuiButton *gbtn) { int srvidx; // Find and verify selected network service srvidx = (long)gbtn->content + net_service_scroll_offset - 45; if (srvidx >= net_number_of_services) return; // Select font to draw int font_idx; font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button); LbTextSetFont(frontend_font[font_idx]); lbDisplay.DrawFlags = Lb_TEXT_HALIGN_LEFT; // Set drawing window and draw the text int tx_units_per_px; tx_units_per_px = gbtn->height * 16 / LbTextLineHeight(); int height; height = LbTextLineHeight() * tx_units_per_px / 16; LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height); LbTextDrawResized(0, 0, tx_units_per_px, net_service[srvidx]); }
void frontnet_draw_comport_button(struct GuiButton *gbtn) { int i; int febtn_idx; febtn_idx = (long)gbtn->content; i = net_comport_scroll_offset + febtn_idx - 45; if (i < number_of_comports) { int font_idx; font_idx = frontend_button_caption_font(gbtn,frontend_mouse_over_button); LbTextSetFont(frontend_font[font_idx]); lbDisplay.DrawFlags = 0; const char *text; text = get_net_comport_text(i); int tx_units_per_px; tx_units_per_px = (gbtn->height*13/14) * 16 / LbTextLineHeight(); int height; height = LbTextLineHeight() * tx_units_per_px / 16; LbTextSetWindow(gbtn->scr_pos_x, gbtn->scr_pos_y, gbtn->width, height); LbTextDrawResized(0, 0, tx_units_per_px, text); } }
void frontnet_draw_session_selected(struct GuiButton *gbtn) { //_DK_frontnet_draw_session_selected(gbtn); struct TbSprite *spr; long pos_x, pos_y; int i; pos_x = gbtn->scr_pos_x; pos_y = gbtn->scr_pos_y; int fs_units_per_px; fs_units_per_px = simple_frontend_sprite_height_units_per_px(gbtn, 56, 100); spr = &frontend_sprite[55]; for (i=0; i < 6; i++) { LbSpriteDrawResized(pos_x, pos_y, fs_units_per_px, spr); pos_x += spr->SWidth * fs_units_per_px / 16; spr++; } if (net_session_index_active >= 0) { const char *text; text = net_session[net_session_index_active]->text; i = frontend_button_caption_font(gbtn, 0); if (text != NULL) { lbDisplay.DrawFlags = 0; LbTextSetFont(frontend_font[i]); // Set drawing window and draw the text int tx_units_per_px; tx_units_per_px = (gbtn->height*13/14) * 16 / LbTextLineHeight(); int h; h = LbTextLineHeight()*tx_units_per_px/16; LbTextSetWindow(gbtn->scr_pos_x + 13*fs_units_per_px/16, gbtn->scr_pos_y, gbtn->width - 26*fs_units_per_px/16, h); LbTextDrawResized(0, 0, tx_units_per_px, text); } } }