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

tools: add ability to load projects from whithin the level editor

Daniele Bartolini 7 лет назад
Родитель
Сommit
192908e6f8

+ 85 - 85
tools/gresources.c

@@ -4759,91 +4759,91 @@ static const SECTION union { const guint8 data[43562]; const double alignment; v
   0x75, 0x75, 0x61, 0x79, 0x29, 0x6c, 0x65, 0x76, 
   0x65, 0x6c, 0x5f, 0x65, 0x64, 0x69, 0x74, 0x6f, 
   0x72, 0x2e, 0x78, 0x6d, 0x6c, 0x00, 0x00, 0x00, 
-  0x90, 0x0c, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
-  0x78, 0xda, 0x8d, 0x57, 0xdb, 0x92, 0xdb, 0x20, 
-  0x0c, 0x7d, 0xdf, 0xaf, 0xc8, 0xf0, 0xce, 0x26, 
-  0x69, 0x9b, 0x99, 0xed, 0x4c, 0x92, 0x7d, 0xeb, 
-  0x17, 0xb4, 0x1f, 0x80, 0xb1, 0xe2, 0x30, 0xc5, 
-  0x88, 0x72, 0x49, 0x36, 0x7f, 0x5f, 0xb0, 0x9d, 
-  0x8d, 0xb3, 0x06, 0xec, 0xb7, 0xc0, 0x39, 0x16, 
-  0x42, 0x12, 0xd2, 0xc9, 0xfe, 0xfd, 0xa3, 0x95, 
-  0xab, 0x0b, 0x18, 0x2b, 0x50, 0x1d, 0xc8, 0xf6, 
-  0x75, 0x43, 0x56, 0xa0, 0x38, 0xd6, 0x42, 0x35, 
-  0x07, 0xf2, 0xe7, 0xf7, 0x2f, 0xfa, 0x46, 0xde, 
-  0x8f, 0x2f, 0x7b, 0x2f, 0x8e, 0xfb, 0x16, 0x94, 
-  0xaf, 0x98, 0x59, 0x29, 0xd6, 0xc2, 0x81, 0x0c, 
-  0x2b, 0xd2, 0xef, 0xaf, 0x18, 0x77, 0x9d, 0x85, 
-  0xb8, 0xa0, 0x27, 0x21, 0x61, 0x00, 0x84, 0x83, 
-  0xf6, 0x13, 0x54, 0x70, 0x25, 0xeb, 0xc4, 0x3e, 
-  0x6a, 0x50,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 0xf7, 
-  0xd6, 0x61, 0xbb, 0x8c, 0xbb, 0x79, 0xdd, 0x92, 
-  0x02, 0xf8, 0xad, 0x04, 0xee, 0xf2, 0x60, 0xc1, 
-  0x68, 0xc1, 0xe4, 0xae, 0xf8, 0x18, 0xba, 0xf2, 
-  0x09, 0x4b, 0x1a, 0x83, 0x4a, 0x72, 0xf5, 0x75, 
-  0x27, 0x2c, 0x8d, 0xc2, 0xf3, 0x47, 0x5b, 0xb2, 
-  0x80, 0xb3, 0x5b, 0x40, 0xfa, 0xbe, 0x59, 0x40, 
-  0xfa, 0xb1, 0xc4, 0xd2, 0xcf, 0x25, 0x96, 0xb6, 
-  0x6f, 0x9b, 0x51, 0xec, 0xb2, 0x21, 0xe4, 0x06, 
-  0xe2, 0x0b, 0x4c, 0x41, 0xa1, 0x9b, 0xb6, 0x22, 
-  0xbe, 0x2b, 0x4b, 0x92, 0x5d, 0x6d, 0x40, 0x43, 
-  0x58, 0xab, 0xf4, 0xd3, 0x7b, 0x50, 0xac, 0x3e, 
-  0x87, 0xb7, 0x32, 0x43, 0xe2, 0xa8, 0x66, 0x29, 
-  0x37, 0x29, 0x54, 0x0d, 0x66, 0x86, 0x16, 0x3a, 
-  0x51, 0x6f, 0x6a, 0x74, 0xed, 0x27, 0x2a, 0x0f, 
-  0x23, 0xcf, 0xb0, 0xa4, 0x15, 0x29, 0x9a, 0xb3, 
-  0x4b, 0x77, 0x92, 0x38, 0x19, 0xe2, 0x7c, 0x30, 
-  0x1c, 0x8a, 0x65, 0x39, 0x58, 0xcf, 0x9e, 0x4b, 
-  0x2f, 0x02, 0xae, 0x54, 0x87, 0x21, 0xad, 0x81, 
-  0xdf, 0x1b, 0x57, 0xb1, 0x24, 0xc7, 0xdf, 0x9d, 
-  0x0c, 0xaa, 0xb4, 0x83, 0x63, 0x56, 0xc5, 0xf8, 
-  0xdf, 0x59, 0x92, 0xc9, 0xde, 0x75, 0xcc, 0x92, 
-  0x70, 0x9a, 0x27, 0x39, 0x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, 0xca, 0x84, 0xfc, 0x5c, 0x67, 0xeb, 0x21, 
-  0xf8, 0xe1, 0x57, 0xf8, 0x8f, 0xf1, 0xf2, 0x1f, 
-  0x57, 0x48, 0x84, 0xca, 0x00, 0x00, 0x00, 0x00, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+  0xbd, 0x0c, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
+  0x78, 0xda, 0x8d, 0x97, 0xdb, 0x92, 0x1a, 0x21, 
+  0x10, 0x86, 0xef, 0xf7, 0x29, 0x2c, 0xee, 0x59, 
+  0x35, 0x89, 0x55, 0x9b, 0x2a, 0x75, 0xef, 0xf2, 
+  0x04, 0xc9, 0x03, 0x30, 0x4c, 0x3b, 0x92, 0x65, 
+  0x68, 0xc2, 0x41, 0xd7, 0xb7, 0x0f, 0x38, 0xb3, 
+  0xab, 0xee, 0x70, 0x98, 0x3b, 0x99, 0xff, 0xa3, 
+  0x69, 0x9a, 0x86, 0x6e, 0xb7, 0xaf, 0xef, 0xbd, 
+  0x5c, 0x9c, 0xc0, 0x58, 0x81, 0x6a, 0x47, 0xd6, 
+  0xcf, 0x2b, 0xb2, 0x00, 0xc5, 0xb1, 0x15, 0xaa, 
+  0xdb, 0x91, 0x3f, 0xbf, 0x7f, 0xd1, 0x17, 0xf2, 
+  0xba, 0x7f, 0xda, 0x7a, 0xb1, 0xdf, 0xf6, 0xa0, 
+  0x7c, 0xc3, 0xcc, 0x42, 0xb1, 0x1e, 0x76, 0x64, 
+  0x1c, 0x91, 0xe1, 0xfb, 0x82, 0x71, 0x77, 0xb5, 
+  0x10, 0x07, 0xf4, 0x20, 0x24, 0x8c, 0x82, 0x70, 
+  0xd0, 0x7f, 0x8a, 0x0a, 0xce, 0x54, 0xc2, 0x09, 
+  0x24, 0x59, 0x26, 0x54, 0xd4, 0xa0, 0x6a, 0xb2, 
+  0x36, 0xf8, 0x17, 0xb8, 0x4b, 0x02, 0x96, 0x9d, 
+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b, 0x79, 0xec, 0xea, 
+  0x79, 0x4d, 0x0a, 0xe2, 0xb7, 0x92, 0xb8, 0xc9, 
+  0x8b, 0x05, 0xa3, 0x05, 0x93, 0x9b, 0xe2, 0x65, 
+  0xb8, 0xa6, 0x4f, 0x18, 0xd2, 0x18, 0x54, 0x92, 
+  0xcb, 0xaf, 0x0f, 0x60, 0x6e, 0x14, 0x1e, 0x27, 
+  0xad, 0xc9, 0x0c, 0x66, 0x33, 0x03, 0xfa, 0xbe, 
+  0x9a, 0x01, 0xfd, 0x98, 0x63, 0xe9, 0xe7, 0x1c, 
+  0x4b, 0xeb, 0x97, 0xd5, 0x5d, 0xec, 0xb2, 0x21, 
+  0xe4, 0x06, 0xe2, 0x0d, 0x4c, 0x49, 0xe1, 0x35, 
+  0xed, 0x45, 0xbc, 0x57, 0x96, 0x24, 0x5f, 0xb5, 
+  0x51, 0x0d, 0x61, 0x6d, 0xd2, 0x57, 0xef, 0x86, 
+  0x58, 0x7d, 0x0c, 0x77, 0xa5, 0x02, 0x71, 0x54, 
+  0x55, 0xe4, 0x22, 0x85, 0x6a, 0xc1, 0x54, 0xb0, 
+  0xf0, 0x12, 0x0d, 0xa6, 0xee, 0xb6, 0xfd, 0x80, 
+  0xf2, 0x50, 0x1f, 0x0d, 0x4b, 0x5a, 0x91, 0xa2, 
+  0x3b, 0x66, 0x8a, 0x57, 0xac, 0x0c, 0xb1, 0x3e, 
+  0x18, 0x0e, 0xc5, 0xb4, 0x1c, 0xad, 0x67, 0xd7, 
+  0xa5, 0x27, 0x11, 0xaa, 0xac, 0x0e, 0x15, 0x5d, 
+  0x87, 0x42, 0x39, 0x3e, 0x5c, 0xc5, 0x94, 0xbc, 
+  0x9f, 0x77, 0x30, 0xa8, 0xd2, 0x0e, 0xde, 0x53, 
+  0x0d, 0xe3, 0x6f, 0x55, 0xc8, 0x64, 0xf7, 0x7a, 
+  0x4f, 0x49, 0x38, 0xd4, 0x21, 0x87, 0xba, 0xee, 
+  0x13, 0xba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e, 0xf8, 
+  0x15, 0xfe, 0x90, 0x3c, 0xfd, 0x07, 0x1c, 0xc6, 
+  0x95, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 

+ 65 - 8
tools/level_editor/level_editor.vala

@@ -90,8 +90,9 @@ namespace Crown
 		const Gtk.ActionEntry[] action_entries =
 		{
 			{ "menu-file",            null,  "_File",              null,             null,         null                       },
-			{ "new",                  null,  "New",                "<ctrl>N",        null,         on_new                     },
-			{ "open",                 null,  "Open...",            "<ctrl>O",        null,         on_open                    },
+			{ "new-level",            null,  "New Level",          "<ctrl>N",        null,         on_new_level               },
+			{ "open-level",           null,  "Open Level...",      "<ctrl>O",        null,         on_open_level              },
+			{ "open-project",         null,  "Open Project...",    null,             null,         on_open_project            },
 			{ "save",                 null,  "Save",               "<ctrl>S",        null,         on_save                    },
 			{ "save-as",              null,  "Save As...",         "<shift><ctrl>S", null,         on_save_as                 },
 			{ "import",               null,  "Import",             null,             null,         null                       },
@@ -616,6 +617,9 @@ namespace Crown
 
 		private void start_engine(uint window_xid)
 		{
+			if (window_xid == 0)
+				return;
+
 			string args[] =
 			{
 				ENGINE_EXE,
@@ -774,9 +778,9 @@ namespace Crown
 			_level.send_level();
 		}
 
-		private void load()
+		private void load_level()
 		{
-			FileChooserDialog fcd = new FileChooserDialog("Open..."
+			FileChooserDialog fcd = new FileChooserDialog("Open Level..."
 				, this
 				, FileChooserAction.OPEN
 				, "Cancel"
@@ -802,6 +806,34 @@ namespace Crown
 			fcd.destroy();
 		}
 
+		private void load_project()
+		{
+			FileChooserDialog fcd = new FileChooserDialog("Open Project..."
+				, this
+				, FileChooserAction.SELECT_FOLDER
+				, "Cancel"
+				, ResponseType.CANCEL
+				, "Open"
+				, ResponseType.ACCEPT
+				);
+
+			if (fcd.run() == (int)ResponseType.ACCEPT)
+			{
+				string filename = fcd.get_filename();
+				_console_view.logi("editor", "Loading project `%s`...".printf(filename));
+				_project.load(filename, _project.toolchain_dir());
+
+				_level_filename = null;
+				_level.load_empty_level();
+				stop_compiler();
+				start_compiler();
+				restart_engine();
+				_resource_browser.restart_engine();
+			}
+
+			fcd.destroy();
+		}
+
 		private bool save_as()
 		{
 			bool saved = false;
@@ -894,7 +926,7 @@ namespace Crown
 				shutdown();
 		}
 
-		private void on_new()
+		private void on_new_level()
 		{
 			if (!_database.changed())
 			{
@@ -923,11 +955,36 @@ namespace Crown
 			}
 		}
 
-		private void on_open(Gtk.Action action)
+		private void on_open_level(Gtk.Action action)
+		{
+			if (!_database.changed())
+			{
+				load_level();
+				return;
+			}
+
+			Gtk.MessageDialog md = new Gtk.MessageDialog(this
+				, Gtk.DialogFlags.MODAL
+				, Gtk.MessageType.WARNING
+				, Gtk.ButtonsType.NONE
+				, "File changed, save?"
+				);
+			md.add_button("Open _without Saving", ResponseType.NO);
+			md.add_button("_Cancel", ResponseType.CANCEL);
+			md.add_button("_Save", ResponseType.YES);
+			md.set_default_response(ResponseType.YES);
+			int rt = md.run();
+			md.destroy();
+
+			if (rt == (int)ResponseType.YES && save() || rt == (int)ResponseType.NO)
+				load_level();
+		}
+
+		private void on_open_project(Gtk.Action action)
 		{
 			if (!_database.changed())
 			{
-				load();
+				load_project();
 				return;
 			}
 
@@ -945,7 +1002,7 @@ namespace Crown
 			md.destroy();
 
 			if (rt == (int)ResponseType.YES && save() || rt == (int)ResponseType.NO)
-				load();
+				load_project();
 		}
 
 		private void on_save(Gtk.Action action)

+ 3 - 2
tools/level_editor/level_editor.xml

@@ -2,8 +2,9 @@
 <ui>
 	<menubar name="menubar">
 		<menu action="menu-file">
-			<menuitem action="new"></menuitem>
-			<menuitem action="open"></menuitem>
+			<menuitem action="new-level"></menuitem>
+			<menuitem action="open-level"></menuitem>
+			<menuitem action="open-project"></menuitem>
 			<menuitem action="save"></menuitem>
 			<menuitem action="save-as"></menuitem>
 			<separator></separator>

+ 7 - 0
tools/level_editor/project.vala

@@ -37,8 +37,15 @@ namespace Crown
 			_map = new HashMap<string, Guid?>();
 		}
 
+		public void reset()
+		{
+			_files.reset();
+			_map.clear();
+		}
+
 		public void load(string source_dir, string toolchain_dir)
 		{
+			reset();
 			_source_dir        = File.new_for_path(source_dir);
 			_toolchain_dir     = File.new_for_path(toolchain_dir);
 			_data_dir          = File.new_for_path(_source_dir.get_path() + "_" + _platform);