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


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

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


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

示例1: Vector

void
Menu::draw_item(DrawingContext& context, int index)
{
  float menu_height = get_height();
  float menu_width  = get_width();

  MenuItem* pitem = items[index].get();

  float x_pos       = pos.x - menu_width/2;
  float y_pos       = pos.y + 24*index - menu_height/2 + 12;

  pitem->draw(context, Vector(x_pos, y_pos), menu_width, active_item == index);

  if(active_item == index)
  {
    float blink = (sinf(real_time * M_PI * 1.0f)/2.0f + 0.5f) * 0.5f + 0.25f;
    context.draw_filled_rect(Rectf(Vector(pos.x - menu_width/2 + 10 - 2, y_pos - 12 - 2),
                                   Vector(pos.x + menu_width/2 - 10 + 2, y_pos + 12 + 2)),
                             Color(1.0f, 1.0f, 1.0f, blink),
                             14.0f,
                             LAYER_GUI-10);
    context.draw_filled_rect(Rectf(Vector(pos.x - menu_width/2 + 10, y_pos - 12),
                                   Vector(pos.x + menu_width/2 - 10, y_pos + 12)),
                             Color(1.0f, 1.0f, 1.0f, 0.5f),
                             12.0f,
                             LAYER_GUI-10);
  }
}
开发者ID:Narre,项目名称:supertux,代码行数:28,代码来源:menu.cpp

示例2: text_rect

void
Menu::draw(DrawingContext& context)
{
  if (!items[active_item]->help.empty())
  {
    int text_width  = (int) Resources::normal_font->get_text_width(items[active_item]->help);
    int text_height = (int) Resources::normal_font->get_text_height(items[active_item]->help);

    Rectf text_rect(pos.x - text_width/2 - 8,
                   SCREEN_HEIGHT - 48 - text_height/2 - 4,
                   pos.x + text_width/2 + 8,
                   SCREEN_HEIGHT - 48 + text_height/2 + 4);

    context.draw_filled_rect(Rectf(text_rect.p1 - Vector(4,4),
                                   text_rect.p2 + Vector(4,4)),
                             Color(0.2f, 0.3f, 0.4f, 0.8f),
                             16.0f,
                             LAYER_GUI-10);

    context.draw_filled_rect(text_rect,
                             Color(0.6f, 0.7f, 0.8f, 0.5f),
                             16.0f,
                             LAYER_GUI-10);

    context.draw_text(Resources::normal_font, items[active_item]->help,
                      Vector(pos.x, SCREEN_HEIGHT - 48 - text_height/2),
                      ALIGN_CENTER, LAYER_GUI);
  }

  for(unsigned int i = 0; i < items.size(); ++i)
  {
    draw_item(context, i);
  }
}
开发者ID:huzongyao,项目名称:AndroidSuperTux,代码行数:34,代码来源:menu.cpp

示例3: draw

  void draw(DrawingContext& context)
  {
    float p = m_effect_progress;

    Rectf rect = m_to_rect;
    if (m_is_active)
    {
      rect.p1.x = (m_to_rect.p1.x * p) + (m_from_rect.p1.x * (1.0f - p));
      rect.p1.y = (m_to_rect.p1.y * p) + (m_from_rect.p1.y * (1.0f - p));
      rect.p2.x = (m_to_rect.p2.x * p) + (m_from_rect.p2.x * (1.0f - p));
      rect.p2.y = (m_to_rect.p2.y * p) + (m_from_rect.p2.y * (1.0f - p));
    }

    // draw menu background rectangles
    context.draw_filled_rect(Rectf(rect.p1.x - 4, rect.p1.y - 10-4,
                                   rect.p2.x + 4, rect.p2.y + 10 + 4),
                             Color(0.2f, 0.3f, 0.4f, 0.8f),
                             20.0f,
                             LAYER_GUI-10);

    context.draw_filled_rect(Rectf(rect.p1.x, rect.p1.y - 10,
                                   rect.p2.x, rect.p2.y + 10),
                             Color(0.6f, 0.7f, 0.8f, 0.5f),
                             16.0f,
                             LAYER_GUI-10);
  }
开发者ID:ChristophKuhfuss,项目名称:supertux,代码行数:26,代码来源:menu_manager.cpp

示例4: Vector

