void MenuVendor::render() { if (!visible) return; SDL_Rect src; SDL_Rect dest; int offset_y = (VIEW_H - 416)/2; // background src.x = 0; src.y = 0; dest.x = 0; dest.y = offset_y; src.w = dest.w = 320; src.h = dest.h = 416; SDL_BlitSurface(background, &src, screen, &dest); // close button closeButton->render(); // text overlay WidgetLabel label; label.set(160, offset_y+8, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Vendor"), FONT_WHITE); label.render(); label.set(160, offset_y+24, JUSTIFY_CENTER, VALIGN_TOP, npc->name, FONT_WHITE); label.render(); // show stock stock.render(); }
void MenuStash::render() { if (!visible) return; SDL_Rect src; SDL_Rect dest; // background src.x = 0; src.y = 0; dest.x = window_area.x; dest.y = window_area.y; src.w = dest.w = window_area.w; src.h = dest.h = window_area.h; SDL_BlitSurface(background, &src, screen, &dest); // close button closeButton->render(); // text overlay WidgetLabel label; if (!title.hidden) { label.set(window_area.x+title.x, window_area.y+title.y, title.justify, title.valign, msg->get("Shared Stash"), color_normal, title.font_style); label.render(); } if (!currency.hidden) { label.set(window_area.x+currency.x, window_area.y+currency.y, currency.justify, currency.valign, msg->get("%d %s", stock.count(CURRENCY_ID), CURRENCY), color_normal, currency.font_style); label.render(); } // show stock stock.render(); }
void MenuEnemy::render() { if (enemy == NULL) return; if (enemy->stats.corpse && enemy->stats.corpse_ticks == 0) return; SDL_Rect src; SDL_Rect dest; int hp_bar_length; // draw trim/background dest.x = window_area.x+bar_pos.x; dest.y = window_area.y+bar_pos.y; dest.w = bar_pos.w; dest.h = bar_pos.h; background.setDest(dest); render_device->render(background); if (enemy->stats.get(STAT_HP_MAX) == 0) hp_bar_length = 0; else hp_bar_length = (enemy->stats.hp * 100) / enemy->stats.get(STAT_HP_MAX); // draw hp bar src.x = 0; src.y = 0; src.h = bar_pos.h; src.w = hp_bar_length; bar_hp.setClip(src); bar_hp.setDest(dest); render_device->render(bar_hp); stringstream ss; ss.str(""); if (enemy->stats.hp > 0) ss << enemy->stats.hp << "/" << enemy->stats.get(STAT_HP_MAX); else ss << msg->get("Dead"); if (!text_pos.hidden) { WidgetLabel label; if (custom_text_pos) { label.set(window_area.x+text_pos.x, window_area.y+text_pos.y, text_pos.justify, text_pos.valign, msg->get("%s level %d", enemy->stats.level, enemy->stats.name), color_normal, text_pos.font_style); } else { label.set(window_area.x+bar_pos.x+bar_pos.w/2, window_area.y+bar_pos.y, JUSTIFY_CENTER, VALIGN_BOTTOM, msg->get("%s level %d", enemy->stats.level, enemy->stats.name), color_normal); } label.render(); label.set(window_area.x+bar_pos.x+bar_pos.w/2, window_area.y+bar_pos.y+bar_pos.h/2, JUSTIFY_CENTER, VALIGN_CENTER, ss.str(), color_normal); label.render(); } //SDL_UpdateRects(screen, 1, &dest); }
void MenuEnemy::render() { if (enemy == NULL) return; SDL_Rect src; SDL_Rect dest; int hp_bar_length; // draw trim/background dest.x = window_area.x+bar_pos.x; dest.y = window_area.y+bar_pos.y; dest.w = bar_pos.w; dest.h = bar_pos.h; SDL_BlitSurface(background, NULL, screen, &dest); if (enemy->stats.maxhp == 0) hp_bar_length = 0; else hp_bar_length = (enemy->stats.hp * 100) / enemy->stats.maxhp; // draw hp bar src.x = 0; src.y = 0; src.h = bar_pos.h; src.w = hp_bar_length; SDL_BlitSurface(bar_hp, &src, screen, &dest); stringstream ss; ss.str(""); if (enemy->stats.hp > 0) ss << enemy->stats.hp << "/" << enemy->stats.maxhp; else ss << msg->get("Dead"); if (!text_pos.hidden) { WidgetLabel label; if (custom_text_pos) { label.set(window_area.x+text_pos.x, window_area.y+text_pos.y, text_pos.justify, text_pos.valign, msg->get("%s level %d", enemy->stats.level, enemy->stats.name), color_normal); } else { label.set(window_area.x+bar_pos.x+bar_pos.w/2, window_area.y+bar_pos.y, JUSTIFY_CENTER, VALIGN_BOTTOM, msg->get("%s level %d", enemy->stats.level, enemy->stats.name), color_normal); } label.render(); label.set(window_area.x+bar_pos.x+bar_pos.w/2, window_area.y+bar_pos.y+bar_pos.h/2, JUSTIFY_CENTER, VALIGN_CENTER, ss.str(), color_normal); label.render(); } //SDL_UpdateRects(screen, 1, &dest); }
void MenuEnemy::render() { if (enemy == NULL) return; SDL_Rect src; SDL_Rect dest; int hp_bar_length; // draw trim/background dest.x = VIEW_W_HALF-53; dest.y = 0; dest.w = 106; dest.h = 33; SDL_BlitSurface(background, NULL, screen, &dest); if (enemy->stats.maxhp == 0) hp_bar_length = 0; else hp_bar_length = (enemy->stats.hp * 100) / enemy->stats.maxhp; // draw hp bar dest.x = VIEW_W_HALF-50; dest.y = 18; src.x = 0; src.y = 0; src.h = 12; src.w = hp_bar_length; SDL_BlitSurface(bar_hp, &src, screen, &dest); stringstream ss; ss.str(""); if (enemy->stats.hp > 0) ss << enemy->stats.hp << "/" << enemy->stats.maxhp; else ss << msg->get("Dead"); WidgetLabel label; label.set(VIEW_W_HALF, 9, JUSTIFY_CENTER, VALIGN_CENTER, msg->get("%s level %d", enemy->stats.level, enemy->stats.name), FONT_WHITE); label.render(); label.set(VIEW_W_HALF, 24, JUSTIFY_CENTER, VALIGN_CENTER, ss.str(), FONT_WHITE); label.render(); //SDL_UpdateRects(screen, 1, &dest); }
void MenuVendor::render() { if (!visible) return; SDL_Rect src; SDL_Rect dest; // background src.x = 0; src.y = 0; dest.x = window_area.x; dest.y = window_area.y; src.w = dest.w = window_area.w; src.h = dest.h = window_area.h; SDL_BlitSurface(background, &src, screen, &dest); // close button closeButton->render(); // text overlay if (!title.hidden) { WidgetLabel label; label.set(window_area.x+title.x, window_area.y+title.y, title.justify, title.valign, msg->get("Vendor") + " - " + npc->name, color_normal, title.font_style); label.render(); } // render tabs tabControl->render(); // show stock stock[activetab].render(); }
/** * Renders icons at small size or large size * Also display the stack size */ void ItemManager::renderIcon(ItemStack stack, int x, int y, int size) { if (!icons) return; SDL_Rect src, dest; dest.x = x; dest.y = y; src.w = src.h = dest.w = dest.h = size; if (stack.item > 0) { int columns = icons->w / ICON_SIZE; src.x = (items[stack.item].icon % columns) * size; src.y = (items[stack.item].icon / columns) * size; SDL_BlitSurface(icons, &src, screen, &dest); } if (stack.quantity > 1 || items[stack.item].max_quantity > 1) { // stackable item : show the quantity stringstream ss; ss << stack.quantity; WidgetLabel label; label.set(dest.x + 2, dest.y + 2, JUSTIFY_LEFT, VALIGN_TOP, ss.str(), color_normal); label.render(); } }
/** * Renders icons at 32px size or 64px size * Also display the stack size */ void ItemManager::renderIcon(ItemStack stack, int x, int y, int size) { int columns; dest.x = x; dest.y = y; src.w = src.h = dest.w = dest.h = size; if (size == ICON_SIZE_32) { columns = icons32->w / 32; src.x = (items[stack.item].icon32 % columns) * size; src.y = (items[stack.item].icon32 / columns) * size; SDL_BlitSurface(icons32, &src, screen, &dest); } else if (size == ICON_SIZE_64) { columns = icons64->w / 64; src.x = (items[stack.item].icon64 % columns) * size; src.y = (items[stack.item].icon64 / columns) * size; SDL_BlitSurface(icons64, &src, screen, &dest); } if( stack.quantity > 1 || items[stack.item].max_quantity > 1) { // stackable item : show the quantity stringstream ss; ss << stack.quantity; WidgetLabel label; label.set(dest.x + 2, dest.y + 2, JUSTIFY_LEFT, VALIGN_TOP, ss.str(), FONT_WHITE); label.render(); } }
void MenuActionBar::render() { Menu::render(); // draw hotkeyed icons for (unsigned i = 0; i < slots_count; i++) { if (!slots[i]) continue; if (hotkeys[i] != 0) { slots[i]->render(); } else { if (sprite_emptyslot) { sprite_emptyslot->setDest(slots[i]->pos); render_device->render(sprite_emptyslot); } } // render cooldown/disabled overlay if (!slot_enabled[i]) { Rect clip; clip.x = clip.y = 0; clip.w = clip.h = ICON_SIZE; // Wipe from bottom to top if (twostep_slot == -1 || static_cast<unsigned>(twostep_slot) == i) { clip.h = slot_cooldown_size[i]; } if (sprite_disabled && clip.h > 0) { sprite_disabled->setClip(clip); sprite_disabled->setDest(slots[i]->pos); render_device->render(sprite_disabled); } } slots[i]->renderSelection(); } // render primary menu buttons for (int i=0; i<4; i++) { menus[i]->render(); if (requires_attention[i] && !menus[i]->in_focus) { Rect dest; if (sprite_attention) { sprite_attention->setDest(menus[i]->pos); render_device->render(sprite_attention); } // put an asterisk on this icon if in colorblind mode if (COLORBLIND) { WidgetLabel label; label.set(menus[i]->pos.x + 2, menus[i]->pos.y + 2, JUSTIFY_LEFT, VALIGN_TOP, "*", font->getColor("menu_normal")); label.render(); } } } }
void MenuStash::render() { if (!visible) return; SDL_Rect src; SDL_Rect dest; // background src.x = 0; src.y = 0; dest.x = window_area.x; dest.y = window_area.y; src.w = dest.w = window_area.w; src.h = dest.h = window_area.h; SDL_BlitSurface(background, &src, screen, &dest); // close button closeButton->render(); // text overlay if (!title.hidden) { WidgetLabel label; label.set(window_area.x+title.x, window_area.y+title.y, title.justify, title.valign, msg->get("Shared Stash"), color_normal); label.render(); } // show stock stock.render(); }
void WidgetSlot::render() { SDL_Rect src; if (icon_id != -1 && !icons.graphicsIsNull()) { int columns = icons.getGraphicsWidth() / ICON_SIZE; src.x = (icon_id % columns) * ICON_SIZE; src.y = (icon_id / columns) * ICON_SIZE; src.w = pos.w; src.h = pos.h; icons.local_frame = local_frame; icons.setOffset(local_offset); icons.setClip(src); icons.setDest(pos); render_device->render(icons); if (amount > 1 || max_amount > 1) { stringstream ss; ss << amount_str; WidgetLabel label; label.set(pos.x + 2, pos.y + 2, JUSTIFY_LEFT, VALIGN_TOP, ss.str(), font->getColor("item_normal")); label.local_frame = local_frame; label.local_offset = local_offset; label.render(); } } renderSelection(); }
/** * Renders icons at small size or large size * Also display the stack size */ void ItemManager::renderIcon(ItemStack stack, int x, int y, int size) { int columns; dest.x = x; dest.y = y; src.w = src.h = dest.w = dest.h = size; if (size == ICON_SIZE_SMALL) { columns = icons_small->w / ICON_SIZE_SMALL; src.x = (items[stack.item].icon_small % columns) * size; src.y = (items[stack.item].icon_small / columns) * size; SDL_BlitSurface(icons_small, &src, screen, &dest); } else if (size == ICON_SIZE_LARGE) { columns = icons_large->w / ICON_SIZE_LARGE; src.x = (items[stack.item].icon_large % columns) * size; src.y = (items[stack.item].icon_large / columns) * size; SDL_BlitSurface(icons_large, &src, screen, &dest); } if( stack.quantity > 1 || items[stack.item].max_quantity > 1) { // stackable item : show the quantity stringstream ss; ss << stack.quantity; WidgetLabel label; label.set(dest.x + 2, dest.y + 2, JUSTIFY_LEFT, VALIGN_TOP, ss.str(), color_normal); label.render(); } }
void MenuInventory::render() { if (!visible) return; SDL_Rect src; // background src.x = 0; src.y = 0; src.w = window_area.w; src.h = window_area.h; SDL_BlitSurface(background, &src, screen, &window_area); // close button closeButton->render(); // text overlay WidgetLabel label; label.set(window_area.x+160, window_area.y+8, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Inventory"), FONT_WHITE); label.render(); label.set(window_area.x+64, window_area.y+34, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Main Hand"), FONT_WHITE); label.render(); label.set(window_area.x+128, window_area.y+34, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Body"), FONT_WHITE); label.render(); label.set(window_area.x+192, window_area.y+34, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Off Hand"), FONT_WHITE); label.render(); label.set(window_area.x+256, window_area.y+34, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Artifact"), FONT_WHITE); label.render(); label.set(window_area.x+288, window_area.y+114, JUSTIFY_RIGHT, VALIGN_TOP, msg->get("%d Gold", gold), FONT_WHITE); label.render(); inventory[EQUIPMENT].render(); inventory[CARRIED].render(); }
/** * Display the XP bar background and current progress. * On mouseover, display progress in text form. */ void MenuExperience::render(StatBlock *stats, Point mouse) { SDL_Rect src; SDL_Rect dest; int xp_bar_length; // don't display anything if max level if (stats->level < 1 || stats->level == MAX_CHARACTER_LEVEL) return; // lay down the background image first src.x = 0; src.y = 0; src.w = background_size.x; src.h = background_size.y; dest.x = hud_position.x + background_offset.x; dest.y = hud_position.y + background_offset.y; SDL_BlitSurface(background, &src, screen, &dest); // calculate the length of the xp bar // when at a new level, 0% progress src.x = 0; src.y = 0; int required = stats->xp_table[stats->level] - stats->xp_table[stats->level-1]; int current = stats->xp - stats->xp_table[stats->level-1]; xp_bar_length = (current * bar_size.x) / required; src.w = xp_bar_length; src.h = bar_size.y; dest.x = hud_position.x + bar_offset.x; dest.y = hud_position.y + bar_offset.y; // draw xp bar SDL_BlitSurface(bar, &src, screen, &dest); string text_label; // if mouseover, draw text if (isWithin(hud_position, mouse)) { if (stats->level < MAX_CHARACTER_LEVEL) { text_label = msg->get("XP: %d/%d", stats->xp, stats->xp_table[stats->level]); } else { text_label = msg->get("XP: %d", stats->xp); } WidgetLabel label; label.set(hud_position.x + text_offset.x, hud_position.y + text_offset.y, text_justify, VALIGN_TOP, text_label, FONT_WHITE); label.render(); } }
/** * Render graphics for this frame when the menu is open */ void MenuLog::render() { if (!visible) return; SDL_Rect src; // background src.x = 0; src.y = 0; src.w = menu_area.w; src.h = menu_area.h; SDL_BlitSurface(background, &src, screen, &menu_area); // close button closeButton->render(); // text overlay WidgetLabel label; label.set(menu_area.x+160, menu_area.y+8, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Log"), FONT_WHITE); label.render(); // display tabs for (int i=0; i<LOG_TYPE_COUNT; i++) { renderTab(i); } // display latest log messages Point size; int display_number = 0; int total_size = 0; // first calculate how many entire messages can fit in the log view for (int i=log_count[active_log]-1; i>=0; i--) { size = font->calc_size(log_msg[active_log][i], list_area.w); total_size += size.y + paragraph_spacing; if (total_size < list_area.h) display_number++; else break; } // now display these messages int cursor_y = list_area.y; for (int i=log_count[active_log]-display_number; i<log_count[active_log]; i++) { size = font->calc_size(log_msg[active_log][i], list_area.w); font->renderShadowed(log_msg[active_log][i], list_area.x, cursor_y, JUSTIFY_LEFT, screen, list_area.w, FONT_WHITE); cursor_y += size.y + paragraph_spacing; } }
/** * For powers that have consumables, display the number of consumables remaining */ void MenuActionBar::renderItemCounts() { stringstream ss; for (int i=0; i<12; i++) { if (slot_item_count[i] > -1) { ss.str(""); ss << slot_item_count[i]; WidgetLabel label; label.set(slots[i].x, slots[i].y, JUSTIFY_LEFT, VALIGN_TOP, ss.str(), font->getColor("menu_normal")); label.render(); } } }
void MenuInventory::render() { if (!visible) return; // background SDL_Rect dest = window_area; SDL_BlitSurface(background, NULL, screen, &dest); // close button closeButton->render(); // text overlay WidgetLabel label; if (!title.hidden) { label.set(window_area.x+title.x, window_area.y+title.y, title.justify, title.valign, msg->get("Inventory"), color_normal, title.font_style); label.render(); } if (!currency_lbl.hidden) { label.set(window_area.x+currency_lbl.x, window_area.y+currency_lbl.y, currency_lbl.justify, currency_lbl.valign, msg->get("%d %s", currency, CURRENCY), color_normal, currency_lbl.font_style); label.render(); } inventory[EQUIPMENT].render(); inventory[CARRIED].render(); }
void MenuStash::render() { if (!visible) return; // background Menu::render(); // close button closeButton->render(); // text overlay WidgetLabel label; if (!title.hidden) { label.set(window_area.x+title.x, window_area.y+title.y, title.justify, title.valign, msg->get("Shared Stash"), color_normal, title.font_style); label.render(); } if (!currency.hidden) { label.set(window_area.x+currency.x, window_area.y+currency.y, currency.justify, currency.valign, msg->get("%d %s", stock.count(CURRENCY_ID), CURRENCY), color_normal, currency.font_style); label.render(); } // show stock stock.render(); }
/** * Render graphics for this frame when the menu is open */ void MenuLog::render() { if (!visible) return; Rect src,dest; // Background. dest = window_area; src.x = 0; src.y = 0; src.w = window_area.w; src.h = window_area.h; background.setClip(src); background.setDest(dest); render_device->render(background); // Close button. closeButton->render(); // Text overlay. if (!title.hidden) { WidgetLabel label; label.set(window_area.x+title.x, window_area.y+title.y, title.justify, title.valign, msg->get("Log"), color_normal, title.font_style); label.render(); } // Tab control. tabControl->render(); // Display latest log messages for the active tab. int total_size = tab_content_indent; int active_log = tabControl->getActiveTab(); if (msg_buffer[active_log]->update) { msg_buffer[active_log]->refresh(); font->setFont("font_regular"); for (unsigned int i = log_msg[active_log].size(); i > 0; i--) { int widthLimit = tabControl->getContentArea().w; Point size = font->calc_size(log_msg[active_log][i-1], widthLimit); font->renderShadowed(log_msg[active_log][i-1], tab_content_indent, total_size, JUSTIFY_LEFT, msg_buffer[active_log]->contents.getGraphics(), widthLimit, color_normal); total_size+=size.y+paragraph_spacing; } } msg_buffer[active_log]->update = false; msg_buffer[active_log]->render(); }
// Renders the "needs attention" icon over the appropriate log menu void MenuActionBar::renderAttention(int menu_id) { SDL_Rect dest; // x-value is 12 hotkeys and 4 empty slots over dest.x = window_area.x + (menu_id * ICON_SIZE) + ICON_SIZE*15; dest.y = window_area.y+3; dest.w = dest.h = ICON_SIZE; attention.setDest(dest); render_device->render(attention); // put an asterisk on this icon if in colorblind mode if (COLORBLIND) { WidgetLabel label; label.set(dest.x + 2, dest.y + 2, JUSTIFY_LEFT, VALIGN_TOP, "*", font->getColor("menu_normal")); label.render(); } }
void MenuExit::render() { SDL_Rect src; // background src.x = 0; src.y = 0; src.w = window_area.w; src.h = window_area.h; SDL_BlitSurface(background, &src, screen, &window_area); WidgetLabel label; label.set(window_area.x + window_area.w/2, window_area.y + 10, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Save and exit to title?"), FONT_WHITE); label.render(); buttonExit->render(); buttonClose->render(); }
/** * Render graphics for this frame when the menu is open */ void MenuLog::render() { if (!visible) return; SDL_Rect src; // Background. src.x = 0; src.y = 0; src.w = menu_area.w; src.h = menu_area.h; SDL_BlitSurface(background, &src, screen, &menu_area); // Close button. closeButton->render(); // Text overlay. WidgetLabel label; label.set(menu_area.x+160, menu_area.y+8, JUSTIFY_CENTER, VALIGN_TOP, msg->get("Log"), FONT_WHITE); label.render(); // Tab control. tabControl->render(); // Display latest log messages for the active tab. int display_number = 0; int total_size = 0; int active_log = tabControl->getActiveTab(); SDL_Rect contentArea = tabControl->getContentArea(); // first calculate how many entire messages can fit in the log view for (int i=log_count[active_log]-1; i>=0; i--) { total_size += msg_buffer[active_log][i]->h + paragraph_spacing; if (total_size < contentArea.h) display_number++; else break; } // Now display these messages. for (int i=log_count[active_log]-display_number; i<log_count[active_log]; i++) { SDL_BlitSurface(msg_buffer[active_log][i], NULL, screen, &contentArea); contentArea.y += msg_buffer[active_log][i]->h + paragraph_spacing; } }
/** * Render graphics for this frame when the menu is open */ void MenuLog::render() { if (!visible) return; SDL_Rect src,dest; // Background. dest = window_area; src.x = 0; src.y = 0; src.w = window_area.w; src.h = window_area.h; SDL_BlitSurface(background, &src, screen, &window_area); // Close button. closeButton->render(); // Text overlay. if (!title.hidden) { WidgetLabel label; label.set(window_area.x+title.x, window_area.y+title.y, title.justify, title.valign, msg->get("Log"), color_normal); label.render(); } // Tab control. tabControl->render(); // Display latest log messages for the active tab. int total_size = tab_content_indent; int active_log = tabControl->getActiveTab(); if (msg_buffer[active_log]->update) { for (unsigned int i=log_msg[active_log].size(); i>0; i--) { int widthLimit = tabControl->getContentArea().w; Point size = font->calc_size(log_msg[active_log][i-1], widthLimit); font->renderShadowed(log_msg[active_log][i-1], tab_content_indent, total_size, JUSTIFY_LEFT, msg_buffer[active_log]->contents, widthLimit, color_normal); total_size+=size.y+paragraph_spacing; } } msg_buffer[active_log]->render(); }
/** * Renders the given tab on the widget header. */ void WidgetTabControl::renderTab(int number, SDL_Surface *target) { int i = number; SDL_Rect src; SDL_Rect dest; // Draw tab’s background. src.x = src.y = 0; dest.x = tabs[i].x; dest.y = tabs[i].y; src.w = tabs[i].w; src.h = tabs[i].h; if (i == activeTab) SDL_BlitSurface(activeTabSurface, &src, target, &dest); else SDL_BlitSurface(inactiveTabSurface, &src, target, &dest); // Draw tab’s right edge. src.x = activeTabSurface->w - tabPadding.x; src.w = tabPadding.x; dest.x = tabs[i].x + tabs[i].w - tabPadding.x; if (i == activeTab) SDL_BlitSurface(activeTabSurface, &src, target, &dest); else SDL_BlitSurface(inactiveTabSurface, &src, target, &dest); // Set tab’s label font color. SDL_Color fontColor; if (i == activeTab) fontColor = color_normal; else fontColor = color_disabled; // Draw tab’s label. WidgetLabel label; label.set(tabs[i].x + tabPadding.x, tabs[i].y + tabs[i].h/2, JUSTIFY_LEFT, VALIGN_CENTER, titles[i], fontColor); label.render(target); }
/** * Display the specified tab * Render the font and tab background * The active tab will look different */ void MenuLog::renderTab(int log_type) { int i = log_type; // draw tab background SDL_Rect src; SDL_Rect dest; src.x = src.y = 0; dest.x = tab_rect[i].x; dest.y = tab_rect[i].y; src.w = tab_rect[i].w; src.h = tab_rect[i].h; if (i == active_log) SDL_BlitSurface(tab_active, &src, screen, &dest); else SDL_BlitSurface(tab_inactive, &src, screen, &dest); // draw tab right edge src.x = 128 - tab_padding.x; src.w = tab_padding.x; dest.x = tab_rect[i].x + tab_rect[i].w - tab_padding.x; if (i == active_log) SDL_BlitSurface(tab_active, &src, screen, &dest); else SDL_BlitSurface(tab_inactive, &src, screen, &dest); // set tab label text color int tab_label_color; if (i == active_log) tab_label_color = FONT_WHITE; else tab_label_color = FONT_GREY; WidgetLabel label; label.set(tab_rect[i].x + tab_padding.x, tab_rect[i].y + tab_padding.y, JUSTIFY_LEFT, VALIGN_TOP, tab_labels[i], tab_label_color); label.render(); }