本文整理汇总了C++中setBackground函数的典型用法代码示例。如果您正苦于以下问题:C++ setBackground函数的具体用法?C++ setBackground怎么用?C++ setBackground使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setBackground函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:24,代码来源:module1100.cpp
示例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);
}
}
开发者ID:m0x72,项目名称:pothos,代码行数:36,代码来源:LogicAnalyzerDisplay.cpp
示例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);
}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:36,代码来源:module2900.cpp
示例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) );
}
开发者ID:frankyifei,项目名称:crengine-snapshot-sourceforge,代码行数:23,代码来源:settings.cpp
示例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,
开发者ID:reflectometry,项目名称:reflpak,代码行数:67,代码来源:magblocks4.c
示例6: setBackgroundColor
void setBackgroundColor(const QBrush& brush)
{
setBackground(brush);
}
开发者ID:bartart3d,项目名称:oom,代码行数:4,代码来源:EffectRack.cpp
示例7: setBackground
void Plot2D::setBackgroundColor(const QBrush &brush) {
setBackground(brush);
canvasBrush_ = brush;
}
开发者ID:narunlifescience,项目名称:AlphaPlot,代码行数:4,代码来源:Plot2D.cpp
示例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();
}
开发者ID:RetroAsh,项目名称:flare-engine-next,代码行数:90,代码来源:MenuInventory.cpp
示例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);
//.........这里部分代码省略.........
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:101,代码来源:module1600.cpp
示例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);
//.........这里部分代码省略.........
开发者ID:mathdesc,项目名称:dunelegacy,代码行数:101,代码来源:CustomGameStatsMenu.cpp
示例11: setBackground
void LCDControllerDriver::clearScreen() {
setBackground(0x00000000);
}
开发者ID:fgervais,项目名称:armconsole,代码行数:3,代码来源:LCDControllerDriver.cpp
示例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();
}
开发者ID:RetroAsh,项目名称:flare-engine-next,代码行数:70,代码来源:MenuVendor.cpp
示例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();
}
开发者ID:dorkster,项目名称:flare-engine-next,代码行数:86,代码来源:MenuStash.cpp
示例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);
//.........这里部分代码省略.........
开发者ID:binarycrusader,项目名称:dunelegacy,代码行数:101,代码来源:LoadMapWindow.cpp
示例15: setBackground
void MyScene::setBgIndividualy(QString bgPath, int repeat){
//set background
setBackground(bgPath, repeat);
}
开发者ID:Vazzi,项目名称:Stalker-Editor,代码行数:5,代码来源:myscene.cpp
示例16: QWidget
/**
* Constructor.
*/
QG_GraphicView::QG_GraphicView(QWidget* parent, const char* name, Qt::WindowFlags f)
: QWidget(parent, f), RS_GraphicView() {
setObjectName(name);
setBackground(background);
redrawMethod=RS2::RedrawAll;
isSmoothScrolling = false;
PixmapLayer1=PixmapLayer2=PixmapLayer3=NULL;
layout = new QGridLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
layout->setColumnStretch(0, 1);
layout->setColumnStretch(1, 0);
layout->setColumnStretch(2, 0);
layout->setRowStretch(0, 1);
layout->setRowStretch(1, 0);
hScrollBar = new QG_ScrollBar(Qt::Horizontal, this);
hScrollBar->setSingleStep(50);
hScrollBar->setCursor(Qt::ArrowCursor);
layout->addWidget(hScrollBar, 1, 0);
layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0);
connect(hScrollBar, SIGNAL(valueChanged(int)),
this, SLOT(slotHScrolled(int)));
vScrollBar = new QG_ScrollBar(Qt::Vertical, this);
vScrollBar->setSingleStep(50);
vScrollBar->setCursor(Qt::ArrowCursor);
layout->addWidget(vScrollBar, 0, 2);
layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2);
connect(vScrollBar, SIGNAL(valueChanged(int)),
this, SLOT(slotVScrolled(int)));
// Mouse Cursors:
QPixmap cur1(":ui/cur_cad_bmp.png");
QPixmap cur2(":ui/cur_glass_bmp.png");
QPixmap cur3(":ui/cur_del_bmp.png");
QPixmap cur4(":ui/cur_select_bmp.png");
QPixmap cur5(":ui/cur_hand_bmp.png");
#ifdef Q_OS_WIN32
curCad = new QCursor(cur1, 16, 16);
curMagnifier = new QCursor(cur2, 12, 12);
curDel = new QCursor(cur3, 16, 16);
curSelect = new QCursor(cur4, 16, 16);
curHand = new QCursor(cur5, 15, 15);
#else
curCad = new QCursor(cur1, 15, 15);
curMagnifier = new QCursor(cur2, 12, 12);
curDel = new QCursor(cur3, 15, 15);
curSelect = new QCursor(cur4, 15, 15);
curHand = new QCursor(cur5, 15, 15);
#endif
// Dummy widgets for scrollbar corners:
//layout->addWidget(new QWidget(this), 1, 1);
//QWidget* w = new QWidget(this);
//w->setEraseColor(QColor(255,0,0));
gridStatus = new QLabel("-", this);
gridStatus->setAlignment(Qt::AlignRight);
layout->addWidget(gridStatus, 1, 1, 1, 2);
layout->addItem(new QSpacerItem(50, 0), 0, 1);
setMouseTracking(true);
// flickering under win:
//setFocusPolicy(WheelFocus);
setFocusPolicy(Qt::NoFocus);
// See https://sourceforge.net/tracker/?func=detail&aid=3289298&group_id=342582&atid=1433844 (Left-mouse drag shrinks window)
setAttribute(Qt::WA_NoMousePropagation);
//update entities to selected entities to the current active layer
RS_SETTINGS->beginGroup("/Modify");
m_bUpdateLayer=(RS_SETTINGS->readEntry("/ModifyEntitiesToActiveLayer", "0")=="1");
RS_SETTINGS->writeEntry("/ModifyEntitiesToActiveLayer", m_bUpdateLayer?1:0);
RS_SETTINGS->endGroup();
}
开发者ID:ASF-inhambane,项目名称:LibreCAD,代码行数:83,代码来源:qg_graphicview.cpp
示例17: background
void gMainWindow::reparent(gContainer *newpr, int x, int y)
{
GtkWidget *new_border;
int w, h;
gColor fg, bg;
if (_xembed)
return;
bg = background();
fg = foreground();
if (isTopLevel() && newpr)
{
gtk_window_remove_accel_group(GTK_WINDOW(topLevel()->border), accel);
new_border = gtk_event_box_new();
gtk_widget_reparent(widget, new_border);
embedMenuBar(new_border);
_no_delete = true;
gtk_widget_destroy(border);
_no_delete = false;
border = new_border;
registerControl();
setCanFocus(false);
setParent(newpr);
connectParent();
borderSignals();
initWindow();
setBackground(bg);
setForeground(fg);
setFont(font());
checkMenuBar();
bufX = bufY = 0;
move(x, y);
gtk_widget_set_size_request(border, width(), height());
// Hidden children are incorrectly shown. Fix that!
hideHiddenChildren();
}
else if ((!isTopLevel() && !newpr)
|| (isTopLevel() && isPopup()))
//|| (isTopLevel() && (isPopup() ^ (type == GTK_WINDOW_POPUP))))
{
gtk_window_remove_accel_group(GTK_WINDOW(topLevel()->border), accel);
// TODO: test that
new_border = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_reparent(widget, new_border);
embedMenuBar(new_border);
_no_delete = true;
gtk_widget_destroy(border);
_no_delete = false;
border = new_border;
registerControl();
setCanFocus(true);
if (parent())
{
parent()->remove(this);
parent()->arrange();
setParent(NULL);
}
initWindow();
borderSignals();
setBackground(bg);
setForeground(fg);
setFont(font());
move(x, y);
w = width();
h = height();
bufW = bufH = -1;
gtk_widget_set_size_request(border, 1, 1);
resize(w, h);
hideHiddenChildren();
_popup = false; //type == GTK_WINDOW_POPUP;
}
else
{
gContainer::reparent(newpr, x, y);
}
}
开发者ID:ramonelalto,项目名称:gambas,代码行数:89,代码来源:gmainwindow.cpp
示例18: unloadLibrary
//.........这里部分代码省略.........
filename = getStringFromConfig(_bookGroup, Common::String::format("%d", id));
filename = mangleFilename(filename);
// bookGroup is the basename of the path.
// TODO: tidy this up.
_bookGroup.clear();
for (uint i = 0; i < filename.size(); i++) {
if (filename[i] == '~' || filename[i] == '/' || filename[i] == ':')
continue;
for (uint j = 0; j < filename.size(); j++) {
if (filename[j] == '/') {
_bookGroup.clear();
continue;
}
if (filename[j] == '.')
break;
_bookGroup += filename[j];
}
break;
}
} else {
if (!id)
id = atoi(getStringFromConfig("Common", "StartUp").c_str());
filename = getFilename("Libs", id);
}
Library library;
library._id = id;
library._archive = new ComposerArchive();
if (!library._archive->openFile(filename))
error("failed to open '%s'", filename.c_str());
_libraries.push_front(library);
Library &newLib = _libraries.front();
Common::Array<uint16> buttonResources = library._archive->getResourceIDList(ID_BUTN);
for (uint i = 0; i < buttonResources.size(); i++) {
uint16 buttonId = buttonResources[i];
Common::SeekableReadStream *stream = library._archive->getResource(ID_BUTN, buttonId);
Button button(stream, buttonId, getGameType());
bool inserted = false;
for (Common::List<Button>::iterator b = newLib._buttons.begin(); b != newLib._buttons.end(); b++) {
if (button._zorder < b->_zorder)
continue;
newLib._buttons.insert(b, button);
inserted = true;
break;
}
if (!inserted)
newLib._buttons.push_back(button);
}
Common::Array<uint16> ambientResources = library._archive->getResourceIDList(ID_AMBI);
for (uint i = 0; i < ambientResources.size(); i++) {
Common::SeekableReadStream *stream = library._archive->getResource(ID_AMBI, ambientResources[i]);
Button button(stream);
newLib._buttons.insert(newLib._buttons.begin(), button);
}
Common::Array<uint16> accelResources = library._archive->getResourceIDList(ID_ACEL);
for (uint i = 0; i < accelResources.size(); i++) {
Common::SeekableReadStream *stream = library._archive->getResource(ID_ACEL, accelResources[i]);
KeyboardHandler handler;
handler.keyId = stream->readUint16LE();
handler.modifierId = stream->readUint16LE();
handler.scriptId = stream->readUint16LE();
newLib._keyboardHandlers.push_back(handler);
}
Common::Array<uint16> randResources = library._archive->getResourceIDList(ID_RAND);
for (uint i = 0; i < randResources.size(); i++) {
Common::SeekableReadStream *stream = library._archive->getResource(ID_RAND, randResources[i]);
Common::Array<RandomEvent> &events = _randomEvents[randResources[i]];
uint16 count = stream->readUint16LE();
for (uint j = 0; j < count; j++) {
RandomEvent random;
random.scriptId = stream->readUint16LE();
random.weight = stream->readUint16LE();
events.push_back(random);
}
delete stream;
}
// add background sprite, if it exists
if (hasResource(ID_BMAP, 1000))
setBackground(1000);
// TODO: better CTBL logic
loadCTBL(1000, 100);
// Run the startup script.
runScript(1000, 0, 0, 0);
_mouseEnabled = true;
onMouseMove(_lastMousePos);
runEvent(kEventLoad, id, 0, 0);
}
开发者ID:SinSiXX,项目名称:scummvm,代码行数:101,代码来源:composer.cpp
示例19: Menu
MenuTalker::MenuTalker(MenuManager *_menu)
: Menu()
, menu(_menu)
, portrait(NULL)
, dialog_node(0)
, event_cursor(0)
, font_who("font_regular")
, font_dialog("font_regular")
, color_normal(font->getColor("menu_normal"))
, npc(NULL)
, advanceButton(new WidgetButton("images/menus/buttons/right.png"))
, closeButton(new WidgetButton("images/menus/buttons/bu
|
请发表评论