void
EditorLayersGui::draw(DrawingContext& context) {

  if (object_tip) {
    object_tip->draw_up(context, get_layer_coords(hovered_layer));
  }

  context.draw_filled_rect(Rectf(Vector(0, Ypos), Vector(Width, SCREEN_HEIGHT)),
                           Color(0.9f, 0.9f, 1.0f, 0.6f),
                           0.0f,
                           LAYER_GUI-10);

  switch (hovered_item) {
    case HI_SPAWNPOINTS:
      context.draw_filled_rect(Rectf(Vector(0, Ypos), Vector(Xpos, SCREEN_HEIGHT)),
                               Color(0.9f, 0.9f, 1.0f, 0.6f),
                               0.0f,
                               LAYER_GUI-5);
      break;
    case HI_SECTOR:
      context.draw_filled_rect(Rectf(Vector(Xpos, Ypos), Vector(sector_text_width + Xpos, SCREEN_HEIGHT)),
                               Color(0.9f, 0.9f, 1.0f, 0.6f),
                               0.0f,
                               LAYER_GUI-5);
      break;
    case HI_LAYERS: {
      Vector coords = get_layer_coords(hovered_layer);
      context.draw_filled_rect(Rectf(coords, coords + Vector(32, 32)),
                               Color(0.9f, 0.9f, 1.0f, 0.6f),
                               0.0f,
                               LAYER_GUI-5);
    } break;
    default: break;
  }

  if (!Editor::current()->levelloaded) {
    return;
  }

  context.draw_text(Resources::normal_font, sector_text,
                    Vector(35, Ypos+5),
                    ALIGN_LEFT, LAYER_GUI, ColorScheme::Menu::default_color);

  int pos = 0;
  for(auto it = layers.begin(); it != layers.end(); ++it) {
    LayerIcon* layer_icon = (*it).get();
    if (layer_icon->is_valid()) {
      layer_icon->draw(context, get_layer_coords(pos));
    } else {
      auto it2 = it;
      it++;
      layers.erase(it2);
      it--;
    }
    pos++;
  }

}
开发者ID:kerou,项目名称:supertux,代码行数:58,代码来源:layers_gui.cpp

示例5: 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);
}
开发者ID:CRS-ECHO51,项目名称:supertux,代码行数:11,代码来源:item_hl.cpp

示例6: 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();
}
开发者ID:Clever-Boy,项目名称:supertux,代码行数:29,代码来源:text_object.cpp

示例7: color

void
Sector::draw(DrawingContext& context)
{
  context.set_ambient_color( ambient_light );
  context.push_transform();
  context.set_translation(camera->get_translation());

  for(auto i = gameobjects.begin(); i != gameobjects.end(); ++i) {
    GameObjectPtr& object = *i;
    if(!object->is_valid())
      continue;

    if (draw_solids_only)
    {
      TileMap* tm = dynamic_cast<TileMap*>(object.get());
      if (tm && !tm->is_solid())
        continue;
    }

    object->draw(context);
  }

  if(show_collrects) {
    Color color(1.0f, 0.0f, 0.0f, 0.75f);
    for(auto i = moving_objects.begin(); i != moving_objects.end(); ++i) {
      MovingObject* object = *i;
      const Rectf& rect = object->get_bbox();

      context.draw_filled_rect(rect, color, LAYER_FOREGROUND1 + 10);
    }
  }

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

示例8: Vector

void
InfoBox::draw(DrawingContext& context)
{
  float x1 = 200;
  float y1 = 100;
  float width = 400;
  float height = 200;

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

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

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

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

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

示例9: Vector

void
GameSession::draw_pause(DrawingContext& context)
{
  context.draw_filled_rect(
    Vector(0,0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT),
    Color(0.0f, 0.0f, 0.0f, .25f), LAYER_FOREGROUND1);
}
开发者ID:devnexen,项目名称:supertux,代码行数:7,代码来源:game_session.cpp

示例10: float

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

示例11: Vector

void
Particles::draw(DrawingContext& context)
{
  // draw particles
  for(auto& particle : particles) {
    context.draw_filled_rect(particle->pos, Vector(size,size), color, drawing_layer);
  }
}
开发者ID:ChristophKuhfuss,项目名称:supertux,代码行数:8,代码来源:particles.cpp

示例12: Vector

void
Particles::draw(DrawingContext& context)
{
  // draw particles
  for(auto i = particles.begin(); i != particles.end(); ++i) {
    context.draw_filled_rect((*i)->pos, Vector(size,size), color,drawing_layer);
  }
}
开发者ID:CRS-ECHO51,项目名称:supertux,代码行数:8,代码来源:particles.cpp

示例13: Color

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

示例14: Color

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

示例15: Vector

void
Particles::draw(DrawingContext& context)
{
  // draw particles
  for(std::vector<Particle*>::iterator i = particles.begin();
      i != particles.end(); i++) {
    context.draw_filled_rect((*i)->pos, Vector(size,size), color,drawing_layer);
  }
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:9,代码来源:particles.cpp


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