本文整理汇总了C++中DrawingContext::draw_fillrect方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawingContext::draw_fillrect方法的具体用法?C++ DrawingContext::draw_fillrect怎么用?C++ DrawingContext::draw_fillrect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawingContext
的用法示例。
在下文中一共展示了DrawingContext::draw_fillrect方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Color
void
GUIStyle::draw_raised_box(DrawingContext& gc, const Rect& rect, const Color& color, int border)
{
// FIXME: Should use draw_line
gc.draw_fillrect(rect, Color(255, 255, 255));
gc.draw_fillrect(Rect(rect.left+border, rect.top+border, rect.right, rect.bottom),
Color(169, 157, 140));
gc.draw_fillrect(Rect(rect.left+border, rect.top+border, rect.right-border, rect.bottom-border),
color);
}
示例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: Color
void
Inputbox::draw(DrawingContext& gc)
{
gc.draw_fillrect(rect, Color(255,255,255));
gc.draw_rect(rect, has_focus() ? Color(255,128,0) : Color(0,0,0));
gc.print_left(Fonts::verdana11,
Vector2i(rect.left + 5,
rect.top + rect.get_height()/2 - Fonts::verdana11.get_height()/2),
text);
}
示例4: border_color
void
GameSession::draw_background (DrawingContext& gc)
{
Rect rect = playfield->get_rect();
if (rect != Rect(Vector2i(0,0), Size(Display::get_width(), Display::get_height())))
{ // Draw a black border around the playfield when the playfield is smaller then the screen
Color border_color(0, 0, 0);
// top
gc.draw_fillrect(Rect(0, 0, Display::get_width(), rect.top),
border_color);
// bottom
gc.draw_fillrect(Rect(0, rect.bottom, Display::get_width(), Display::get_height()),
border_color);
// left
gc.draw_fillrect(Rect(0, rect.top, rect.left, rect.bottom),
border_color);
// right
gc.draw_fillrect(Rect(rect.right, rect.top, Display::get_width(), rect.bottom),
border_color);
}
}
示例5: 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);
}
示例6: if
// Draw the sprite
void
LevelObj::draw(DrawingContext &gc)
{
if (attribs & HAS_SURFACE || attribs & HAS_SURFACE_FAKE)
{
if (attribs & HAS_REPEAT)
{
for(int x = static_cast<int>(pos.x); x < static_cast<int>(pos.x) + sprite.get_width() * repeat; x += sprite.get_width())
{
gc.draw(sprite, Vector3f(static_cast<float>(x), pos.y, pos.z));
}
}
#if 0
else if(attribs & HAS_STRETCH)
{
// Surface Background - tile it
for (int x = 0; x < level->size.width; x += sprite.get_width())
for (int y = 0; y < level->size.height; y += sprite.get_height())
gc.draw(sprite, Vector3f((float)x, (float)y, pos.z));
}
#endif
else if (attribs & HAS_COLOR && section_name == "solidcolor-background")
{ // FIXME: Should we have the object type in non-string form?
gc.draw_fillrect(get_rect(), color, pos.z);
gc.draw(sprite, pos);
}
else
{
gc.draw(sprite, pos);
}
// If selected, draw a highlighted box around it
if (selected)
{
gc.draw_fillrect(get_rect(), Color(255,0,0,50), pos.z);
gc.draw_rect(get_rect(), Color(255,0,0), pos.z);
}
}
}
示例7: Color
void
Combobox::draw(DrawingContext &gc)
{
{ // draw the unopened box
gc.draw_fillrect(rect, Color(255,255,255));
gc.draw(sprite, Vector2i(rect.right - 12, rect.top));
gc.draw_rect(rect, Color(0,0,0));
if (current_item != -1)
{
gc.print_left(Fonts::verdana11,
Vector2i(rect.left + 5,
rect.top + rect.get_height()/2 - Fonts::verdana11.get_height()/2),
item_list[current_item].label);
}
}
if (drop_down && !item_list.empty())
{
gc.draw_fillrect(list_rect, Color(255,255,255), 90);
for (int i = 0; i < int(item_list.size()); ++i)
{
if (i == hover_item)
gc.draw_fillrect(Rect(Vector2i(rect.left, list_rect.top + rect.get_height()*i),
Size(rect.get_width(), rect.get_height())),
Color(150,200,255), 95);
gc.print_left(Fonts::verdana11,
Vector2i(list_rect.left + 5,
list_rect.top + i * rect.get_height() + rect.get_height()/2 - Fonts::verdana11.get_height()/2),
item_list[i].label, 100);
}
gc.draw_rect(list_rect, Color(0,0,0), 100);
}
}
示例8: border_color
void
WorldmapComponent::draw (DrawingContext& gc)
{
Worldmap* worldmap = worldmap_screen->get_worldmap();
Rect cliprect = worldmap_screen->get_trans_rect();
scene_context->set_rect(cliprect);
scene_context->clear();
scene_context->push_modelview();
worldmap->draw(scene_context->color());
gc.draw(new SceneContextDrawingRequest(scene_context.get(), Vector2i(0,0), -1000));
scene_context->pop_modelview();
// Draw border
if (cliprect != Rect(Vector2i(0,0), Size(Display::get_width(), Display::get_height())))
{
Color border_color(0, 0, 0);
// top
gc.draw_fillrect(Rect(0, 0, Display::get_width(), cliprect.top),
border_color);
// bottom
gc.draw_fillrect(Rect(0, cliprect.bottom, Display::get_width(), Display::get_height()),
border_color);
// left
gc.draw_fillrect(Rect(0, cliprect.top, cliprect.left, cliprect.bottom),
border_color);
// right
gc.draw_fillrect(Rect(cliprect.right, cliprect.top, Display::get_width(), cliprect.bottom),
border_color);
}
}
示例9: if
void
FileList::draw(DrawingContext& gc)
{
GUIStyle::draw_lowered_box(gc, rect, Color(255, 255, 255));
int end = (page+1) * items_per_page();
if (end > int(directory.size()))
end = static_cast<int>(directory.size());
int x = rect.left;
int y = rect.top;
for(System::Directory::iterator i = directory.begin() + page * items_per_page();
i != directory.begin() + end; ++i)
{
if (i->type == System::DE_DIRECTORY)
gc.draw(directory_icon, Vector2i(x, y));
else if (i->type == System::DE_FILE)
gc.draw(file_icon, Vector2i(x, y));
if ((click_item == -1 && (i - directory.begin()) == current_item) ||
(i - directory.begin()) == click_item)
{
if (click_item == current_item)
gc.draw_fillrect(Rect(x, y, x + hspace, y + vspace), Color(0, 0, 255));
else
gc.draw_rect(Rect(x, y, x + hspace, y + vspace), Color(0, 0, 255));
}
gc.print_left(Fonts::verdana11, Vector2i(x + 4, y + 3),
((i->type == System::DE_DIRECTORY) ? "[DIR] " : "[FILE] ") + i->name);
y += 20;
if (y > rect.bottom - vspace)
{
y = rect.top;
x += hspace;
}
}
}
示例10: Color
void
GenericLevelObj::draw_selection(DrawingContext &gc)
{
gc.draw_fillrect(get_rect(), Color(255,0,0,50), pos.z);
gc.draw_rect(get_rect(), Color(255,0,0), pos.z);
}
示例11: size_
// Draw the background and components
void
EditorScreen::draw(DrawingContext& gc)
{
// Black out screen
//gc.fill_screen(Color(255,0,255)); // FIXME: Could be removed for added speed
gui_manager->draw(gc);
if (show_help)
{
Size size_(640, 400);
gc.draw_fillrect(Rect(gc.get_width()/2 - size_.width/2 - 2,
gc.get_height()/2 - size_.height/2 - 2,
gc.get_width()/2 + size_.width/2 + 2,
gc.get_height()/2 + size_.height/2 + 2),
Color(0,0,0));
gc.draw_fillrect(Rect(gc.get_width()/2 - size_.width/2,
gc.get_height()/2 - size_.height/2,
gc.get_width()/2 + size_.width/2,
gc.get_height()/2 + size_.height/2),
Color(255,255,255));
gc.print_center(Fonts::verdana11,
Vector2i(gc.get_width()/2,
gc.get_height()/2 - size_.height/2 + 12),
_("== Editor Help =="));
int x = gc.get_width()/2 - size_.width/2 + 12;
int y = gc.get_height()/2 - size_.height/2 + 36;
gc.print_center(Fonts::verdana11, Vector2i(x + 75, y),
"A\n"
"Shift+A\n"
"PageUp, ], w\n"
"PageDown, [, s\n"
"Shift+PageUp\n"
"Shift+PageDown\n"
"R\n"
"Shift+R\n"
"G\n"
"Shift+G\n"
);
gc.print_left(Fonts::verdana11, Vector2i(x+150, y),
_("Select all\n"
"Clear Selection\n"
"Raise objects\n"
"Lower objects\n"
"Raise objects to top\n"
"Lower objects to bottom\n"
"Rotate 90 degree\n"
"Rotate 270 degree\n"
"Group selected objects\n"
"Ungroup selected objects\n"));
x = int(gc.get_width()/2 + 12);
y = int(gc.get_height()/2) - size_.height/2 + 36;
gc.print_center(Fonts::verdana11, Vector2i(x + 50, y),
"F\n"
"Shift+F\n"
"Delete, Backspace\n"
"I, K, J, L\n"
"Shift+I, K, J, L\n"
"B, Shift+B\n"
"=, +, -\n");
gc.print_left(Fonts::verdana11, Vector2i(x + 125, y),
_("Flip object horizontaly\n"
"Flip object vertically\n"
"Delete all marked objects\n"
"Move objects by one pixel\n"
"Move objects by 32 pixel\n"
"Toggle background color\n"
"Increase/lower repeat\n"));
gc.print_left(Fonts::verdana11,
Vector2i(gc.get_width()/2 - size_.width/2 + 12,
gc.get_height()/2 - 10),
_("You should name your level files systematically, i.e. by their theme, "
"their number and your nickname:\n\n"
" <levelname><number>-<creator>.pingus\n\n"
"So if you create your second level with a stone theme, call it: "
"stone2-yourname.pingus\n\n"
"When you have created a level and want to have it included "
"in the game mail it to:\n\n"
" [email protected]\n\n"
"Only levels published under the GPL are allowed into the game. The editor "
"automatically inserts a reference \n"
"to the GPL, if you want to have your level under a different license, you "
"have to change that reference.\n"
));
}
}