GroupPad::GroupPad(const IRect &rect, PGroupEditor editor, TileGroup *group) :Window(rect), m_editor(editor), m_group(group) { m_filter_box = make_shared<ComboBox>(IRect(0, 0, rect.width(), 22), 200, "Filter: ", TileFilter::strings(), TileFilter::count); attach(m_filter_box); m_filter_box->selectEntry(editor->tileFilter()); }
GroupEditor::GroupEditor(IRect rect) :ui::Window(rect, Color(0, 0, 0)), m_tile_list(rect.width(), 2) { m_view = clippedRect(); m_tile_group = nullptr; m_current_entry = nullptr; m_font = res::getFont(WindowStyle::fonts[1]); m_mode = mAddRemove; memset(m_offset, 0, sizeof(m_offset)); m_selected_group_id = 0; m_selected_surface_id = -1; m_select_mode = 0; m_selection_mode = 0; m_tile_filter = TileFilter::floors; updateSelector(); }
void Window::drawWindow(Renderer2D &out, IRect rect, FColor color, int outline) { FColor lighter(color.rgb() * 1.2f, color.a); FColor darker(color.rgb() * 0.8f, color.a); int aoutline = fwk::abs(outline); if(outline) { int2 hsize(rect.width(), aoutline); int2 vsize(aoutline, rect.height()); FColor col1 = outline < 0? darker : lighter; out.addFilledRect(IRect(rect.min, rect.min + hsize), col1); out.addFilledRect(IRect(rect.min, rect.min + vsize), col1); int2 p1(rect.min.x, rect.max.y - aoutline); int2 p2(rect.max.x - aoutline, rect.min.y); FColor col2 = outline < 0? lighter : darker; out.addFilledRect(IRect(p1, p1 + hsize), col2); out.addFilledRect(IRect(p2, p2 + vsize), col2); } int2 off(aoutline, aoutline); out.addFilledRect(inset(rect, off, off), color); }
TileSelector::TileSelector(IRect rect) :Window(rect, WindowStyle::gui_dark), m_tile_list(rect.width(), 2), m_selection(nullptr) { update(); }