本文整理汇总了C++中centerAllSurfaces函数的典型用法代码示例。如果您正苦于以下问题:C++ centerAllSurfaces函数的具体用法?C++ centerAllSurfaces怎么用?C++ centerAllSurfaces使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了centerAllSurfaces函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: State
/**
* Initializes all the elements in the Defeat screen.
* @param game Pointer to the core game.
*/
DefeatState::DefeatState(Game *game) : State(game), _screenNumber(0)
{
// Create objects
_screen = new InteractiveSurface(320, 200, 0, 0);
_txtText.push_back(new Text(190, 104, 0, 0));
_txtText.push_back(new Text(200, 34, 32, 0));
_timer = new Timer(20000);
add(_screen);
// Set up objects
_screen->onMouseClick((ActionHandler)&DefeatState::windowClick);
_game->getResourcePack()->getMusic("GMLOSE")->play();
for (int text = 0; text != 2; ++text)
{
std::stringstream ss2;
ss2 << "STR_GAME_OVER_" << text+1;
_txtText[text]->setText(_game->getLanguage()->getString(ss2.str()));
_txtText[text]->setWordWrap(true);
add(_txtText[text]);
_txtText[text]->setVisible(false);
}
centerAllSurfaces();
_timer->onTimer((StateHandler)&DefeatState::windowClick);
_timer->start();
}
开发者ID:Arthur1994,项目名称:OpenXcom,代码行数:34,代码来源:DefeatState.cpp
示例2: Text
/**
* Builds the interface.
* @param palette Parent state palette.
*/
void SaveGameState::buildUi(SDL_Color *palette)
{
_screen = false;
// Create objects
_txtStatus = new Text(320, 17, 0, 92);
// Set palette
setPalette(palette);
if (_origin == OPT_BATTLESCAPE)
{
add(_txtStatus, "textLoad", "battlescape");
_txtStatus->setHighContrast(true);
}
else
{
add(_txtStatus, "textLoad", "geoscape");
}
centerAllSurfaces();
// Set up objects
_txtStatus->setBig();
_txtStatus->setAlign(ALIGN_CENTER);
_txtStatus->setText(tr("STR_SAVING_GAME"));
}
开发者ID:BHSDuncan,项目名称:OpenXcom,代码行数:32,代码来源:SaveGameState.cpp
示例3: State
/**
* Initializes all the elements.
* @param game Pointer to the core game.
* @param msg Message string.
*/
InfoboxState::InfoboxState(Game *game, const std::wstring &msg) : State(game)
{
_screen = false;
// Create objects
_window = new Window(this, 261, 122, 34, 10);
_text = new Text(251, 112, 39, 15);
add(_window);
add(_text);
centerAllSurfaces();
_window->setColor(Palette::blockOffset(0));
_window->setHighContrast(true);
_text->setAlign(ALIGN_CENTER);
_text->setVerticalAlign(ALIGN_MIDDLE);
_text->setBig();
_text->setWordWrap(true);
_text->setText(msg);
_text->setColor(Palette::blockOffset(0));
_text->setHighContrast(true);
_text->setPalette(_window->getPalette());
_timer = new Timer(INFOBOX_DELAY);
_timer->onTimer((StateHandler)&InfoboxState::close);
_timer->start();
}
开发者ID:Arthur1994,项目名称:OpenXcom,代码行数:34,代码来源:InfoboxState.cpp
示例4: _base
/**
* Initializes all the elements in the Equip Craft screen.
* @param game Pointer to the core game.
* @param base Pointer to the base to get info from.
*/
CraftsState::CraftsState(Base *base) : _base(base)
{
// Create objects
_window = new Window(this, 320, 200, 0, 0);
_btnOk = new TextButton(288, 16, 16, 176);
_txtTitle = new Text(298, 17, 16, 8);
_txtBase = new Text(298, 17, 16, 24);
_txtName = new Text(94, 9, 16, 40);
_txtStatus = new Text(50, 9, 110, 40);
_txtWeapon = new Text(50, 17, 160, 40);
_txtCrew = new Text(58, 9, 210, 40);
_txtHwp = new Text(46, 9, 268, 40);
_lstCrafts = new TextList(288, 118, 8, 58);
// Set palette
setInterface("craftSelect");
add(_window, "window", "craftSelect");
add(_btnOk, "button", "craftSelect");
add(_txtTitle, "text", "craftSelect");
add(_txtBase, "text", "craftSelect");
add(_txtName, "text", "craftSelect");
add(_txtStatus, "text", "craftSelect");
add(_txtWeapon, "text", "craftSelect");
add(_txtCrew, "text", "craftSelect");
add(_txtHwp, "text", "craftSelect");
add(_lstCrafts, "list", "craftSelect");
centerAllSurfaces();
// Set up objects
_window->setBackground(_game->getResourcePack()->getSurface("BACK14.SCR"));
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&CraftsState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&CraftsState::btnOkClick, Options::keyCancel);
_txtTitle->setBig();
_txtTitle->setText(tr("STR_INTERCEPTION_CRAFT"));
_txtBase->setBig();
_txtBase->setText(tr("STR_BASE_").arg(_base->getName()));
_txtName->setText(tr("STR_NAME_UC"));
_txtStatus->setText(tr("STR_STATUS"));
_txtWeapon->setText(tr("STR_WEAPON_SYSTEMS"));
_txtWeapon->setWordWrap(true);
_txtCrew->setText(tr("STR_CREW"));
_txtHwp->setText(tr("STR_HWPS"));
_lstCrafts->setColumns(5, 94, 68, 44, 46, 28);
_lstCrafts->setSelectable(true);
_lstCrafts->setBackground(_window);
_lstCrafts->setMargin(8);
_lstCrafts->onMouseClick((ActionHandler)&CraftsState::lstCraftsClick);
}
开发者ID:CMDBob,项目名称:OpenXcom,代码行数:64,代码来源:CraftsState.cpp
示例5: ArticleState
ArticleStateCraftWeapon::ArticleStateCraftWeapon(ArticleDefinitionCraftWeapon *defs) : ArticleState(defs->id)
{
RuleCraftWeapon *weapon = _game->getMod()->getCraftWeapon(defs->id);
// add screen elements
_txtTitle = new Text(200, 32, 5, 24);
// Set palette
setPalette("PAL_BATTLEPEDIA");
ArticleState::initLayout();
// add other elements
add(_txtTitle);
// Set up objects
_game->getMod()->getSurface(defs->image_id)->blit(_bg);
_btnOk->setColor(Palette::blockOffset(1));
_btnPrev->setColor(Palette::blockOffset(1));
_btnNext->setColor(Palette::blockOffset(1));
_txtTitle->setColor(Palette::blockOffset(14)+15);
_txtTitle->setBig();
_txtTitle->setWordWrap(true);
_txtTitle->setText(tr(defs->title));
_txtInfo = new Text(310, 32, 5, 160);
add(_txtInfo);
_txtInfo->setColor(Palette::blockOffset(14)+15);
_txtInfo->setWordWrap(true);
_txtInfo->setText(tr(defs->text));
_lstInfo = new TextList(250, 111, 5, 80);
add(_lstInfo);
_lstInfo->setColor(Palette::blockOffset(14)+15);
_lstInfo->setColumns(2, 180, 70);
_lstInfo->setDot(true);
_lstInfo->setBig();
_lstInfo->addRow(2, tr("STR_DAMAGE").c_str(), Text::formatNumber(weapon->getDamage()).c_str());
_lstInfo->setCellColor(0, 1, Palette::blockOffset(15)+4);
_lstInfo->addRow(2, tr("STR_RANGE").c_str(), tr("STR_KILOMETERS").arg(weapon->getRange()).c_str());
_lstInfo->setCellColor(1, 1, Palette::blockOffset(15)+4);
_lstInfo->addRow(2, tr("STR_ACCURACY").c_str(), Text::formatPercentage(weapon->getAccuracy()).c_str());
_lstInfo->setCellColor(2, 1, Palette::blockOffset(15)+4);
_lstInfo->addRow(2, tr("STR_RE_LOAD_TIME").c_str(), tr("STR_SECONDS").arg(weapon->getStandardReload()).c_str());
_lstInfo->setCellColor(3, 1, Palette::blockOffset(15)+4);
_lstInfo->addRow(2, tr("STR_ROUNDS").c_str(), Text::formatNumber(weapon->getAmmoMax()).c_str());
_lstInfo->setCellColor(4, 1, Palette::blockOffset(15)+4);
centerAllSurfaces();
}
开发者ID:0x90sled,项目名称:OpenXcom,代码行数:59,代码来源:ArticleStateCraftWeapon.cpp
示例6: _base
/**
* Initializes all the elements in the EndResearch screen.
* @param game Pointer to the core game.
* @param base Pointer to the base to get info from.
* @param possibilities List of newly possible ResearchProject
*/
NewPossibleResearchState::NewPossibleResearchState(Base * base, const std::vector<RuleResearch *> & possibilities) : _base(base)
{
_screen = false;
// Create objects
_window = new Window(this, 288, 180, 16, 10);
_btnOk = new TextButton(160, 14, 80, 149);
_btnResearch = new TextButton(160, 14, 80, 165);
_txtTitle = new Text(288, 40, 16, 20);
_lstPossibilities = new TextList(250, 96, 35, 50);
// Set palette
setInterface("geoResearch");
add(_window, "window", "geoResearch");
add(_btnOk, "button", "geoResearch");
add(_btnResearch, "button", "geoResearch");
add(_txtTitle, "text1", "geoResearch");
add(_lstPossibilities, "text2", "geoResearch");
centerAllSurfaces();
// Set up objects
_window->setBackground(_game->getMod()->getSurface("BACK05.SCR"));
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&NewPossibleResearchState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&NewPossibleResearchState::btnOkClick, Options::keyCancel);
_btnResearch->setText(tr("STR_ALLOCATE_RESEARCH"));
_btnResearch->onMouseClick((ActionHandler)&NewPossibleResearchState::btnResearchClick);
_btnResearch->onKeyboardPress((ActionHandler)&NewPossibleResearchState::btnResearchClick, Options::keyOk);
_txtTitle->setBig();
_txtTitle->setAlign(ALIGN_CENTER);
_lstPossibilities->setColumns(1, 250);
_lstPossibilities->setBig();
_lstPossibilities->setAlign(ALIGN_CENTER);
_lstPossibilities->setScrolling(true, 0);
size_t tally(0);
for (std::vector<RuleResearch *>::const_iterator iter = possibilities.begin(); iter != possibilities.end(); ++iter)
{
bool liveAlien = (*iter)->needItem() && _game->getMod()->getUnit((*iter)->getName()) != 0;
if (!_game->getSavedGame()->wasResearchPopped(*iter) && (*iter)->getRequirements().empty() && !liveAlien)
{
_game->getSavedGame()->addPoppedResearch((*iter));
_lstPossibilities->addRow (1, tr((*iter)->getName()).c_str());
}
else
{
tally++;
}
}
if (!(tally == possibilities.size() || possibilities.empty()))
{
_txtTitle->setText(tr("STR_WE_CAN_NOW_RESEARCH"));
}
}
开发者ID:vkandola,项目名称:OpenXcom,代码行数:65,代码来源:NewPossibleResearchState.cpp
示例7: Window
/**
* Initializes all the elements in the Promotions screen.
* @param game Pointer to the core game.
*/
PromotionsState::PromotionsState()
{
// Create objects
_window = new Window(this, 320, 200, 0, 0);
_btnOk = new TextButton(288, 16, 16, 176);
_txtTitle = new Text(300, 17, 10, 8);
_txtName = new Text(114, 9, 16, 32);
_txtRank = new Text(90, 9, 130, 32);
_txtBase = new Text(80, 9, 220, 32);
_lstSoldiers = new TextList(288, 128, 8, 40);
// Set palette
setInterface("promotions");
add(_window, "window", "promotions");
add(_btnOk, "button", "promotions");
add(_txtTitle, "heading", "promotions");
add(_txtName, "text", "promotions");
add(_txtRank, "text", "promotions");
add(_txtBase, "text", "promotions");
add(_lstSoldiers, "list", "promotions");
centerAllSurfaces();
// Set up objects
_window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&PromotionsState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&PromotionsState::btnOkClick, Options::keyOk);
_btnOk->onKeyboardPress((ActionHandler)&PromotionsState::btnOkClick, Options::keyCancel);
_txtTitle->setText(tr("STR_PROMOTIONS"));
_txtTitle->setAlign(ALIGN_CENTER);
_txtTitle->setBig();
_txtName->setText(tr("STR_NAME"));
_txtRank->setText(tr("STR_NEW_RANK"));
_txtBase->setText(tr("STR_BASE"));
_lstSoldiers->setColumns(3, 114, 90, 84);
_lstSoldiers->setSelectable(true);
_lstSoldiers->setBackground(_window);
_lstSoldiers->setMargin(8);
for (std::vector<Base*>::iterator i = _game->getSavedGame()->getBases()->begin(); i != _game->getSavedGame()->getBases()->end(); ++i)
{
for (std::vector<Soldier*>::iterator j = (*i)->getSoldiers()->begin(); j != (*i)->getSoldiers()->end(); ++j)
{
if ((*j)->isPromoted())
{
_lstSoldiers->addRow(3, (*j)->getName().c_str(), tr((*j)->getRankString()).c_str(), (*i)->getName().c_str());
}
}
}
}
开发者ID:AngledStream,项目名称:OpenXcom,代码行数:62,代码来源:PromotionsState.cpp
示例8: State
/**
* Initializes all the elements in the Confirm New Base window.
* @param game Pointer to the core game.
* @param base Pointer to the base to place.
* @param globe Pointer to the Geoscape globe.
*/
ConfirmNewBaseState::ConfirmNewBaseState(Game *game, Base *base, Globe *globe) : State(game), _base(base), _globe(globe), _cost(0)
{
_screen = false;
// Create objects
_window = new Window(this, 224, 72, 16, 64);
_btnOk = new TextButton(54, 12, 68, 104);
_btnCancel = new TextButton(54, 12, 138, 104);
_txtCost = new Text(120, 9, 68, 80);
_txtArea = new Text(120, 9, 68, 90);
// Set palette
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(0)), Palette::backPos, 16);
add(_window);
add(_btnOk);
add(_btnCancel);
add(_txtCost);
add(_txtArea);
centerAllSurfaces();
// Set up objects
_window->setColor(Palette::blockOffset(15)-1);
_window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
_btnOk->setColor(Palette::blockOffset(15)-1);
_btnOk->setText(_game->getLanguage()->getString("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&ConfirmNewBaseState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&ConfirmNewBaseState::btnOkClick, (SDLKey)Options::getInt("keyOk"));
_btnCancel->setColor(Palette::blockOffset(15)-1);
_btnCancel->setText(_game->getLanguage()->getString("STR_CANCEL_UC"));
_btnCancel->onMouseClick((ActionHandler)&ConfirmNewBaseState::btnCancelClick);
_btnCancel->onKeyboardPress((ActionHandler)&ConfirmNewBaseState::btnCancelClick, (SDLKey)Options::getInt("keyCancel"));
std::wstringstream ss;
for (std::vector<Region*>::iterator i = _game->getSavedGame()->getRegions()->begin(); i != _game->getSavedGame()->getRegions()->end(); ++i)
{
if ((*i)->getRules()->insideRegion(_base->getLongitude(), _base->getLatitude()))
{
_cost = (*i)->getRules()->getBaseCost();
ss << _game->getLanguage()->getString("STR_AREA_") << L'\x01' << _game->getLanguage()->getString((*i)->getRules()->getType());
break;
}
}
std::wstring s = _game->getLanguage()->getString("STR_COST_");
s.erase(s.size()-1, 1);
s += L'\x01' + Text::formatFunding(_cost);
_txtCost->setColor(Palette::blockOffset(15)-1);
_txtCost->setSecondaryColor(Palette::blockOffset(8)+10);
_txtCost->setText(s);
_txtArea->setColor(Palette::blockOffset(15)-1);
_txtArea->setSecondaryColor(Palette::blockOffset(8)+10);
_txtArea->setText(ss.str());
}
开发者ID:Arthur1994,项目名称:OpenXcom,代码行数:64,代码来源:ConfirmNewBaseState.cpp
示例9: OptionsBaseState
/**
* Initializes all the elements in the Controls screen.
* @param game Pointer to the core game.
* @param origin Game section that originated this state.
*/
OptionsControlsState::OptionsControlsState(Game *game, OptionsOrigin origin) : OptionsBaseState(game, origin), _selected(-1), _selKey(0)
{
setCategory(_btnControls);
// Create objects
_lstControls = new TextList(200, 136, 94, 8);
add(_lstControls);
centerAllSurfaces();
// Set up objects
_lstControls->setColor(Palette::blockOffset(8)+10);
_lstControls->setArrowColor(Palette::blockOffset(8)+5);
_lstControls->setColumns(2, 152, 48);
_lstControls->setSelectable(true);
_lstControls->setBackground(_window);
_lstControls->onMouseClick((ActionHandler)&OptionsControlsState::lstControlsClick, 0);
_lstControls->onKeyboardPress((ActionHandler)&OptionsControlsState::lstControlsKeyPress);
_lstControls->setFocus(true);
_lstControls->setTooltip("STR_CONTROLS_DESC");
_lstControls->onMouseIn((ActionHandler)&OptionsControlsState::txtTooltipIn);
_lstControls->onMouseOut((ActionHandler)&OptionsControlsState::txtTooltipOut);
if (origin != OPT_BATTLESCAPE)
{
_colorGroup = Palette::blockOffset(15) - 1;
_colorSel = Palette::blockOffset(8) + 5;
_colorNormal = Palette::blockOffset(8) + 10;
}
else
{
_colorGroup = Palette::blockOffset(1) - 1;
_colorSel = Palette::blockOffset(5) - 1;
_colorNormal = Palette::blockOffset(0) - 1;
}
const std::vector<OptionInfo> &options = Options::getOptionInfo();
for (std::vector<OptionInfo>::const_iterator i = options.begin(); i != options.end(); ++i)
{
if (!i->description().empty())
{
if (i->category() == "STR_GENERAL")
{
_controlsGeneral.push_back(*i);
}
else if (i->category() == "STR_GEOSCAPE")
{
_controlsGeo.push_back(*i);
}
else if (i->category() == "STR_BATTLESCAPE")
{
_controlsBattle.push_back(*i);
}
}
}
}
开发者ID:cfailde,项目名称:OpenXcom,代码行数:63,代码来源:OptionsControlsState.cpp
示例10: State
/**
* Initializes all the elements in the Base Defense screen.
* @param game Pointer to the core game.
* @param base Pointer to the base being attacked.
* @param ufo Pointer to the attacking ufo.
* @param state Pointer to the Geoscape.
*/
BaseDefenseState::BaseDefenseState(Game *game, Base *base, Ufo *ufo, GeoscapeState *state) : State(game), _state(state)
{
_base = base;
_action = BDA_NONE;
_row = -1;
_passes = 0;
_attacks = 0;
_thinkcycles = 0;
_ufo = ufo;
// Create objects
_window = new Window(this, 320, 200, 0, 0);
_txtTitle = new Text(300, 16, 16, 6);
_txtInit = new Text(300, 10, 16, 24);
_lstDefenses = new TextList(300, 130, 16, 40);
_btnOk = new TextButton(120, 18, 100, 170);
// Set palette
_game->setPalette(_game->getResourcePack()->getPalette("PALETTES.DAT_1")->getColors());
_game->setPalette(_game->getResourcePack()->getPalette("PALETTES.DAT_1")->getColors(Palette::blockOffset(14)), Palette::backPos, 16);
add(_window);
add(_btnOk);
add(_txtTitle);
add(_txtInit);
add(_lstDefenses);
centerAllSurfaces();
// Set up objects
_window->setColor(Palette::blockOffset(15)+6);
_window->setBackground(_game->getResourcePack()->getSurface("BACK04.SCR"));
_btnOk->setColor(Palette::blockOffset(13)+10);
_btnOk->setText(_game->getLanguage()->getString("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&BaseDefenseState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&BaseDefenseState::btnOkClick, (SDLKey)Options::getInt("keyOk"));
_btnOk->onKeyboardPress((ActionHandler)&BaseDefenseState::btnOkClick, (SDLKey)Options::getInt("keyCancel"));
_btnOk->setVisible(false);
_txtTitle->setColor(Palette::blockOffset(13)+10);
_txtTitle->setBig();
std::wstringstream ss;
ss << _base->getName() << _game->getLanguage()->getString("STR_UNDER_ATTACK");
_txtTitle->setText(ss.str());
_txtInit->setVisible(false);
_txtInit->setColor(Palette::blockOffset(13)+10);
_txtInit->setText(_game->getLanguage()->getString("STR_BASE_DEFENSES_INITIATED"));
_lstDefenses->setColor(Palette::blockOffset(13)+10);
_lstDefenses->setColumns(3, 134, 70, 50);
_gravShields = _base->getGravShields();
_defenses = _base->getDefenses()->size();
_timer = new Timer(750);
_timer->onTimer((StateHandler)&BaseDefenseState::nextStep);
_timer->start();
}
开发者ID:Arthur1994,项目名称:OpenXcom,代码行数:64,代码来源:BaseDefenseState.cpp
示例11: _parent
/**
* Initializes all the elements in the Load Craft Loadout window.
*/
CraftEquipmentLoadState::CraftEquipmentLoadState(CraftEquipmentState *parent) : _parent(parent)
{
_screen = false;
// Create objects
_window = new Window(this, 240, 136, 40, 36+1, POPUP_BOTH);
_txtTitle = new Text(230, 16, 45, 44+3);
_lstLoadout = new TextList(208, 80, 48, 60);
_btnCancel = new TextButton(120, 16, 90, 148);
// Set palette
setInterface("craftEquipmentLoad");
add(_window, "window", "craftEquipmentLoad");
add(_txtTitle, "text", "craftEquipmentLoad");
add(_lstLoadout, "list", "craftEquipmentLoad");
add(_btnCancel, "button", "craftEquipmentLoad");
centerAllSurfaces();
// Set up objects
_window->setBackground(_game->getMod()->getSurface("BACK04.SCR"));
_txtTitle->setAlign(ALIGN_CENTER);
_txtTitle->setText(tr("STR_LOAD_CRAFT_LOADOUT_TEMPLATE"));
_lstLoadout->setColumns(1, 192);
_lstLoadout->setSelectable(true);
_lstLoadout->setBackground(_window);
_lstLoadout->setMargin(8);
_lstLoadout->onMouseClick((ActionHandler)&CraftEquipmentLoadState::lstLoadoutClick);
_btnCancel->setText(tr("STR_CANCEL_UC"));
_btnCancel->onMouseClick((ActionHandler)&CraftEquipmentLoadState::btnCancelClick);
_btnCancel->onKeyboardPress((ActionHandler)&CraftEquipmentLoadState::btnCancelClick, Options::keyCancel);
for (int i = 0; i < SavedGame::MAX_CRAFT_LOADOUT_TEMPLATES; ++i)
{
ItemContainer *item = _game->getSavedGame()->getGlobalCraftLoadout(i);
if (item->getContents()->empty())
{
_lstLoadout->addRow(1, tr("STR_EMPTY_SLOT_N").arg(i + 1).c_str());
}
else
{
const std::wstring &itemName = _game->getSavedGame()->getGlobalCraftLoadoutName(i);
if (itemName.empty())
{
_lstLoadout->addRow(1, tr("STR_UNNAMED_SLOT_N").arg(i + 1).c_str());
}
else
{
_lstLoadout->addRow(1, itemName.c_str());
}
}
}
}
开发者ID:Darineth,项目名称:OpenXcom,代码行数:60,代码来源:CraftEquipmentLoadState.cpp
示例12: _base
/**
* Initializes all the elements in the Transfers window.
* @param game Pointer to the core game.
* @param base Pointer to the base to get info from.
*/
TransfersState::TransfersState(Base *base) : _base(base)
{
_screen = false;
// Create objects
_window = new Window(this, 320, 184, 0, 8, POPUP_BOTH);
_btnOk = new TextButton(288, 16, 16, 166);
_txtTitle = new Text(278, 17, 21, 18);
_txtItem = new Text(114, 9, 16, 34);
_txtQuantity = new Text(54, 9, 152, 34);
_txtArrivalTime = new Text(112, 9, 212, 34);
_lstTransfers = new TextList(273, 112, 14, 50);
// Set palette
setInterface("transferInfo");
add(_window, "window", "transferInfo");
add(_btnOk, "button", "transferInfo");
add(_txtTitle, "text", "transferInfo");
add(_txtItem, "text", "transferInfo");
add(_txtQuantity, "text", "transferInfo");
add(_txtArrivalTime, "text", "transferInfo");
add(_lstTransfers, "list", "transferInfo");
centerAllSurfaces();
// Set up objects
_window->setBackground(_game->getResourcePack()->getSurface("BACK13.SCR"));
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&TransfersState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&TransfersState::btnOkClick, Options::keyOk);
_btnOk->onKeyboardPress((ActionHandler)&TransfersState::btnOkClick, Options::keyCancel);
_txtTitle->setBig();
_txtTitle->setAlign(ALIGN_CENTER);
_txtTitle->setText(tr("STR_TRANSFERS"));
_txtItem->setText(tr("STR_ITEM"));
_txtQuantity->setText(tr("STR_QUANTITY_UC"));
_txtArrivalTime->setText(tr("STR_ARRIVAL_TIME_HOURS"));
_lstTransfers->setColumns(3, 155, 75, 46);
_lstTransfers->setSelectable(true);
_lstTransfers->setBackground(_window);
_lstTransfers->setMargin(2);
for (std::vector<Transfer*>::iterator i = _base->getTransfers()->begin(); i != _base->getTransfers()->end(); ++i)
{
std::wostringstream ss, ss2;
ss << (*i)->getQuantity();
ss2 << (*i)->getHours();
_lstTransfers->addRow(3, (*i)->getName(_game->getLanguage()).c_str(), ss.str().c_str(), ss2.str().c_str());
}
}
开发者ID:vazub,项目名称:OpenXcom,代码行数:62,代码来源:TransfersState.cpp
示例13: State
/**
* Initializes all the elements in a Production Complete window.
* @param game Pointer to the core game.
* @param item Item that finished producing.
* @param base Base the item belongs to.
* @param endType What ended the production.
*/
ProductionCompleteState::ProductionCompleteState(Game *game, const std::wstring &item, const std::wstring &base, productionProgress_e endType) : State(game)
{
_screen = false;
// Create objects
_window = new Window(this, 256, 160, 32, 20, POPUP_BOTH);
_btnOk = new TextButton(120, 18, 100, 154);
_txtMessage = new Text(246, 110, 37, 35);
// Set palette
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(6)), Palette::backPos, 16);
add(_window);
add(_btnOk);
add(_txtMessage);
centerAllSurfaces();
// Set up objects
_window->setColor(Palette::blockOffset(15)-1);
_window->setBackground(_game->getResourcePack()->getSurface("BACK17.SCR"));
_btnOk->setColor(Palette::blockOffset(8)+5);
_btnOk->setText(_game->getLanguage()->getString("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&ProductionCompleteState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&ProductionCompleteState::btnOkClick, (SDLKey)Options::getInt("keyOk"));
_btnOk->onKeyboardPress((ActionHandler)&ProductionCompleteState::btnOkClick, (SDLKey)Options::getInt("keyCancel"));
_txtMessage->setColor(Palette::blockOffset(15)-1);
_txtMessage->setAlign(ALIGN_CENTER);
_txtMessage->setVerticalAlign(ALIGN_MIDDLE);
_txtMessage->setBig();
_txtMessage->setWordWrap(true);
std::wstring s;
switch(endType)
{
case PROGRESS_COMPLETE:
s = _game->getLanguage()->getString("STR_PRODUCTION_OF");
break;
case PROGRESS_NOT_ENOUGH_MONEY:
s = _game->getLanguage()->getString("STR_NOT_ENOUGH_MONEY_TO_PRODUCE");
break;
case PROGRESS_NOT_ENOUGH_MATERIALS:
s = _game->getLanguage()->getString("STR_NOT_ENOUGH_SPECIAL_MATERIALS_TO_PRODUCE");
break;
default:
assert(false);
}
s += item;
s += _game->getLanguage()->getString("STR__AT__");
s += base;
if(endType == PROGRESS_COMPLETE)
{
s += _game->getLanguage()->getString("STR_IS_COMPLETE");
}
_txtMessage->setText(s);
}
开发者ID:Arthur1994,项目名称:OpenXcom,代码行数:64,代码来源:ProductionCompleteState.cpp
示例14: State
/**
* Initializes all the elements in the Confirm Destination window.
* @param game Pointer to the core game.
* @param craft Pointer to the craft to retarget.
* @param target Pointer to the selected target (NULL if it's just a point on the globe).
*/
ConfirmDestinationState::ConfirmDestinationState(Game *game, Craft *craft, Target *target) : State(game), _craft(craft), _target(target)
{
Waypoint *w = dynamic_cast<Waypoint*>(_target);
_screen = false;
// Create objects
_window = new Window(this, 224, 72, 16, 64);
_btnOk = new TextButton(50, 12, 68, 104);
_btnCancel = new TextButton(50, 12, 138, 104);
_txtTarget = new Text(212, 32, 22, 72);
// Set palette
if (w != 0 && w->getId() == 0)
{
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(6)), Palette::backPos, 16);
}
else
{
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(4)), Palette::backPos, 16);
}
add(_window);
add(_btnOk);
add(_btnCancel);
add(_txtTarget);
centerAllSurfaces();
// Set up objects
_window->setColor(Palette::blockOffset(15)-1);
_window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR"));
_btnOk->setColor(Palette::blockOffset(8)+5);
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&ConfirmDestinationState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&ConfirmDestinationState::btnOkClick, Options::keyOk);
_btnCancel->setColor(Palette::blockOffset(8)+5);
_btnCancel->setText(tr("STR_CANCEL_UC"));
_btnCancel->onMouseClick((ActionHandler)&ConfirmDestinationState::btnCancelClick);
_btnCancel->onKeyboardPress((ActionHandler)&ConfirmDestinationState::btnCancelClick, Options::keyCancel);
_txtTarget->setColor(Palette::blockOffset(15)-1);
_txtTarget->setBig();
_txtTarget->setAlign(ALIGN_CENTER);
_txtTarget->setVerticalAlign(ALIGN_MIDDLE);
_txtTarget->setWordWrap(true);
if (w != 0 && w->getId() == 0)
{
_txtTarget->setText(tr("STR_TARGET").arg(tr("STR_WAY_POINT")));
}
else
{
_txtTarget->setText(tr("STR_TARGET").arg(_target->getName(_game->getLanguage())));
}
}
开发者ID:cfailde,项目名称:OpenXcom,代码行数:62,代码来源:ConfirmDestinationState.cpp
示例15: State
/**
* Initializes all the elements in the MiniMapState screen.
* @param game Pointer to the core game.
* @param camera The Battlescape camera.
* @param battleGame The Battlescape save.
*/
MiniMapState::MiniMapState (Game * game, Camera * camera, SavedBattleGame * battleGame) : State(game)
{
if (Options::maximizeInfoScreens)
{
Options::baseXResolution = Screen::ORIGINAL_WIDTH;
Options::baseYResolution = Screen::ORIGINAL_HEIGHT;
_game->getScreen()->resetDisplay(false);
}
_bg = new Surface(320, 200);
_miniMapView = new MiniMapView(221, 148, 48, 16, game, camera, battleGame);
_btnLvlUp = new InteractiveSurface(18, 20, 24, 62);
_btnLvlDwn = new InteractiveSurface(18, 20, 24, 88);
_btnOk = new InteractiveSurface(32, 32, 275, 145);
_txtLevel = new Text(20, 25, 281, 75);
// Set palette
setPalette("PAL_BATTLESCAPE");
add(_bg);
add(_miniMapView);
add(_btnLvlUp);
add(_btnLvlDwn);
add(_btnOk);
add(_txtLevel);
centerAllSurfaces();
if (_game->getScreen()->getDY() > 50)
{
_screen = false;
SDL_Rect current;
current.w = 223;
current.h = 151;
current.x = 46;
current.y = 14;
_bg->drawRect(¤t, Palette::blockOffset(15)+15);
}
_game->getResourcePack()->getSurface("SCANBORD.PCK")->blit(_bg);
_btnLvlUp->onMouseClick((ActionHandler)&MiniMapState::btnLevelUpClick);
_btnLvlDwn->onMouseClick((ActionHandler)&MiniMapState::btnLevelDownClick);
_btnOk->onMouseClick((ActionHandler)&MiniMapState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&MiniMapState::btnOkClick, Options::keyCancel);
_btnOk->onKeyboardPress((ActionHandler)&MiniMapState::btnOkClick, Options::keyBattleMap);
_txtLevel->setBig();
_txtLevel->setColor(Palette::blockOffset(4));
_txtLevel->setHighContrast(true);
std::wostringstream s;
s << camera->getViewLevel();
_txtLevel->setText(s.str());
_timerAnimate = new Timer(125);
_timerAnimate->onTimer((StateHandler)&MiniMapState::animate);
_timerAnimate->start();
_miniMapView->draw();
}
开发者ID:fibercube,项目名称:OpenXcom,代码行数:62,代码来源:MiniMapState.cpp
示例16: State
/**
* Initializes all the elements in the Geoscape Options window.
* @param game Pointer to the core game.
*/
GeoscapeOptionsState::GeoscapeOptionsState(Game *game) : State(game)
{
_screen = false;
// Create objects
_window = new Window(this, 216, 160, 20, 20, POPUP_BOTH);
_btnLoad = new TextButton(180, 20, 38, 60);
_btnSave = new TextButton(180, 20, 38, 85);
_btnAbandon = new TextButton(180, 20, 38, 110);
_btnCancel = new TextButton(180, 20, 38, 140);
_txtTitle = new Text(206, 15, 25, 32);
// Set palette
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(0)), Palette::backPos, 16);
add(_window);
add(_btnLoad);
add(_btnSave);
add(_btnAbandon);
add(_btnCancel);
add(_txtTitle);
centerAllSurfaces();
// Set up objects
_window->setColor(Palette::blockOffset(15)-1);
_window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
_btnLoad->setColor(Palette::blockOffset(15)-1);
_btnLoad->setText(tr("STR_LOAD_GAME"));
_btnLoad->onMouseClick((ActionHandler)&GeoscapeOptionsState::btnLoadClick);
_btnSave->setColor(Palette::blockOffset(15)-1);
_btnSave->setText(tr("STR_SAVE_GAME"));
_btnSave->onMouseClick((ActionHandler)&GeoscapeOptionsState::btnSaveClick);
_btnAbandon->setColor(Palette::blockOffset(15)-1);
_btnAbandon->setText(tr("STR_ABANDON_GAME"));
_btnAbandon->onMouseClick((ActionHandler)&GeoscapeOptionsState::btnAbandonClick);
_btnCancel->setColor(Palette::blockOffset(15)-1);
_btnCancel->setText(tr("STR_CANCEL_UC"));
_btnCancel->onMouseClick((ActionHandler)&GeoscapeOptionsState::btnCancelClick);
_btnCancel->onKeyboardPress((ActionHandler)&GeoscapeOptionsState::btnCancelClick, (SDLKey)Options::getInt("keyCancel"));
_txtTitle->setColor(Palette::blockOffset(15)-1);
_txtTitle->setAlign(ALIGN_CENTER);
_txtTitle->setBig();
_txtTitle->setText(tr("STR_GAME_OPTIONS"));
if (Options::getInt("autosave") >= 2)
{
_btnSave->setVisible(false);
_btnLoad->setVisible(false);
}
}
开发者ID:2xG,项目名称:OpenXcom,代码行数:60,代码来源:GeoscapeOptionsState.cpp
示例17: Window
/**
* Initializes all the elements in the Cannot Reequip screen.
* @param game Pointer to the core game.
* @param missingItems List of items still needed for reequip.
*/
CannotReequipState::CannotReequipState(std::vector<ReequipStat> missingItems)
{
// Create objects
_window = new Window(this, 320, 200, 0, 0);
_btnOk = new TextButton(120, 18, 100, 174);
_txtTitle = new Text(220, 32, 50, 8);
_txtItem = new Text(142, 9, 10, 50);
_txtQuantity = new Text(88, 9, 152, 50);
_txtCraft = new Text(74, 9, 218, 50);
_lstItems = new TextList(288, 112, 8, 58);
// Set palette
setInterface("cannotReequip");
add(_window, "window", "cannotReequip");
add(_btnOk, "button", "cannotReequip");
add(_txtTitle, "heading", "cannotReequip");
add(_txtItem, "text", "cannotReequip");
add(_txtQuantity, "text", "cannotReequip");
add(_txtCraft, "text", "cannotReequip");
add(_lstItems, "list", "cannotReequip");
centerAllSurfaces();
// Set up objects
_window->setBackground(_game->getMod()->getSurface("BACK01.SCR"));
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&CannotReequipState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&CannotReequipState::btnOkClick, Options::keyOk);
_btnOk->onKeyboardPress((ActionHandler)&CannotReequipState::btnOkClick, Options::keyCancel);
_txtTitle->setText(tr("STR_NOT_ENOUGH_EQUIPMENT_TO_FULLY_RE_EQUIP_SQUAD"));
_txtTitle->setAlign(ALIGN_CENTER);
_txtTitle->setBig();
_txtTitle->setWordWrap(true);
_txtItem->setText(tr("STR_ITEM"));
_txtQuantity->setText(tr("STR_QUANTITY_UC"));
_txtCraft->setText(tr("STR_CRAFT"));
_lstItems->setColumns(3, 162, 46, 80);
_lstItems->setSelectable(true);
_lstItems->setBackground(_window);
_lstItems->setMargin(2);
for (std::vector<ReequipStat>::iterator i = missingItems.begin(); i != missingItems.end(); ++i)
{
std::wostringstream ss;
ss << i->qty;
_lstItems->addRow(3, tr(i->item).c_str(), ss.str().c_str(), i->craft.c_str());
}
}
开发者ID:0x90sled,项目名称:OpenXcom,代码行数:60,代码来源:CannotReequipState.cpp
示例18: State
/**
* Initializes all the elements in the productions list screen.
* @param game Pointer to the core game.
* @param base Pointer to the base to get info from.
*/
NewManufactureListState::NewManufactureListState(Game *game, Base *base) : State(game), _base(base)
{
int width = 320;
int height = 140;
int max_width = 320;
int max_height = 200;
int start_x = (max_width - width) / 2;
int start_y = (max_height - height) / 2;
int button_x_border = 8;
int button_y_border = 8;
int button_height = 16;
_screen = false;
_window = new Window(this, width, height, start_x, start_y, POPUP_BOTH);
_btnOk = new TextButton (width - 2 * button_x_border, button_height, start_x + button_x_border, start_y + height - button_height - button_y_border);
_txtTitle = new Text (width - 2 * button_x_border, button_height, start_x + button_x_border + 2, start_y + button_y_border);
_txtItem = new Text (10 * button_x_border, button_height / 2, start_x + button_x_border + 2, start_y + 3 * button_y_border);
_txtCategory = new Text (10 * button_x_border, button_height / 2, start_x + 20.75f * button_x_border, start_y + 3 * button_y_border);
_lstManufacture = new TextList(width - 4 * button_x_border, height - 3.75f * button_height - 2 * button_y_border, start_x + button_x_border, start_y + 5 * button_y_border);
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(6)), Palette::backPos, 16);
add(_window);
add(_btnOk);
add(_txtTitle);
add(_txtItem);
add(_txtCategory);
add(_lstManufacture);
centerAllSurfaces();
_window->setColor(Palette::blockOffset(15)+1);
_window->setBackground(_game->getResourcePack()->getSurface("BACK17.SCR"));
_txtTitle->setColor(Palette::blockOffset(15)+1);
_txtTitle->setText(tr("STR_PRODUCTION_ITEMS"));
_txtTitle->setBig();
_txtTitle->setAlign(ALIGN_CENTER);
_txtItem->setColor(Palette::blockOffset(15)+1);
_txtItem->setText(tr("STR_ITEM"));
_txtCategory->setColor(Palette::blockOffset(15)+1);
_txtCategory->setText(tr("STR_CATEGORY"));
_lstManufacture->setColumns(2, int(19.5f * button_x_border), int(16.25f * button_x_border));
_lstManufacture->setSelectable(true);
_lstManufacture->setBackground(_window);
_lstManufacture->setMargin(2);
_lstManufacture->setColor(Palette::blockOffset(13));
_lstManufacture->setArrowColor(Palette::blockOffset(15)+1);
_lstManufacture->onMouseClick((ActionHandler)&NewManufactureListState::lstProdClick);
_btnOk->setColor(Palette::blockOffset(13)+10);
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&NewManufactureListState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&NewManufactureListState::btnOkClick, Options::keyCancel);
}
开发者ID:cfailde,项目名称:OpenXcom,代码行数:60,代码来源:NewManufactureListState.cpp
示例19: ArticleState
ArticleStateTFTD::ArticleStateTFTD(ArticleDefinitionTFTD *defs) : ArticleState(defs->id)
{
// Set palette
setPalette("PAL_BASESCAPE");
_btnOk->setX(227);
_btnOk->setY(179);
_btnOk->setHeight(10);
_btnOk->setWidth(23);
_btnOk->setColor(Palette::blockOffset(0)+2);
_btnPrev->setX(254);
_btnPrev->setY(179);
_btnPrev->setHeight(10);
_btnPrev->setWidth(23);
_btnPrev->setColor(Palette:
|
请发表评论