本文整理汇总了C++中DrawingContext::print_center方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawingContext::print_center方法的具体用法?C++ DrawingContext::print_center怎么用?C++ DrawingContext::print_center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawingContext
的用法示例。
在下文中一共展示了DrawingContext::print_center方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
LevelDot::draw_hover(DrawingContext& gc)
{
if (accessible())
{
gc.print_center(Fonts::pingus_small,
Vector2i(static_cast<int>(pos.x),
static_cast<int>(pos.y) - 44),
_(get_plf().get_levelname()),
10000);
}
else
{
gc.print_center(Fonts::pingus_small,
Vector2i(static_cast<int>(pos.x),
static_cast<int>(pos.y) - 44),
_("???"),
10000);
}
if (globals::developer_mode)
{
gc.print_center(Fonts::pingus_small,
Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y) - 70),
get_plf().get_resname(),
10000);
}
}
示例2: Copyright
void
PingusMenu::draw_background(DrawingContext& gc)
{
background->draw(gc);
gc.draw(logo, Vector2i((gc.get_width()/2) - (logo.get_width()/2),
gc.get_height()/2 - 280));
gc.print_left(Fonts::pingus_small, Vector2i(gc.get_width()/2 - 400 + 25, gc.get_height()-140),
"Pingus " VERSION " - Copyright (C) 1998-2011 Ingo Ruhnke <[email protected]>\n"
"See the file AUTHORS for a complete list of contributors.\n"
"Pingus comes with ABSOLUTELY NO WARRANTY. This is free software, and you are\n"
"welcome to redistribute it under certain conditions; see the file COPYING for details.\n");
gc.draw_fillrect(Rect(0,
Display::get_height () - 26,
Display::get_width (),
Display::get_height ()),
Color(0, 0, 0, 255));
gc.print_center(Fonts::pingus_small,
Vector2i(gc.get_width() / 2,
gc.get_height() - Fonts::pingus_small.get_height() - 8),
help);
if (0) // display hint
{
gc.print_center(Fonts::pingus_small,
Vector2i(gc.get_width() / 2,
gc.get_height() - Fonts::pingus_small.get_height()),
hint);
}
}
示例3: Rect
void
MessageBox::draw_background(DrawingContext& gc)
{
// Window border and title
GUIStyle::draw_raised_box(gc, Rect(0,0,rect.get_width(), rect.get_height()));
gc.draw_fillrect(Rect(4,4,rect.get_width()-4, 30), Color(77,130,180));
gc.print_center(Fonts::pingus_small, Vector2i(rect.get_width()/2, 2),
m_title);
// main text
gc.print_center(Fonts::verdana11, Vector2i(rect.get_width()/2, 42),
m_text);
}
示例4:
void
OptionMenu::draw_background(DrawingContext& gc)
{
gc.fill_screen(Color(0, 0, 0));
// gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0));
gc.draw(background, Vector2i(gc.get_width()/2 - background.get_width()/2, gc.get_height()/2 - background.get_height()/2));
gc.print_center(Fonts::chalk_large,
Vector2i(gc.get_width()/2,
gc.get_height()/2 - 210),
_("Option Menu"));
gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2 + 225 + 30, gc.get_height()/2 + 125 - 20), _("Close"));
}
示例5:
void
MenuButton::draw (DrawingContext& gc)
{
if (mouse_over) // pressed
{
gc.draw(surface_p,Vector2i(x_pos, y_pos));
gc.draw(highlight, Vector2i(x_pos, y_pos));
gc.print_center(font_large, x_pos, y_pos - 28, text);
}
else
{
gc.draw(surface_p, Vector2i(x_pos, y_pos));
gc.print_center(font_large, x_pos, y_pos - 28, text);
}
}
示例6: Color
void
SliderBox::draw(DrawingContext& gc)
{
if (globals::developer_mode)
gc.draw_rect(rect, Color(0, 255, 255));
if (value == 0)
{
gc.print_center(Fonts::chalk_normal, Vector2i(rect.left + rect.get_width()/2, rect.top), "off");
}
else
{
for(int i = 0; i < m_steps; ++i)
{
if (i < value)
gc.print_left(Fonts::chalk_normal, Vector2i(rect.left + i*(rect.get_width()-12)/m_steps + 6, rect.top), "|");
//gc.print_left(Fonts::chalk_normal, rect.left + i*(rect.get_width()-12)/20 + 6, rect.top, "l");
}
}
gc.print_left(Fonts::chalk_normal, Vector2i(rect.left, rect.top),
"[");
gc.print_right(Fonts::chalk_normal, Vector2i(rect.right, rect.top),
"]");
}
示例7:
void
StartScreenComponent::draw(DrawingContext& gc)
{
// Paint the background wood panel
for(int y = 0; y < gc.get_height(); y += background.get_height())
for(int x = 0; x < gc.get_width(); x += background.get_width())
gc.draw(background, Vector2i(x, y));
gc.draw(blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2));
int left_x = gc.get_width()/2 - 150;
int right_x = gc.get_width()/2 + 150;
int y = gc.get_height()/2 + 40;
gc.print_center(Fonts::chalk_large,
Vector2i(gc.get_width() /2,
gc.get_height()/2 - 230),
_(plf.get_levelname()));
gc.print_left(Fonts::chalk_normal,
Vector2i(gc.get_width() /2 - 300,
gc.get_height()/2 - 170),
format_description(800 - 200));
y += 32;
y += 45;
gc.print_left (Fonts::chalk_normal, Vector2i(left_x, y), _("Number of Pingus: "));
gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(plf.get_number_of_pingus()));
gc.print_left (Fonts::chalk_normal, Vector2i(left_x, (y += 30)), _("Number to Save: "));
gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(plf.get_number_to_save()));
gc.print_left (Fonts::chalk_normal, Vector2i(left_x, (y += 30)), _("Time: "));
gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), time_str);
gc.print_center(Fonts::chalk_small,
Vector2i(gc.get_width()/2,
gc.get_height()/2 + 215),
_("Author: ") + plf.get_author());
if (globals::developer_mode)
{
gc.print_center(Fonts::chalk_small, Vector2i(gc.get_width()/2, gc.get_height()-50), plf.get_resname());
}
}
示例8: if
void
LevelDot::draw_hover(DrawingContext& gc)
{
int pos_correction = 0;
if (accessible())
{
int length = Fonts::pingus_small.bounding_rect(0, 0, _(get_plf().get_levelname())).get_width() / 2;
int realpos = gc.world_to_screen(Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y))).x;
if (realpos - length < 0)
pos_correction = realpos - length;
else if (realpos + length > gc.get_width())
pos_correction = realpos + length - static_cast<int>(gc.get_width());
gc.print_center(Fonts::pingus_small,
Vector2i(static_cast<int>(pos.x) - pos_correction,
static_cast<int>(pos.y) - 44),
_(get_plf().get_levelname()),
10000);
}
else
{
int length = Fonts::pingus_small.bounding_rect(0, 0, _("locked")).get_width() / 2;
int realpos = gc.world_to_screen(Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y))).x;
if (realpos - length < 0)
pos_correction = realpos - length;
else if (realpos + length > gc.get_width())
pos_correction = realpos + length - static_cast<int>(gc.get_width());
gc.print_center(Fonts::pingus_small,
Vector2i(static_cast<int>(pos.x) - pos_correction,
static_cast<int>(pos.y) - 30),
_("locked"),
10000);
}
if (globals::maintainer_mode)
{
gc.print_center(Fonts::pingus_small,
Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y) - 56),
get_plf().get_resname(),
10000);
}
}
示例9:
void
AddOnMenu::draw_background(DrawingContext& gc)
{
// gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0));
gc.draw(background, Vector2i(gc.get_width()/2, gc.get_height()/2));
gc.print_center(Fonts::chalk_large, Vector2i(gc.get_width()/2, 90), "Add-On Menu");
gc.print_left(Fonts::chalk_normal, Vector2i(120, 145), "X-Mas Pingus Sprites");
gc.print_left(Fonts::chalk_small, Vector2i(140, 170), "christmas look for penguins");
gc.print_left(Fonts::chalk_small, Vector2i(140, 190), "Author: John Foo <[email protected]>");
gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2, gc.get_height()/2 + 160), "Update Online [ ]");
gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2 + 245 + 30, gc.get_height()/2 + 150 - 20), _("Close"));
gc.draw(ok_button, Vector2i(gc.get_width()/2 + 245, gc.get_height()/2 + 150));
gc.draw(ok_button, Vector2i(610, 145));
}
示例10:
void
StoryDot::draw_hover(DrawingContext& gc)
{
gc.draw (m_story_dot_highlight, pos);
gc.print_center(Fonts::pingus_small,
Vector2i(static_cast<int>(pos.x),
static_cast<int>(pos.y) - 44),
_(m_name),
10000);
}
示例11:
void
OptionMenu::draw_background(DrawingContext& gc)
{
// Paint the background wood panel
for(int y = 0; y < gc.get_height(); y += m_background.get_height())
for(int x = 0; x < gc.get_width(); x += m_background.get_width())
gc.draw(m_background, Vector2i(x, y));
// gc.draw_fillrect(Rect(100, 100, 400, 400), Color(255, 0, 0));
gc.draw(m_blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2));
gc.print_center(Fonts::chalk_large,
Vector2i(gc.get_width()/2,
gc.get_height()/2 - 240),
_("Option Menu"));
gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2 + 245 + 30, gc.get_height()/2 + 150 - 20), _("Close"));
gc.print_left(Fonts::chalk_normal,
Vector2i(gc.get_width()/2 - 320, gc.get_height()/2 + 200),
_("Some options require a restart of the game to take effect."));
}
示例12:
void
StoryScreenComponent::draw (DrawingContext& gc)
{
gc.draw(background, Vector2i(gc.get_width()/2, gc.get_height()/2));
gc.print_center(Fonts::chalk_large, Display::get_width()/2,
Display::get_height()/2 - 200, story->get_title());
gc.draw(page_surface, Vector2i(gc.get_width()/2, gc.get_height()/2 - 65));
gc.print_left(Fonts::chalk_normal,
Display::get_width()/2 - 280,
Display::get_height()/2 + 35,
display_text);
}
示例13: if
void
Button::draw (DrawingContext& gc)
{
if (enabled)
{
if (mouse_down && mouse_over)
GUIStyle::draw_lowered_box(gc, rect, Color(237, 233, 227), 2);
else if (mouse_over)
GUIStyle::draw_raised_box(gc, rect, Color(255, 255, 255), 2);
else
GUIStyle::draw_raised_box(gc, rect, Color(237, 233, 227), 2);
}
gc.print_center(Fonts::verdana11,
Vector2i(rect.left + rect.get_width()/2, rect.top + rect.get_height()/2 - 6),
text);
}
示例14:
void
StoryScreenComponent::draw (DrawingContext& gc)
{
// Paint the background wood panel
for(int y = 0; y < gc.get_height(); y += background.get_height())
for(int x = 0; x < gc.get_width(); x += background.get_width())
gc.draw(background, Vector2i(x, y));
gc.draw(blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2));
gc.print_center(Fonts::chalk_large,
Vector2i(gc.get_width()/2, gc.get_height()/2 - 200),
story->get_title());
gc.draw(page_surface, Vector2i(gc.get_width()/2, gc.get_height()/2 - 65));
gc.print_left(Fonts::chalk_normal,
Vector2i(gc.get_width()/2 - 280,
gc.get_height()/2 + 35),
display_text);
}
示例15: Color
void
ChoiceBox::draw(DrawingContext& gc)
{
if (globals::developer_mode)
gc.draw_rect(rect, Color(0, 255, 255));
if (!choices.empty())
{
if (current_choice >= 0 && current_choice < int(choices.size()))
{
//if (current_choice != 0)
gc.print_left(Fonts::chalk_normal, Vector2i(rect.left, rect.top), "<");
//if (current_choice != int(choices.size())-1)
gc.print_right(Fonts::chalk_normal, Vector2i(rect.right, rect.top), ">");
gc.print_center(Fonts::chalk_normal, Vector2i(rect.left + rect.get_width()/2, rect.top),
choices[current_choice]);
}
}
}