Close #11 : It's ugly and makes me hate life, but the tile palette primitive is done

This commit is contained in:
2014-06-09 07:30:59 -07:00
parent e2b5ba5808
commit 48edd2fa92
3 changed files with 26 additions and 0 deletions

View File

@@ -67,6 +67,14 @@ module Tailor
@palettePanel = Wx::ScrolledWindow.new(@mainPanel, Wx::ID_ANY) @palettePanel = Wx::ScrolledWindow.new(@mainPanel, Wx::ID_ANY)
@paletteSizer = Wx::BoxSizer.new(Wx::VERTICAL) @paletteSizer = Wx::BoxSizer.new(Wx::VERTICAL)
@paletteLibraryPanels = {} @paletteLibraryPanels = {}
progdialog = Wx::ProgressDialog.new("Rebuilding Palette...",
"Rebuilding Palette...",
@collection.library.tile_count - 1,
self,
style = Wx::PD_SMOOTH | Wx::PD_AUTO_HIDE)
idx = 0
@collection.library.each do |ts| @collection.library.each do |ts|
tsExpandCollapseBtn = Wx::Button.new(@palettePanel, Wx::ID_ANY, ts.tileset_name) tsExpandCollapseBtn = Wx::Button.new(@palettePanel, Wx::ID_ANY, ts.tileset_name)
tsExpandCollapseBtn.set_min_size( tsExpandCollapseBtn.set_min_size(
@@ -79,6 +87,8 @@ module Tailor
tgridSizer = Wx::GridSizer.new(cols=2) tgridSizer = Wx::GridSizer.new(cols=2)
evt_button(tsExpandCollapseBtn.get_id()) { |event| on_LibExpandCollapseClicked(ts) } evt_button(tsExpandCollapseBtn.get_id()) { |event| on_LibExpandCollapseClicked(ts) }
ts.tiles.each do |tile| ts.tiles.each do |tile|
progdialog.update(idx)
idx += 1
tgridSizer.add(Wx::StaticBitmap.new(tpanel, Wx::ID_ANY, tile['image'].to_bitmap)) tgridSizer.add(Wx::StaticBitmap.new(tpanel, Wx::ID_ANY, tile['image'].to_bitmap))
tgridSizer.add(Wx::StaticText.new(tpanel, Wx::ID_ANY, tile['name'])) tgridSizer.add(Wx::StaticText.new(tpanel, Wx::ID_ANY, tile['name']))
end end

View File

@@ -23,6 +23,18 @@ module Tailor
end end
end end
def count
@tilesets.size
end
def tile_count
count = 0
@tilesets.each do |ts|
count += ts.count
end
count
end
def delete(tileset) def delete(tileset)
if tileset.instance_of?(String) if tileset.instance_of?(String)
@tilesets.delete(by_name(tileset)) @tilesets.delete(by_name(tileset))

View File

@@ -42,6 +42,10 @@ module Tailor
self.tiles << {"name" => name, "image" => image} self.tiles << {"name" => name, "image" => image}
end end
def count
@tiles.size
end
def get_tile(elem) def get_tile(elem)
if elem.instance_of?(String) if elem.instance_of?(String)
self.tiles.each do self.tiles.each do