当前位置: 首页>>代码示例>>C++>>正文


C++ DrawingContext::color方法代码示例

本文整理汇总了C++中DrawingContext::color方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawingContext::color方法的具体用法?C++ DrawingContext::color怎么用?C++ DrawingContext::color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DrawingContext的用法示例。


在下文中一共展示了DrawingContext::color方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Vector

void
ItemTextField::draw(DrawingContext& context, const Vector& pos, int menu_width, bool active) {
  std::string r_input = *input;
  bool fl = active && (int(g_real_time*2)%2);
  if ( fl ) {
    r_input += "_";
  }
  context.color().draw_text(Resources::normal_font, r_input,
                            Vector(pos.x + static_cast<float>(menu_width) - 16.0f - static_cast<float>(fl ? 0 : flickw),
                                   pos.y - Resources::normal_font->get_height() / 2.0f),
                            ALIGN_RIGHT, LAYER_GUI, ColorScheme::Menu::field_color);
  context.color().draw_text(Resources::normal_font, get_text(),
                            Vector(pos.x + 16.0f,
                                   pos.y - static_cast<float>(Resources::normal_font->get_height()) / 2.0f),
                            ALIGN_LEFT, LAYER_GUI, active ? ColorScheme::Menu::active_color : get_color());
}
开发者ID:HybridDog,项目名称:supertux,代码行数:16,代码来源:item_textfield.cpp

示例2: Color

void
InvisibleWall::draw(DrawingContext& context)
{
  if (Editor::is_active()) {
    context.color().draw_filled_rect(m_col.m_bbox, Color(0.0f, 0.0f, 0.0f, 0.6f),
                             0.0f, LAYER_OBJECTS);
  }
}
开发者ID:HybridDog,项目名称:supertux,代码行数:8,代码来源:invisible_wall.cpp

示例3: Color

void
SequenceTrigger::draw(DrawingContext& context)
{
  if (Editor::is_active()) {
    context.color().draw_filled_rect(bbox, Color(1.0f, 0.0f, 0.0f, 0.6f),
                             0.0f, LAYER_OBJECTS);
  }
}
开发者ID:brmbrmcar,项目名称:supertux,代码行数:8,代码来源:sequence_trigger.cpp

示例4:

void
SpriteChange::draw(DrawingContext& context)
{
  if (m_in_stay_action && !m_stay_action.empty()) {
    m_sprite->set_action(m_stay_action);
    m_sprite->draw(context.color(), m_pos * 32, LAYER_OBJECTS-1);
  }
}
开发者ID:HybridDog,项目名称:supertux,代码行数:8,代码来源:sprite_change.cpp

示例5:

void
MagicBlock::draw(DrawingContext& context){
  // Ask for update about lightmap at center of this block
  context.light().get_pixel( center, &light );

  MovingSprite::draw(context);
  context.color().draw_filled_rect( bbox, color, layer);
}
开发者ID:maxteufel,项目名称:supertux,代码行数:8,代码来源:magicblock.cpp

示例6: Vector

void
SpecialTile::draw(DrawingContext& context)
{
  if(invisible)
    return;

  sprite->draw(context.color(), pos*32 + Vector(16, 16), LAYER_OBJECTS - 1);
}
开发者ID:brmbrmcar,项目名称:supertux,代码行数:8,代码来源:special_tile.cpp

示例7: Color

void
SequenceTrigger::draw(DrawingContext& context)
{
  if (Editor::is_active() || g_debug.show_collision_rects) {
    context.color().draw_filled_rect(m_col.m_bbox, Color(1.0f, 0.0f, 0.0f, 0.6f),
                             0.0f, LAYER_OBJECTS);
  }
}
开发者ID:HybridDog,项目名称:supertux,代码行数:8,代码来源:sequence_trigger.cpp

示例8: float

