当前位置: 首页>>代码示例>>C++>>正文


C++ WidgetLabel类代码示例

本文整理汇总了C++中WidgetLabel的典型用法代码示例。如果您正苦于以下问题:C++ WidgetLabel类的具体用法?C++ WidgetLabel怎么用?C++ WidgetLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WidgetLabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SDL_BlitSurface

/**
 * 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();
	}
}
开发者ID:mothmaster,项目名称:flare,代码行数:33,代码来源:ItemManager.cpp

示例2: SDL_BlitSurface

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();
}
开发者ID:Ablu,项目名称:flare-engine,代码行数:30,代码来源:MenuVendor.cpp

示例3: SDL_BlitSurface

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();
}
开发者ID:Pedro-dos-Santos,项目名称:flare-engine,代码行数:32,代码来源:MenuStash.cpp

示例4: SDL_BlitSurface

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();
}
开发者ID:GanjaBlazer,项目名称:flare,代码行数:27,代码来源:MenuStash.cpp

示例5: SDL_BlitSurface

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();
}
开发者ID:CmPons,项目名称:flare,代码行数:29,代码来源:MenuVendor.cpp

示例6: SDL_BlitSurface

/**
 * 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();
	}
}
开发者ID:lp150189,项目名称:flare-engine,代码行数:29,代码来源:ItemManager.cpp

示例7: WidgetLabel

WidgetLabel *GUI::createCaption(const Aurora::GFF3Struct &strct, Widget *parent) {
	if (!strct.hasField("Obj_Caption"))
		return 0;

	const Aurora::GFF3Struct &caption = strct.getStruct("Obj_Caption");

	Common::UString font = caption.getString("AurString_Font");

	Common::UString text;
	uint32 strRef = caption.getUint("Obj_StrRef", Aurora::kStrRefInvalid);
	if (strRef != Aurora::kStrRefInvalid)
		text = TalkMan.getString(strRef);

	WidgetLabel *label = new WidgetLabel(*this, parent->getTag() + "#Caption", font, text);

	float pX, pY, pZ;
	parent->getPosition(pX, pY, pZ);
	label->setPosition(pX, pY, pZ - 5.0f);

	float r = caption.getDouble("AurString_ColorR", 1.0);
	float g = caption.getDouble("AurString_ColorG", 1.0);
	float b = caption.getDouble("AurString_ColorB", 1.0);
	float a = caption.getDouble("AurString_ColorA", 1.0);

	label->setColor(r, g, b, a);

	initWidget(*label);

	parent->addChild(*label);
	addWidget(label);

	return label;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:33,代码来源:gui.cpp

示例8: 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();
}
开发者ID:hoodwolf,项目名称:flare-engine,代码行数:30,代码来源:WidgetSlot.cpp

示例9: get_cell_text

 const char * get_cell_text(uint16_t row_index, uint16_t column_index) {
     const char * result = "";
     if (this->toDelete[column_index][row_index]) {
         WidgetLabel * label = static_cast<WidgetLabel*>(this->widgets[column_index][row_index]);
         result = label->get_text();
     }
     return result;
 }
开发者ID:tvi123,项目名称:redemption,代码行数:8,代码来源:labelgrid.hpp

示例10: SDL_BlitSurface

/**
 * 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();
	}
}
开发者ID:Nojan,项目名称:flare,代码行数:55,代码来源:MenuExperience.cpp

示例11: SDL_BlitSurface

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);
}
开发者ID:AI0867,项目名称:flare,代码行数:50,代码来源:MenuEnemy.cpp

示例12: SDL_BlitSurface

/**
 * 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;
	}
}
开发者ID:mikhailSaTuRn,项目名称:flare,代码行数:52,代码来源:MenuLog.cpp

示例13: renderItemCounts

/**
 * 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();
		}
	}
}
开发者ID:dgsb,项目名称:flare-engine,代码行数:18,代码来源:MenuActionBar.cpp

示例14: 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();
}
开发者ID:aceofspades,项目名称:flare-engine,代码行数:51,代码来源:MenuLog.cpp

示例15: renderAttention

// 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();
    }
}
开发者ID:makrohn,项目名称:flare-engine,代码行数:18,代码来源:MenuActionBar.cpp


注:本文中的WidgetLabel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。