本文整理汇总了C++中setBackground函数的典型用法代码示例。如果您正苦于以下问题:C++ setBackground函数的具体用法?C++ setBackground怎么用?C++ setBackground使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setBackground函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Scene
Scene1105::Scene1105(NeverhoodEngine *vm, Module *parentModule)
: Scene(vm, parentModule), _countdown(0), _isPanelOpen(false), _isActionButtonClicked(false), _doMoveTeddy(false),
_isClosePanelDone(false), _leaveResult(0), _backgroundIndex(0) {
Sprite *ssOpenButton;
_vm->gameModule()->initMemoryPuzzle();
SetUpdateHandler(&Scene1105::update);
SetMessageHandler(&Scene1105::handleMessage);
setBackground(0x20010002);
setPalette(0x20010002);
_asTeddyBear = insertSprite<AsScene1105TeddyBear>(this);
ssOpenButton = insertSprite<SsScene1105OpenButton>(this);
addCollisionSprite(ssOpenButton);
insertPuzzleMouse(0x10006208, 20, 620);
loadSound(0, 0x48442057);
loadSound(1, 0xC025014F);
loadSound(2, 0x68E25540);
}
示例2: assert
void LogicAnalyzerDisplay::populateChannel(const int channel, const Pothos::Packet &packet)
{
//convert buffer (does not convert when type matches)
const auto numericBuff = packet.payload.convert(typeid(T));
assert(_chData.size() > channel);
_chData[channel] = packet;
_chData[channel].payload = numericBuff;
//load element data into table
for (size_t i = 0; i < numericBuff.elements(); i++)
{
const auto num = numericBuff.as<const T *>()[i];
const auto s = toStr(num, _chBase.at(channel));
auto item = new QTableWidgetItem(s);
auto flags = item->flags();
flags &= ~Qt::ItemIsEditable;
item->setFlags(flags);
item->setTextAlignment(Qt::AlignRight);
_tableView->setItem(channel, i, item);
}
//inspect labels to decorate table
for (const auto &label : packet.labels)
{
const int column = label.index;
assert(column < _tableView->columnCount());
auto item = _tableView->item(channel, column);
//highlight and display label id
item->setBackground(Qt::yellow);
item->setText(QString("%1\n%2")
.arg(item->text())
.arg(QString::fromStdString(label.id)));
_tableView->resizeColumnToContents(column);
}
}
示例3: Scene
Scene2901::Scene2901(NeverhoodEngine *vm, Module *parentModule, int which)
: Scene(vm, parentModule), _currLocationButtonNum(which), _selectedButtonNum(which),
_currWhirlButtonNum(0), _prevWhirlButtonNum(0), _countdown1(1), _skipCountdown(0), _blinkOn(0) {
_isButton2Broken = getGlobalVar(V_ENTRANCE_OPEN) != 0;
setSubVar(V_TELEPORTER_DEST_AVAILABLE, which, 1);
setSubVar(V_TELEPORTER_DEST_AVAILABLE, 5, 1);
setSubVar(V_TELEPORTER_DEST_AVAILABLE, 4, 1);
if (_currLocationButtonNum == 3)
setSubVar(V_TELEPORTER_DEST_AVAILABLE, 2, 1);
setBackground(kScene2901FileHashes1[_currLocationButtonNum]);
setPalette(kScene2901FileHashes1[_currLocationButtonNum]);
for (uint i = 0; i < 6; ++i) {
if (i != 2 || !_isButton2Broken) {
_ssLocationButtons[i] = insertSprite<SsScene2901LocationButton>(this, _currLocationButtonNum, i);
addCollisionSprite(_ssLocationButtons[i]);
_ssLocationButtonLights[i] = insertSprite<SsScene2901LocationButtonLight>(_currLocationButtonNum, i);
}
}
if (_isButton2Broken)
insertSprite<SsScene2901BrokenButton>(_currLocationButtonNum);
_ssBigButton = insertSprite<SsScene2901BigButton>(this, _currLocationButtonNum);
addCollisionSprite(_ssBigButton);
insertPuzzleMouse(kScene2901FileHashes2[_currLocationButtonNum], 20, 620);
SetUpdateHandler(&Scene2901::update);
SetMessageHandler(&Scene2901::handleMessage);
}
示例4: getColor
void SettingsDlg::updateStyleSample()
{
QColor txtColor = getColor( PROP_FONT_COLOR, 0x000000 );
QColor bgColor = getColor( PROP_BACKGROUND_COLOR, 0xFFFFFF );
QColor headerColor = getColor( PROP_STATUS_FONT_COLOR, 0xFFFFFF );
QColor selectionColor = getColor( PROP_HIGHLIGHT_SELECTION_COLOR, 0xC0C0C0 );
QColor commentColor = getColor( PROP_HIGHLIGHT_BOOKMARK_COLOR_COMMENT, 0xC0C000 );
QColor correctionColor = getColor( PROP_HIGHLIGHT_BOOKMARK_COLOR_CORRECTION, 0xC00000 );
setBackground( m_ui->frmTextColor, txtColor );
setBackground( m_ui->frmBgColor, bgColor );
setBackground( m_ui->frmHeaderTextColor, headerColor );
setBackground( m_ui->frmSelectionColor, selectionColor );
setBackground( m_ui->frmCommentColor, commentColor );
setBackground( m_ui->frmCorrectionColor, correctionColor );
m_ui->crSample->setOptions( m_props );
m_ui->crSample->getDocView()->setShowCover( false );
m_ui->crSample->getDocView()->setViewMode( DVM_SCROLL, 1 );
m_ui->crSample->getDocView()->getPageImage(0);
HyphMan::getDictList()->activate( qt2cr(m_oldHyph) );
}
示例5: magblocks4
//.........这里部分代码省略.........
}
/* Number of points scanned */
} else if (strcmp(command, "NP") == 0) {
if (!setNpnts(&npnts)) {
npntsa = npnts;
npntsb = npnts;
npntsc = npnts;
npntsd = npnts;
}
/* File for input data */
} else if (strcmp(command, "IF") == 0) {
setFilename(infile, INFILELEN + 2);
/* File for output data */
} else if (strcmp(command, "OF") == 0) {
setFilename(outfile, OUTFILELEN + 2);
/* File for parameters */
} else if (strcmp(command, "PF") == 0) {
setFilename(parfile, PARFILELEN + 2);
/* Polarization state */
} else if (strcmp(command, "PS") == 0) {
setPolstat(polstat, POLSTATLEN + 2);
/* Beam intensity */
} else if (strcmp(command, "BI") == 0) {
setBeamIntens(&bmintns, &Dbmintns);
/* Background intensity */
} else if (strcmp(command, "BK") == 0) {
setBackground(&bki, &Dbki);
/* Verify parameters by printing out */
} else if (strncmp(command, "VE", 2) == 0) {
printLayers(command);
/* Get data from file */
} else if (strcmp(command, "GD") == 0) {
loadData(infile, xspin);
/* Edit constraints */
} else if (strcmp(command, "EC") == 0) {
constrainFunc newmodule;
newmodule = newConstraints(constrainScript, constrainModule);
if (newmodule != NULL) Constrain = newmodule;
/* Reload constrain module */
} else if (strcmp(command, "LC") == 0) {
Constrain = loadConstrain(constrainModule);
/* Unload constrain module */
} else if (strcmp(command, "ULC") == 0) {
Constrain = loadConstrain(NULL);
/* Load parameters from parameter file */
} else if (strncmp(command, "LP", 2) == 0) {
loadParms(command, parfile, constrainScript, constrainModule);
/* Save parameters to parameter file */
} else if (strcmp(command, "SP") == 0) {
parms(qcsq, qcmsq, d, dm, rough, mrough, mu, the,
MAXLAY, &lambda, &lamdel, &thedel, &aguide,
示例6: setBackgroundColor
void setBackgroundColor(const QBrush& brush)
{
setBackground(brush);
}
示例7: setBackground
void Plot2D::setBackgroundColor(const QBrush &brush) {
setBackground(brush);
canvasBrush_ = brush;
}
示例8: setBackground
MenuInventory::MenuInventory(StatBlock *_stats) {
stats = _stats;
MAX_EQUIPPED = 4;
MAX_CARRIED = 64;
visible = false;
setBackground("images/menus/inventory.png");
currency = 0;
carried_cols = 4; // default to 4 if menus/inventory.txt::carried_cols not set
carried_rows = 4; // default to 4 if menus/inventory.txt::carried_rows not set
drag_prev_src = -1;
changed_equipment = true;
log_msg = "";
show_book = "";
closeButton = new WidgetButton("images/menus/buttons/button_x.png");
// Load config settings
FileParser infile;
// @CLASS MenuInventory|Description of menus/inventory.txt
if (infile.open("menus/inventory.txt")) {
while(infile.next()) {
if (parseMenuKey(infile.key, infile.val))
continue;
// @ATTR close|x (integer), y (integer)|Position of the close button.
if(infile.key == "close") {
Point pos = toPoint(infile.val);
closeButton->setBasePos(pos.x, pos.y);
}
// @ATTR equipment_slot|x (integer), y (integer), size (integer), slot_type (string)|Position and item type of an equipment slot.
else if(infile.key == "equipment_slot") {
Rect area;
Point pos;
pos.x = area.x = popFirstInt(infile.val);
pos.y = area.y = popFirstInt(infile.val);
area.w = area.h = popFirstInt(infile.val);
equipped_area.push_back(area);
equipped_pos.push_back(pos);
slot_type.push_back(popFirstString(infile.val));
}
// @ATTR slot_name|string|The displayed name of the last defined equipment slot.
else if(infile.key == "slot_name") slot_desc.push_back(infile.val);
// @ATTR carried_area|x (integer), y (integer)|Position of the first normal inventory slot.
else if(infile.key == "carried_area") {
Point pos;
carried_pos.x = carried_area.x = popFirstInt(infile.val);
carried_pos.y = carried_area.y = popFirstInt(infile.val);
}
// @ATTR carried_cols|integer|The number of columns for the normal inventory.
else if (infile.key == "carried_cols") carried_cols = std::max(1, toInt(infile.val));
// @ATTR carried_rows|integer|The number of rows for the normal inventory.
else if (infile.key == "carried_rows") carried_rows = std::max(1, toInt(infile.val));
// @ATTR label_title|label|Position of the "Inventory" label.
else if (infile.key == "label_title") title = eatLabelInfo(infile.val);
// @ATTR currency|label|Position of the label that displays the total currency being carried.
else if (infile.key == "currency") currency_lbl = eatLabelInfo(infile.val);
// @ATTR help|x (integer), y (integer), w (integer), h (integer)|A mouse-over area that displays some help text for inventory shortcuts.
else if (infile.key == "help") help_pos = toRect(infile.val);
else infile.error("MenuInventory: '%s' is not a valid key.", infile.key.c_str());
}
infile.close();
}
MAX_EQUIPPED = equipped_area.size();
MAX_CARRIED = carried_cols * carried_rows;
carried_area.w = carried_cols*ICON_SIZE;
carried_area.h = carried_rows*ICON_SIZE;
color_normal = font->getColor("menu_normal");
color_high = font->getColor("menu_bonus");
inventory[EQUIPMENT].init(MAX_EQUIPPED, equipped_area, slot_type);
inventory[CARRIED].init(MAX_CARRIED, carried_area, ICON_SIZE, carried_cols);
for (int i = 0; i < MAX_EQUIPPED; i++) {
tablist.add(inventory[EQUIPMENT].slots[i]);
}
for (int i = 0; i < MAX_CARRIED; i++) {
tablist.add(inventory[CARRIED].slots[i]);
}
align();
}
示例9: Scene
Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which)
: Scene(vm, parentModule), _asCar(NULL), _countdown1(0) {
setGlobalVar(V_CAR_DELTA_X, 1);
SetMessageHandler(&Scene1608::hmLowerFloor);
_asKey = insertSprite<AsCommonKey>(this, 1, 1100, 198, 220);
addCollisionSprite(_asKey);
if (which < 0) {
// Restoring game
if (_vm->gameState().which == 1)
// Klaymen is in the car
which = 1;
else {
// Klaymen is standing around
setRectList(0x004B47D0);
insertKlaymen<KmScene1608>(380, 438);
_kmScene1608 = _klaymen;
_klaymenInCar = false;
_sprite1 = insertStaticSprite(0x7D0404E8, 1100);
setMessageList(0x004B46A8);
setBackground(0x10080E01);
setPalette(0x10080E01);
_asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011);
addCollisionSprite(_asTape);
_klaymen->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480);
SetUpdateHandler(&Scene1608::upLowerFloor);
insertScreenMouse(0x80E05108);
insertStaticSprite(0x4B18F868, 1200);
}
} else if (which == 0) {
// Klaymen entering from the left
_vm->gameState().which = 0;
setRectList(0x004B47D0);
insertKlaymen<KmScene1608>(0, 438);
_kmScene1608 = _klaymen;
_klaymenInCar = false;
setMessageList(0x004B46B0);
setBackground(0x10080E01);
setPalette(0x10080E01);
_asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011);
addCollisionSprite(_asTape);
insertScreenMouse(0x80E05108);
_sprite1 = insertStaticSprite(0x7D0404E8, 1100);
_klaymen->setClipRect(_sprite1->getDrawRect().x, 0, 640, 480);
SetUpdateHandler(&Scene1608::upLowerFloor);
insertStaticSprite(0x4B18F868, 1200);
} else if (which == 2) {
// Klaymen returning from looking through the upper window
_vm->gameState().which = 1;
_dataResource.load(0x003C0492);
_roomPathPoints = _dataResource.getPointArray(calcHash("meArchroArchRoomPath"));
setBackground(0x98001604);
setPalette(0x98001604);
_palette->addPalette("paPodRed", 65, 31, 65);
insertScreenMouse(0x01600988);
_sprite2 = insertStaticSprite(0x491F38A8, 1100);
_asCar = createSprite<AsCommonCar>(this, 375, 227); // Create but don't add to the sprite list yet
_asIdleCarLower = insertSprite<AsCommonIdleCarLower>(375, 227);
_asIdleCarFull = insertSprite<AsCommonIdleCarFull>(375, 227);
_asCar->setVisible(false);
if (getGlobalVar(V_KLAYMEN_IS_DELTA_X)) {
insertKlaymen<KmScene1608>(373, 220);
_klaymen->setDoDeltaX(1);
} else
insertKlaymen<KmScene1608>(283, 220);
_kmScene1608 = _klaymen;
setMessageList(0x004B47A8);
SetMessageHandler(&Scene1608::hmUpperFloor);
SetUpdateHandler(&Scene1608::upUpperFloor);
_asCar->setPathPoints(_roomPathPoints);
sendMessage(_asCar, 0x2002, _roomPathPoints->size() - 1);
_sprite3 = insertStaticSprite(0xB47026B0, 1100);
_clipRect1.set(_sprite3->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2());
_clipRect3.set(_sprite2->getDrawRect().x, _sprite3->getDrawRect().y, 640, _sprite2->getDrawRect().y2());
_clipRect2 = _clipRect1;
_clipRect2.y2 = 215;
_klaymen->setClipRect(_clipRect1);
_asCar->setClipRect(_clipRect1);
_asIdleCarLower->setClipRect(_clipRect1);
_asIdleCarFull->setClipRect(_clipRect1);
_asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011);
addCollisionSprite(_asTape);
insertSprite<AsCommonCarConnector>(_asCar)->setClipRect(_clipRect1);
_klaymenInCar = false;
_carClipFlag = false;
_carStatus = 0;
setRectList(0x004B4810);
}
// NOTE: Not in the else because 'which' is set to 1 in the true branch
if (which == 1) {
// Klaymen riding the car
_vm->gameState().which = 1;
_dataResource.load(0x003C0492);
_roomPathPoints = _dataResource.getPointArray(calcHash("meArchroArchRoomPath"));
setBackground(0x98001604);
setPalette(0x98001604);
//.........这里部分代码省略.........
示例10: MenuBase
CustomGameStatsMenu::CustomGameStatsMenu() : MenuBase()
{
// set up window
SDL_Surface *surf;
surf = pGFXManager->getUIGraphic(UI_MenuBackground);
setBackground(surf,false);
resize(surf->w,surf->h);
setWindowWidget(&windowWidget);
int localHouseColor = houseColor[pLocalHouse->getHouseID()];
windowWidget.addWidget(&mainVBox, Point(24,23), Point(screen->w - 48, screen->h - 32));
captionLabel.setText(getBasename(currentGame->getGameInitSettings().getFilename(), true));
captionLabel.setTextColor(localHouseColor + 3);
captionLabel.setAlignment(Alignment_HCenter);
mainVBox.addWidget(&captionLabel, 24);
mainVBox.addWidget(VSpacer::create(24));
mainVBox.addWidget(Spacer::create(), 0.05);
mainVBox.addWidget(&mainHBox, 0.80);
mainHBox.addWidget(Spacer::create(), 0.4);
mainHBox.addWidget(&playerStatListVBox, 0.2);
headerHBox.addWidget(&headerLabelDummy, 130);
headerHBox.addWidget(Spacer::create(), 10);
headerLabel1.setText(_("Built Object"));
headerLabel1.setAlignment(Alignment_HCenter);
headerLabel1.setTextColor(localHouseColor + 3);
headerHBox.addWidget(&headerLabel1, 132);
headerHBox.addWidget(Spacer::create(), 30);
headerLabel2.setText(_("Destroyed"));
headerLabel2.setAlignment(Alignment_HCenter);
headerLabel2.setTextColor(localHouseColor + 3);
headerHBox.addWidget(&headerLabel2, 132);
headerLabel3.setText(_("Harvested Spice"));
headerLabel3.setAlignment(Alignment_HCenter);
headerLabel3.setTextColor(localHouseColor + 3);
headerHBox.addWidget(Spacer::create(), 30);
headerHBox.addWidget(&headerLabel3, 132);
playerStatListVBox.addWidget(&headerHBox, 25);
playerStatListVBox.addWidget(VSpacer::create(15));
int maxBuiltValue = 0;
int maxDestroyedValue = 0;
float maxSpiceHarvested = 0.0;
for(int i=0;i<NUM_HOUSES;i++) {
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL) {
maxBuiltValue = std::max(maxBuiltValue, pHouse->getBuiltValue());
maxDestroyedValue = std::max(maxDestroyedValue, pHouse->getDestroyedValue());
maxSpiceHarvested = std::max(maxSpiceHarvested, pHouse->getHarvestedSpice());
}
}
for(int i=0;i<NUM_HOUSES;i++) {
HouseStat& curHouseStat = houseStat[i];
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL) {
int color = houseColor[i];
curHouseStat.houseName.setText(_("House") + " " + getHouseNameByNumber((HOUSETYPE) i));
curHouseStat.houseName.setTextColor(color + 3);
curHouseStat.houseHBox.addWidget(&curHouseStat.houseName, 140);
curHouseStat.houseHBox.addWidget(Spacer::create(), 15);
curHouseStat.value1.setText( stringify(pHouse->getBuiltValue()*100));
curHouseStat.value1.setTextFont(FONT_STD10);
curHouseStat.value1.setAlignment(Alignment_Right);
curHouseStat.value1.setTextColor(color + 3);
curHouseStat.houseHBox.addWidget(&curHouseStat.value1, 50);
curHouseStat.houseHBox.addWidget(HSpacer::create(2));
curHouseStat.progressBar1.setProgress( (maxBuiltValue == 0) ? 0.0 : (pHouse->getBuiltValue() * 100.0f / maxBuiltValue));
curHouseStat.progressBar1.setDrawShadow(true);
curHouseStat.progressBar1.setColor(color + 1);
curHouseStat.vBox1.addWidget(Spacer::create(), 0.5);
curHouseStat.vBox1.addWidget(&curHouseStat.progressBar1, 12);
curHouseStat.vBox1.addWidget(Spacer::create(), 0.5);
curHouseStat.houseHBox.addWidget(&curHouseStat.vBox1, 80);
curHouseStat.houseHBox.addWidget(Spacer::create(), 30);
curHouseStat.value2.setText( stringify(pHouse->getDestroyedValue()*100));
curHouseStat.value2.setTextFont(FONT_STD10);
curHouseStat.value2.setAlignment(Alignment_Right);
curHouseStat.value2.setTextColor(color + 3);
curHouseStat.houseHBox.addWidget(&curHouseStat.value2, 50);
curHouseStat.houseHBox.addWidget(HSpacer::create(2));
curHouseStat.progressBar2.setProgress( (maxDestroyedValue == 0) ? 0.0 : (pHouse->getDestroyedValue() * 100.0f / maxDestroyedValue));
curHouseStat.progressBar2.setDrawShadow(true);
curHouseStat.progressBar2.setColor(color + 1);
//.........这里部分代码省略.........
示例11: setBackground
void LCDControllerDriver::clearScreen() {
setBackground(0x00000000);
}
示例12: Menu
MenuVendor::MenuVendor(StatBlock *_stats)
: Menu()
, stats(_stats)
, closeButton(new WidgetButton("images/menus/buttons/button_x.png"))
, tabControl(new WidgetTabControl())
, slots_cols(1)
, slots_rows(1)
, activetab(VENDOR_BUY)
, color_normal(font->getColor("menu_normal"))
, npc(NULL)
, buyback_stock() {
setBackground("images/menus/vendor.png");
tabControl->setTabTitle(VENDOR_BUY, msg->get("Inventory"));
tabControl->setTabTitle(VENDOR_SELL, msg->get("Buyback"));
// Load config settings
FileParser infile;
// @CLASS MenuVendor|Description of menus/vendor.txt
if(infile.open("menus/vendor.txt")) {
while(infile.next()) {
if (parseMenuKey(infile.key, infile.val))
continue;
// @ATTR close|x (integer), y (integer)|Position of the close button.
if(infile.key == "close") {
Point pos = toPoint(infile.val);
closeButton->setBasePos(pos.x, pos.y);
}
// @ATTR slots_area|x (integer), y (integer)|Position of the top-left slot.
else if(infile.key == "slots_area") {
slots_area.x = popFirstInt(infile.val);
slots_area.y = popFirstInt(infile.val);
}
// @ATTR vendor_cols|integer|The number of columns in the grid of slots.
else if (infile.key == "vendor_cols") {
slots_cols = std::max(1, toInt(infile.val));
}
// @ATTR vendor_rows|integer|The number of rows in the grid of slots.
else if (infile.key == "vendor_rows") {
slots_rows = std::max(1, toInt(infile.val));
}
// @ATTR label_title|label|The position of the text that displays the NPC's name.
else if (infile.key == "label_title") {
title = eatLabelInfo(infile.val);
}
else {
infile.error("MenuVendor: '%s' is not a valid key.", infile.key.c_str());
}
}
infile.close();
}
VENDOR_SLOTS = slots_cols * slots_rows;
slots_area.w = slots_cols*ICON_SIZE;
slots_area.h = slots_rows*ICON_SIZE;
stock[VENDOR_BUY].init(VENDOR_SLOTS, slots_area, ICON_SIZE, slots_cols);
stock[VENDOR_SELL].init(VENDOR_SLOTS, slots_area, ICON_SIZE, slots_cols);
buyback_stock.init(NPC_VENDOR_MAX_STOCK);
for (unsigned i = 0; i < VENDOR_SLOTS; i++) {
tablist.add(stock[VENDOR_BUY].slots[i]);
}
for (unsigned i = 0; i < VENDOR_SLOTS; i++) {
tablist.add(stock[VENDOR_SELL].slots[i]);
}
align();
}
示例13: Menu
MenuStash::MenuStash()
: Menu()
, closeButton(new WidgetButton("images/menus/buttons/button_x.png"))
, tab_control(new WidgetTabControl())
, activetab(STASH_PRIVATE)
, drag_prev_tab(-1)
, stock()
, updated(false)
{
tab_control->setTabTitle(STASH_PRIVATE, msg->get("Private"));
if (!pc->stats.permadeath)
tab_control->setTabTitle(STASH_SHARED, msg->get("Shared"));
setBackground("images/menus/stash.png");
int slots_cols = 8; // default if menus/stash.txt::stash_cols not set
int slots_rows = 8; // default if menus/stash.txt::slots_rows not set
// Load config settings
FileParser infile;
// @CLASS MenuStash|Description of menus/stash.txt
if (infile.open("menus/stash.txt", FileParser::MOD_FILE, FileParser::ERROR_NORMAL)) {
while(infile.next()) {
if (parseMenuKey(infile.key, infile.val))
continue;
// @ATTR close|point|Position of the close button.
if (infile.key == "close") {
Point pos = Parse::toPoint(infile.val);
closeButton->setBasePos(pos.x, pos.y, Utils::ALIGN_TOPLEFT);
}
// @ATTR slots_area|point|Position of the top-left slot.
else if (infile.key == "slots_area") {
slots_area.x = Parse::popFirstInt(infile.val);
slots_area.y = Parse::popFirstInt(infile.val);
}
// @ATTR stash_cols|int|The number of columns for the grid of slots.
else if (infile.key == "stash_cols") {
slots_cols = std::max(1, Parse::toInt(infile.val));
}
// @ATTR stash_rows|int|The number of rows for the grid of slots.
else if (infile.key == "stash_rows") {
slots_rows = std::max(1, Parse::toInt(infile.val));
}
// @ATTR label_title|label|Position of the "Stash" label.
else if (infile.key == "label_title") {
label_title.setFromLabelInfo(Parse::popLabelInfo(infile.val));
}
// @ATTR currency|label|Position of the label displaying the amount of currency stored in the stash.
else if (infile.key == "currency") {
label_currency.setFromLabelInfo(Parse::popLabelInfo(infile.val));
}
else {
infile.error("MenuStash: '%s' is not a valid key.", infile.key.c_str());
}
}
infile.close();
}
label_title.setText(msg->get("Stash"));
label_title.setColor(font->getColor(FontEngine::COLOR_MENU_NORMAL));
label_currency.setColor(font->getColor(FontEngine::COLOR_MENU_NORMAL));
int stash_slots = slots_cols * slots_rows;
slots_area.w = slots_cols * eset->resolutions.icon_size;
slots_area.h = slots_rows * eset->resolutions.icon_size;
stock[STASH_PRIVATE].initGrid(stash_slots, slots_area, slots_cols);
stock[STASH_SHARED].initGrid(stash_slots, slots_area, slots_cols);
tablist.add(tab_control);
tablist_private.setPrevTabList(&tablist);
tablist_shared.setPrevTabList(&tablist);
tablist_private.lock();
tablist_shared.lock();
for (int i = 0; i < stash_slots; i++) {
tablist_private.add(stock[STASH_PRIVATE].slots[i]);
tablist_shared.add(stock[STASH_SHARED].slots[i]);
}
align();
}
示例14: Window
LoadMapWindow::LoadMapWindow(int color) : Window(0,0,0,0), color(color) {
// set up window
SDL_Surface *surf;
surf = pGFXManager->getUIGraphic(UI_NewMapWindow);
setBackground(surf,false);
int xpos = std::max(0,(screen->w - surf->w)/2);
int ypos = std::max(0,(screen->h - surf->h)/2);
setCurrentPosition(xpos,ypos,surf->w,surf->h);
setWindowWidget(&mainHBox);
mainHBox.addWidget(HSpacer::create(16));
mainHBox.addWidget(&mainVBox);
mainHBox.addWidget(HSpacer::create(16));
titleLabel.setTextColor(110, COLOR_TRANSPARENT);
titleLabel.setAlignment((Alignment_Enum) (Alignment_HCenter | Alignment_VCenter));
titleLabel.setText(_("Load Map"));
mainVBox.addWidget(&titleLabel);
mainVBox.addWidget(VSpacer::create(22));
mainVBox.addWidget(¢ralHBox, 346);
centralHBox.addWidget(&leftVBox, 0.8);
leftVBox.addWidget(&mapTypeButtonsHBox, 24);
singleplayerUserMapsButton.setText(_("SP User Maps"));
singleplayerUserMapsButton.setTextColor(color);
singleplayerUserMapsButton.setToggleButton(true);
singleplayerUserMapsButton.setOnClick(std::bind(&LoadMapWindow::onMapTypeChange, this, 0));
mapTypeButtonsHBox.addWidget(&singleplayerUserMapsButton);
multiplayerUserMapsButton.setText(_("MP User Maps"));
multiplayerUserMapsButton.setTextColor(color);
multiplayerUserMapsButton.setToggleButton(true);
multiplayerUserMapsButton.setOnClick(std::bind(&LoadMapWindow::onMapTypeChange, this, 1));
mapTypeButtonsHBox.addWidget(&multiplayerUserMapsButton);
mapTypeButtonsHBox.addWidget(Spacer::create(), 5.0);
mapList.setColor(color);
mapList.setAutohideScrollbar(false);
mapList.setOnSelectionChange(std::bind(&LoadMapWindow::onMapListSelectionChange, this, std::placeholders::_1));
mapList.setOnDoubleClick(std::bind(&LoadMapWindow::onLoad, this));
leftVBox.addWidget(&mapList, 0.95);
leftVBox.addWidget(VSpacer::create(10));
centralHBox.addWidget(HSpacer::create(8));
centralHBox.addWidget(Spacer::create(), 0.05);
centralHBox.addWidget(&rightVBox, 180);
minimap.setSurface( GUIStyle::getInstance().createButtonSurface(130,130,_("Choose map"), true, false), true);
rightVBox.addWidget(&minimap);
rightVBox.addWidget(VSpacer::create(10));
rightVBox.addWidget(&mapPropertiesHBox, 0.01);
mapPropertiesHBox.addWidget(&mapPropertyNamesVBox, 75);
mapPropertiesHBox.addWidget(&mapPropertyValuesVBox, 105);
mapPropertyNamesVBox.addWidget(Label::create(_("Size") + ":", color));
mapPropertySize.setTextColor(color);
mapPropertyValuesVBox.addWidget(&mapPropertySize);
mapPropertyNamesVBox.addWidget(Label::create(_("Players") + ":", color));
mapPropertyPlayers.setTextColor(color);
mapPropertyValuesVBox.addWidget(&mapPropertyPlayers);
mapPropertyNamesVBox.addWidget(Label::create(_("Author") + ":", color));
mapPropertyAuthors.setTextColor(color);
mapPropertyValuesVBox.addWidget(&mapPropertyAuthors);
mapPropertyNamesVBox.addWidget(Label::create(_("License") + ":", color));
mapPropertyLicense.setTextColor(color);
mapPropertyValuesVBox.addWidget(&mapPropertyLicense);
rightVBox.addWidget(Spacer::create());
mainVBox.addWidget(VSpacer::create(5));
mainVBox.addWidget(&buttonHBox);
cancelButton.setText(_("Cancel"));
cancelButton.setTextColor(color);
cancelButton.setOnClick(std::bind(&LoadMapWindow::onCancel, this));
buttonHBox.addWidget(&cancelButton);
buttonHBox.addWidget(HSpacer::create(8));
buttonHBox.addWidget(Spacer::create());
buttonHBox.addWidget(HSpacer::create(8));
loadButton.setText(_("Load"));
loadButton.setTextColor(color);
loadButton.setOnClick(std::bind(&LoadMapWindow::onLoad, this));
buttonHBox.addWidget(&loadButton);
//.........这里部分代码省略.........
示例15: setBackground
void MyScene::setBgIndividualy(QString bgPath, int repeat){
//set background
setBackground(bgPath, repeat);
}