void
ItemColorChannel::draw(DrawingContext& context, const Vector& pos, int menu_width, bool active)
{
  MenuItem::draw(context, pos, menu_width, active);
  const float lw = float(menu_width - 32) * (*m_number);
  context.color().draw_filled_rect(Rectf(pos + Vector(16, -4),
                                         pos + Vector(16 + lw, 4)),
                                   m_channel, 0.0f, LAYER_GUI-1);
}
开发者ID:pelya,项目名称:supertux,代码行数:9,代码来源:item_colorchannel.cpp

示例9: Vector

void
EditorScrollerWidget::draw(DrawingContext& context)
{
  if (!rendered) return;

  context.color().draw_filled_rect(Rectf(Vector(0, 0), Vector(SIZE, SIZE)),
                                     Color(0.9f, 0.9f, 1.0f, 0.6f),
                                     MIDDLE, LAYER_GUI-10);
  context.color().draw_filled_rect(Rectf(Vector(40, 40), Vector(56, 56)),
                                     Color(0.9f, 0.9f, 1.0f, 0.6f),
                                     8, LAYER_GUI-20);
  if (can_scroll()) {
    draw_arrow(context, m_mouse_pos);
  }

  draw_arrow(context, Vector(TOPLEFT, MIDDLE));
  draw_arrow(context, Vector(BOTTOMRIGHT, MIDDLE));
  draw_arrow(context, Vector(MIDDLE, TOPLEFT));
  draw_arrow(context, Vector(MIDDLE, BOTTOMRIGHT));
}
开发者ID:HybridDog,项目名称:supertux,代码行数:20,代码来源:scroller_widget.cpp

示例10:

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);
  }
}
开发者ID:brmbrmcar,项目名称:supertux,代码行数:11,代码来源:flower.cpp

示例11:

void
CoinRain::draw(DrawingContext& context)
{
  int layer;
  if (emerge_distance > 0) {
    layer = LAYER_OBJECTS - 5;
  } else {
    layer = LAYER_OBJECTS + 5;
  }
  sprite->draw(context.color(), position, layer);
}
开发者ID:HybridDog,项目名称:supertux,代码行数:11,代码来源:coin_rain.cpp

示例12: Vector

void
PlayerStatus::draw(DrawingContext& context)
{
  int player_id = 0;

  if ((displayed_coins == DISPLAYED_COINS_UNSET) ||
      (std::abs(displayed_coins - coins) > 100)) {
    displayed_coins = coins;
    displayed_coins_frame = 0;
  }
  if (++displayed_coins_frame > 2) {
    displayed_coins_frame = 0;
    if (displayed_coins < coins) displayed_coins++;
    if (displayed_coins > coins) displayed_coins--;
  }
  displayed_coins = std::min(std::max(displayed_coins, 0), MAX_COINS);

  std::stringstream ss;
  ss << displayed_coins;
  std::string coins_text = ss.str();

  context.push_transform();
  context.set_translation(Vector(0, 0));

  if (coin_surface)
  {
    context.color().draw_surface(coin_surface,
                                 Vector(static_cast<float>(context.get_width()) - BORDER_X - static_cast<float>(coin_surface->get_width()) - Resources::fixed_font->get_text_width(coins_text),
                                        BORDER_Y + 1.0f + (Resources::fixed_font->get_text_height(coins_text) + 5) * static_cast<float>(player_id)),
                                   LAYER_HUD);
  }
  context.color().draw_text(Resources::fixed_font,
                            coins_text,
                            Vector(static_cast<float>(context.get_width()) - BORDER_X - Resources::fixed_font->get_text_width(coins_text),
                                   BORDER_Y + (Resources::fixed_font->get_text_height(coins_text) + 5.0f) * static_cast<float>(player_id)),
                            ALIGN_LEFT,
                            LAYER_HUD,
                            PlayerStatus::text_color);

  context.pop_transform();
}
开发者ID:maxteufel,项目名称:supertux,代码行数:41,代码来源:player_status.cpp

示例13: Vector

