本文整理汇总了C++中TextButton::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TextButton::setColor方法的具体用法?C++ TextButton::setColor怎么用?C++ TextButton::setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextButton
的用法示例。
在下文中一共展示了TextButton::setColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Window
/**
* Initializes all the elements in the Psi Training screen.
* @param game Pointer to the core game.
*/
PsiTrainingState::PsiTrainingState()
{
// Create objects
_window = new Window(this, 320, 200, 0, 0);
_txtTitle = new Text(300, 17, 10, 16);
_btnOk = new TextButton(160, 14, 80, 174);
// Set palette
setPalette("PAL_BASESCAPE", 7);
add(_window);
add(_btnOk);
add(_txtTitle);
// Set up objects
_window->setColor(Palette::blockOffset(15)+6);
_window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
_btnOk->setColor(Palette::blockOffset(13)+10);
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&PsiTrainingState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&PsiTrainingState::btnOkClick, Options::keyCancel);
_txtTitle->setColor(Palette::blockOffset(13)+10);
_txtTitle->setBig();
_txtTitle->setAlign(ALIGN_CENTER);
_txtTitle->setText(tr("STR_PSIONIC_TRAINING"));
int buttons = 0;
for(std::vector<Base*>::const_iterator b = _game->getSavedGame()->getBases()->begin(); b != _game->getSavedGame()->getBases()->end(); ++b)
{
if((*b)->getAvailablePsiLabs())
{
TextButton *btnBase = new TextButton(160, 14, 80, 40 + 16 * buttons);
btnBase->setColor(Palette::blockOffset(15) + 6);
btnBase->onMouseClick((ActionHandler)&PsiTrainingState::btnBaseXClick);
btnBase->setText((*b)->getName());
add(btnBase);
_bases.push_back(*b);
_btnBases.push_back(btnBase);
++buttons;
if (buttons >= 8)
{
break;
}
}
}
centerAllSurfaces();
}
示例2: applyBattlescapeTheme
/**
* switch all the colours to something a little more battlescape appropriate.
*/
void State::applyBattlescapeTheme()
{
for (std::vector<Surface*>::iterator i = _surfaces.begin(); i != _surfaces.end(); ++i)
{
Window* window = dynamic_cast<Window*>(*i);
if (window)
{
window->setColor(Palette::blockOffset(0)-1);
window->setHighContrast(true);
window->setBackground(_game->getResourcePack()->getSurface("TAC00.SCR"));
}
Text* text = dynamic_cast<Text*>(*i);
if (text)
{
text->setColor(Palette::blockOffset(0)-1);
text->setHighContrast(true);
}
TextButton* button = dynamic_cast<TextButton*>(*i);
if (button)
{
button->setColor(Palette::blockOffset(0)-1);
button->setHighContrast(true);
}
TextEdit* edit = dynamic_cast<TextEdit*>(*i);
if (edit)
{
edit->setColor(Palette::blockOffset(0)-1);
edit->setHighContrast(true);
}
TextList* list = dynamic_cast<TextList*>(*i);
if (list)
{
list->setColor(Palette::blockOffset(0)-1);
list->setArrowColor(Palette::blockOffset(0));
list->setHighContrast(true);
}
ArrowButton *arrow = dynamic_cast<ArrowButton*>(*i);
if (arrow)
{
arrow->setColor(Palette::blockOffset(0));
}
Slider *slider = dynamic_cast<Slider*>(*i);
if (slider)
{
slider->setColor(Palette::blockOffset(0)-1);
slider->setHighContrast(true);
}
}
}
示例3: State
/**
* Initializes all the elements in the Multiple Targets window.
* @param game Pointer to the core game.
* @param targets List of targets to display.
* @param craft Pointer to craft to retarget (NULL if none).
* @param state Pointer to the Geoscape state.
*/
MultipleTargetsState::MultipleTargetsState(Game *game, std::vector<Target*> targets, Craft *craft, GeoscapeState *state) : State(game), _targets(targets), _craft(craft), _state(state)
{
_screen = false;
if (_targets.size() > 1)
{
int winHeight = BUTTON_HEIGHT * _targets.size() + SPACING * (_targets.size() - 1) + MARGIN * 2;
int winY = (200 - winHeight) / 2;
int btnY = winY + MARGIN;
// Create objects
_window = new Window(this, 136, winHeight, 60, winY, POPUP_VERTICAL);
// Set palette
setPalette("PAL_GEOSCAPE", 7);
add(_window);
// Set up objects
_window->setColor(Palette::blockOffset(8) + 5);
_window->setBackground(_game->getResourcePack()->getSurface("BACK15.SCR"));
int y = btnY;
for (size_t i = 0; i < _targets.size(); ++i)
{
TextButton *button = new TextButton(116, BUTTON_HEIGHT, 70, y);
button->setColor(Palette::blockOffset(8) + 5);
button->setText(_targets[i]->getName(_game->getLanguage()));
button->onMouseClick((ActionHandler)&MultipleTargetsState::btnTargetClick);
add(button);
_btnTargets.push_back(button);
y += button->getHeight() + SPACING;
}
_btnTargets[0]->onKeyboardPress((ActionHandler)&MultipleTargetsState::btnCancelClick, Options::keyCancel);
centerAllSurfaces();
}
}