本文整理汇总了C++中gui::Fixed::SetBgColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Fixed::SetBgColor方法的具体用法?C++ Fixed::SetBgColor怎么用?C++ Fixed::SetBgColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui::Fixed
的用法示例。
在下文中一共展示了Fixed::SetBgColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowBadError
void Screen::ShowBadError(const char *msg)
{
// to make things simple for ourselves, we want to hide all the existing widgets
// however, if we do it through baseContainer->HideChildren() then we lose track of
// which widgets should be shown again when the red-screen is cleared.
// So to avoid this problem we don't hide anything, we just temporarily swap to
// a different base container which is just used for this red-screen
Gui::Fixed *oldBaseContainer = Screen::baseContainer;
Screen::baseContainer = new Gui::Fixed();
Screen::baseContainer->SetSize(float(Screen::width), float(Screen::height));
Screen::baseContainer->Show();
Gui::Fixed *f = new Gui::Fixed(6*GetWidth()/8.0f, 6*GetHeight()/8.0f);
Gui::Screen::AddBaseWidget(f, GetWidth()/8, GetHeight()/8);
f->SetTransparency(false);
f->SetBgColor(0.4f,0,0,1.0f);
f->Add(new Gui::Label(msg, TextLayout::ColourMarkupNone), 10, 10);
Gui::Button *okButton = new Gui::LabelButton(new Gui::Label("Ok"));
okButton->SetShortcut(SDLK_RETURN, KMOD_NONE);
f->Add(okButton, 10.0f, 6*GetHeight()/8.0f - 32);
f->ShowAll();
f->Show();
do {
Gui::MainLoopIteration();
SDL_Delay(10);
} while (!okButton->IsPressed());
delete f; // Gui::Fixed does a horrible thing and calls Gui::Screen::RemoveBaseWidget(this) in its destructor
delete Screen::baseContainer;
Screen::baseContainer = oldBaseContainer;
}
示例2: ShowBadError
void Screen::ShowBadError(const char *msg)
{
fprintf(stderr, "%s", msg);
baseContainer->HideChildren();
Gui::Fixed *f = new Gui::Fixed(6*GetWidth()/8, 6*GetHeight()/8);
Gui::Screen::AddBaseWidget(f, GetWidth()/8, GetHeight()/8);
f->SetTransparency(false);
f->SetBgColor(0.4,0,0,1.0);
f->Add(new Gui::Label(msg), 10, 10);
Gui::Button *okButton = new Gui::LabelButton(new Gui::Label("Ok"));
okButton->SetShortcut(SDLK_RETURN, KMOD_NONE);
f->Add(okButton, 10, 6*GetHeight()/8 - 32);
f->ShowAll();
f->Show();
do {
Gui::MainLoopIteration();
SDL_Delay(10);
} while (!okButton->IsPressed());
Gui::Screen::RemoveBaseWidget(f);
delete f;
baseContainer->ShowAll();
}
示例3: DialogMainLoop
void GameLoaderSaver::DialogMainLoop()
{
Gui::Fixed *background = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()));
background->SetTransparency(false);
background->SetBgColor(0,0,0,1.0);
Gui::Fixed *outer = new Gui::Fixed(410, 410);
outer->SetTransparency(false);
background->Add(outer, 195, 45);
Gui::Fixed *inner = new Gui::Fixed(400, 400);
outer->Add(inner, 5, 5);
FileSelectorWidget *fileSelector = new FileSelectorWidget(m_type, m_title);
inner->Add(fileSelector, 0, 0);
fileSelector->onClickAction.connect(sigc::mem_fun(this, &GameLoaderSaver::OnClickLoad));
fileSelector->onClickCancel.connect(sigc::mem_fun(this, &GameLoaderSaver::OnClickBack));
Gui::Screen::AddBaseWidget(background, 0, 0);
background->ShowAll();
m_done = false;
while (!m_done)
Gui::MainLoopIteration();
Gui::Screen::RemoveBaseWidget(background);
delete background;
}