void
ItemScriptLine::draw(DrawingContext& context, const Vector& pos, int menu_width, bool active) {
  std::string r_input = *input;
  bool fl = active && (int(g_real_time*2)%2);
  if ( fl ) {
    r_input += "_";
  }
  context.color().draw_text(Resources::console_font, r_input,
                            Vector(pos.x + 16.0f,
                                   pos.y - Resources::console_font->get_height() / 2.0f),
                            ALIGN_LEFT, LAYER_GUI, ColorScheme::Menu::field_color);
}
开发者ID:HybridDog,项目名称:supertux,代码行数:12,代码来源:item_script_line.cpp

示例14: Sizef

void
InfoBox::draw(DrawingContext& context)
{
  float x1 = static_cast<float>(context.get_width()) / 2.0f - 200.0f;
  float y1 = static_cast<float>(context.get_height()) / 2.0f - 200.0f;
  float width = 400.0f;
  float height = 200.0f;

  context.color().draw_filled_rect(Rectf(Vector(x1, y1),
                                         Sizef(width, height)),
                                   Color(0.6f, 0.7f, 0.8f, 0.5f), LAYER_GUI - 1);

  float y = y1;
  bool linesLeft = false;
  for (size_t i = firstline; i < lines.size(); ++i) {
    if (y >= y1 + height) {
      linesLeft = true;
      break;
    }

    lines[i]->draw(context, Rectf(x1, y, x1+width, y), LAYER_GUI);
    y += lines[i]->get_height();
  }

  {
    // draw the scrolling arrows
    if (arrow_scrollup.get() && firstline > 0)
      context.color().draw_surface(arrow_scrollup,
                                   Vector(x1 + width  - static_cast<float>(arrow_scrollup->get_width()),  // top-right corner of box
                                          y1), LAYER_GUI);

    if (arrow_scrolldown.get() && linesLeft && firstline < lines.size()-1)
      context.color().draw_surface(arrow_scrolldown,
                                   Vector(x1 + width  - static_cast<float>(arrow_scrolldown->get_width()),  // bottom-light corner of box
                                          y1 + height - static_cast<float>(arrow_scrolldown->get_height())),
                                   LAYER_GUI);
  }
}
开发者ID:HybridDog,项目名称:supertux,代码行数:38,代码来源:info_box.cpp

示例15: Vector

void
EditorToolboxWidget::draw(DrawingContext& context)
{
  //SCREEN_WIDTH SCREEN_HEIGHT
  context.color().draw_filled_rect(Rectf(Vector(static_cast<float>(m_Xpos), 0),
                                         Vector(static_cast<float>(context.get_width()),
                                                static_cast<float>(context.get_height()))),
                                     Color(0.9f, 0.9f, 1.0f, 0.6f),
                                     0.0f, LAYER_GUI-10);
  if (m_dragging) {
    context.color().draw_filled_rect(selection_draw_rect(), Color(0.2f, 0.4f, 1.0f, 0.6f),
                                       0.0f, LAYER_GUI+1);
  }

  if (m_hovered_item != HoveredItem::NONE)
  {
    context.color().draw_filled_rect(get_item_rect(m_hovered_item),
                                       Color(0.9f, 0.9f, 1.0f, 0.6f),
                                       0.0f, LAYER_GUI - 5);
  }

  context.color().draw_text(Resources::normal_font, _("Tilegroups"),
                            Vector(static_cast<float>(context.get_width()), 0),
                            ALIGN_RIGHT, LAYER_GUI, ColorScheme::Menu::default_color);
  context.color().draw_text(Resources::normal_font, _("Objects"),
                            Vector(static_cast<float>(context.get_width()), 24),
                            ALIGN_RIGHT, LAYER_GUI, ColorScheme::Menu::default_color);

  m_rubber->draw(context);
  m_select_mode->draw(context);
  m_move_mode->draw(context);
  m_settings_mode->draw(context);

  draw_tilegroup(context);
  draw_objectgroup(context);
}
开发者ID:pelya,项目名称:supertux,代码行数:36,代码来源:toolbox_widget.cpp


注:本文中的DrawingContext::color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。