示例#1
0
void
EditorInputCenter::draw(DrawingContext& context) {
  draw_tile_tip(context);
  draw_path(context);

  if (render_grid) {
    draw_tile_grid(context);
  }

  if (object_tip) {
    object_tip->draw(context, mouse_pos);
  }

  if (dragging && Editor::current()->tileselect.select_mode->get_mode() == 1
      && !dragging_right) {
    // Draw selection rectangle...
    Vector p0 = drag_start - Editor::current()->currentsector->camera->get_translation();
    Vector p1 = Vector(drag_start.x, sector_pos.y) - Editor::current()->currentsector->camera->get_translation();
    Vector p2 = Vector(sector_pos.x, drag_start.y) - Editor::current()->currentsector->camera->get_translation();

    context.draw_filled_rect(Rectf(p0, p1 + Vector(2, 2)),
                             Color(0.0f, 1.0f, 0.0f, 1.0f), 0.0f, LAYER_GUI-5);
    context.draw_filled_rect(Rectf(p2, mouse_pos + Vector(2, 2)),
                             Color(0.0f, 1.0f, 0.0f, 1.0f), 0.0f, LAYER_GUI-5);
    context.draw_filled_rect(Rectf(p0, p2 + Vector(2, 2)),
                             Color(0.0f, 1.0f, 0.0f, 1.0f), 0.0f, LAYER_GUI-5);
    context.draw_filled_rect(Rectf(p1, mouse_pos + Vector(2, 2)),
                             Color(0.0f, 1.0f, 0.0f, 1.0f), 0.0f, LAYER_GUI-5);

    context.draw_filled_rect(Rectf(p0, mouse_pos),
                             Color(0.0f, 1.0f, 0.0f, 0.2f), 0.0f, LAYER_GUI-5);
  }

  if (dragging && dragging_right) {
    context.draw_filled_rect(selection_draw_rect(),
                             Color(0.2f, 0.4f, 1.0f, 0.6f), 0.0f, LAYER_GUI-13);
  }
}
示例#2
0
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);
}