Просмотр исходного кода

Add layer/depth to sprite import dialog

Daniele Bartolini 8 лет назад
Родитель
Сommit
7b72a55068
2 измененных файлов с 13 добавлено и 2 удалено
  1. 4 2
      tools/level_editor/project.vala
  2. 9 0
      tools/level_editor/sprite_import_dialog.vala

+ 4 - 2
tools/level_editor/project.vala

@@ -142,6 +142,8 @@ namespace Crown
 			int offset_y  = (int)sid.offset_y.value;
 			int spacing_x = (int)sid.spacing_x.value;
 			int spacing_y = (int)sid.spacing_y.value;
+			int layer     = (int)sid.layer.value;
+			int depth     = (int)sid.depth.value;
 
 			Vector2 pivot_xy = sprite_cell_pivot_xy(cell_w, cell_h, sid.pivot.active);
 
@@ -231,8 +233,8 @@ namespace Crown
 				data = new Hashtable();
 				data["material"]        = resource_name;
 				data["sprite_resource"] = resource_name;
-				data["layer"]           = 0;
-				data["depth"]           = 0;
+				data["layer"]           = layer;
+				data["depth"]           = depth;
 				data["visible"]         = true;
 
 				comp = new Hashtable();

+ 9 - 0
tools/level_editor/sprite_import_dialog.vala

@@ -114,6 +114,8 @@ public class SpriteImportDialog : Gtk.Dialog
 	public Gtk.SpinButton spacing_x;
 	public Gtk.SpinButton spacing_y;
 	public Gtk.ComboBoxText pivot;
+	public SpinButtonDouble layer;
+	public SpinButtonDouble depth;
 
 	// Widgets
 	public SpriteImportDialog(string png)
@@ -305,6 +307,9 @@ public class SpriteImportDialog : Gtk.Dialog
 			_drawing_area.queue_draw();
 		});
 
+		layer = new SpinButtonDouble(0.0, 0.0, 7.0);
+		depth = new SpinButtonDouble(0.0, 0.0, 9999.0);
+
 		Gtk.Grid grid = new Gtk.Grid();
 		grid.attach(label_with_alignment("Resolution", Gtk.Align.END),   0,  0, 1, 1);
 		grid.attach(label_with_alignment("Cells H", Gtk.Align.END),      0,  1, 1, 1);
@@ -317,6 +322,8 @@ public class SpriteImportDialog : Gtk.Dialog
 		grid.attach(label_with_alignment("Spacing X", Gtk.Align.END),    0,  8, 1, 1);
 		grid.attach(label_with_alignment("Spacing Y", Gtk.Align.END),    0,  9, 1, 1);
 		grid.attach(label_with_alignment("Pivot", Gtk.Align.END),        0, 10, 1, 1);
+		grid.attach(label_with_alignment("Layer", Gtk.Align.END),        0, 11, 1, 1);
+		grid.attach(label_with_alignment("Depth", Gtk.Align.END),        0, 12, 1, 1);
 
 		grid.attach(resolution,   1,  0, 1, 1);
 		grid.attach(cells_h,      1,  1, 1, 1);
@@ -329,6 +336,8 @@ public class SpriteImportDialog : Gtk.Dialog
 		grid.attach(spacing_x,    1,  8, 1, 1);
 		grid.attach(spacing_y,    1,  9, 1, 1);
 		grid.attach(pivot,        1, 10, 1, 1);
+		grid.attach(layer,        1, 11, 1, 1);
+		grid.attach(depth,        1, 12, 1, 1);
 		grid.row_spacing = 6;
 		grid.column_spacing = 12;