本文整理汇总了C++中gui::Fixed::Show方法的典型用法代码示例。如果您正苦于以下问题:C++ Fixed::Show方法的具体用法?C++ Fixed::Show怎么用?C++ Fixed::Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui::Fixed
的用法示例。
在下文中一共展示了Fixed::Show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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;
}