本文整理汇总了C++中DrawingContext类的典型用法代码示例。如果您正苦于以下问题:C++ DrawingContext类的具体用法?C++ DrawingContext怎么用?C++ DrawingContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DrawingContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
SurfaceButton::draw (DrawingContext& gc)
{
if (pressed && mouse_over)
gc.draw(button_pressed_surface, Vector2i(x_pos, y_pos));
else if (!pressed && mouse_over)
gc.draw(button_mouse_over_surface, Vector2i(x_pos, y_pos));
else
gc.draw(button_surface, Vector2i(x_pos, y_pos));
}
示例2: if
void
TextObject::draw(DrawingContext& context)
{
context.push_transform();
context.set_translation(Vector(0, 0));
if(fading > 0) {
context.set_alpha((fadetime-fading) / fadetime);
} else if(fading < 0) {
context.set_alpha(-fading / fadetime);
} else if(!visible) {
context.pop_transform();
return;
}
float width = 500;
float height = 70;
Vector spos = pos + get_anchor_pos(Rectf(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
width, height, anchor);
context.draw_filled_rect(spos, Vector(width, height),
Color(0.6f, 0.7f, 0.8f, 0.5f), LAYER_GUI-50);
if (centered) {
context.draw_center_text(font, text, spos, LAYER_GUI-40, TextObject::default_color);
} else {
context.draw_text(font, text, spos + Vector(10, 10), ALIGN_LEFT, LAYER_GUI-40, TextObject::default_color);
}
context.pop_transform();
}
示例3: Vector
void
ItemHorizontalLine::draw(DrawingContext& context, Vector pos, int menu_width, bool active) {
// TODO
/* Draw a horizontal line with a little 3d effect */
context.draw_filled_rect(Vector(pos.x, pos.y - 6),
Vector(menu_width, 4),
Color(0.6f, 0.7f, 1.0f, 1.0f), LAYER_GUI);
context.draw_filled_rect(Vector(pos.x, pos.y - 6),
Vector(menu_width, 2),
Color(1.0f, 1.0f, 1.0f, 1.0f), LAYER_GUI);
}
示例4:
void
Flower::draw(DrawingContext& context)
{
//Draw the Sprite.
sprite->draw(context.color(), get_pos(), LAYER_OBJECTS, drawing_effect);
//Draw the light when dark
context.get_light( bbox.get_middle(), &light );
if (light.red + light.green + light.blue < 3.0){
lightsprite->draw(context.light(), bbox.get_middle(), 0);
}
}
示例5: 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);
}
示例6: get_pos
void
LiveFire::draw(DrawingContext& context)
{
//Draw the Sprite.
sprite->draw(context, get_pos(), LAYER_OBJECTS);
//Draw the light
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
lightsprite->draw(context, get_bbox().get_middle(), 0);
context.pop_target();
}
示例7: Color
void
GUIStyle::draw_lowered_box(DrawingContext& gc, const Rect& rect, const Color& color, int border)
{
// FIXME: Should use draw_line
gc.draw_fillrect(rect,
Color(169, 157, 140));
gc.draw_fillrect(Rect(rect.left+border, rect.top+border, rect.right, rect.bottom),
Color(255, 255, 255));
gc.draw_fillrect(Rect(rect.left+border, rect.top+border, rect.right-border, rect.bottom-border),
color);
}
示例8:
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);
}
示例9: pop_state
static void
pop_state(void* _context)
{
DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
context->PopState();
BPoint p(0, 0);
context->ConvertToScreenForDrawing(&p);
context->GetDrawingEngine()->SetDrawState(context->CurrentState(),
(int32)p.x, (int32)p.y);
}
示例10:
void
MrCandle::draw(DrawingContext& context) {
BadGuy::draw(context);
if (!frozen) {
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
candle_light->draw(context, bbox.get_middle(), 0);
context.pop_target();
}
}
示例11: draw_arc
static void
draw_arc(void* _context, const BPoint& center, const BPoint& radii,
float startTheta, float arcTheta, bool fill)
{
DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
BRect rect(center.x - radii.x, center.y - radii.y,
center.x + radii.x - 1, center.y + radii.y - 1);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, fill);
}
示例12: set_font_family
static void
set_font_family(void* _context, const char* _family, size_t length)
{
DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
BString family(_family, length);
FontStyle* fontStyle = gFontManager->GetStyleByIndex(family, 0);
ServerFont font;
font.SetStyle(fontStyle);
context->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
}
示例13: snprintf
void
ScreenManager::draw_fps(DrawingContext& context, float fps_fps)
{
char str[60];
snprintf(str, sizeof(str), "%3.1f", fps_fps);
const char* fpstext = "FPS";
context.draw_text(Resources::small_font, fpstext,
Vector(SCREEN_WIDTH - Resources::small_font->get_text_width(fpstext) - Resources::small_font->get_text_width(" 99999") - BORDER_X,
BORDER_Y + 20), ALIGN_LEFT, LAYER_HUD);
context.draw_text(Resources::small_font, str, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y + 20), ALIGN_RIGHT, LAYER_HUD);
}
示例14: Vector
void
Climbable::draw(DrawingContext& context)
{
if (climbed_by && !message.empty()) {
context.push_transform();
context.set_translation(Vector(0, 0));
Vector pos = Vector(0, SCREEN_HEIGHT/2 - Resources::normal_font->get_height()/2);
context.draw_center_text(Resources::normal_font, _(message), pos, LAYER_HUD, Climbable::text_color);
context.pop_transform();
}
}
示例15: set_line_mode
static void
set_line_mode(void* _context, cap_mode capMode, join_mode joinMode,
float miterLimit)
{
DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
DrawState* state = context->CurrentState();
state->SetLineCapMode(capMode);
state->SetLineJoinMode(joinMode);
state->SetMiterLimit(miterLimit);
context->GetDrawingEngine()->SetStrokeMode(capMode, joinMode, miterLimit);
}