Ver código fonte

Merge branch 'compilers-2' into lua-env

Conflicts:
	samples/terrain/CMakeLists.txt
Daniele Bartolini 12 anos atrás
pai
commit
0356dea510

+ 5 - 1
samples/terrain/CMakeLists.txt

@@ -1,5 +1,7 @@
 cmake_minimum_required(VERSION 2.8)
 
+project(sample-terrain)
+
 set (SRC
 	terrain.cpp
 	Terrain.cpp
@@ -12,4 +14,6 @@ set (HEADERS
 #add_library (game SHARED ${SRC} ${HEADERS})
 #target_link_libraries(game crown)
 
-#install (TARGETS game DESTINATION bin/terrain)
+#install (DIRECTORY terrain DESTINATION samples)
+#install (TARGETS game DESTINATION samples/terrain)
+

+ 0 - 0
samples/terrain/terrain/grass.tga → samples/terrain/terrain/textures/grass.tga


+ 0 - 0
samples/terrain/terrain/red_down.tga → samples/terrain/terrain/textures/red_down.tga


+ 0 - 0
samples/terrain/terrain/red_east.tga → samples/terrain/terrain/textures/red_east.tga


+ 0 - 0
samples/terrain/terrain/red_north.tga → samples/terrain/terrain/textures/red_north.tga


+ 0 - 0
samples/terrain/terrain/red_south.tga → samples/terrain/terrain/textures/red_south.tga


+ 0 - 0
samples/terrain/terrain/red_up.tga → samples/terrain/terrain/textures/red_up.tga


+ 0 - 0
samples/terrain/terrain/red_west.tga → samples/terrain/terrain/textures/red_west.tga


+ 6 - 6
tools/compilers/resource-compiler.py

@@ -30,16 +30,15 @@ import os
 from pycrown import Repository
 from pycrown import Compiler
 
-DEST_PATH_SUFFIX = "_compiled"
 PERFECT_SEED_FILE = "seed.ini"
 
 # Helper for compiling resources
 class CompilerHelper:
-	def __init__(self, root_path):
+	def __init__(self, root_path, platform_name):
 		self.m_root_path = root_path
 
 		# Define destination path name
-		dest = os.path.dirname(root_path) + "/" + os.path.basename(root_path) + DEST_PATH_SUFFIX
+		dest = os.path.dirname(root_path) + "/" + os.path.basename(root_path) + "_" + platform_name
 		self.m_dest_path = os.path.normpath(dest)
 
 		# Repository needs a root path
@@ -93,11 +92,12 @@ class CompilerHelper:
 def main():
 	root_path = ""
 
-	if (len(sys.argv) != 2):
-		print("Usage: resource-compiler <root-path>")
+	if (len(sys.argv) != 3):
+		print("Usage: resource-compiler <root-path> <platform-name>")
 		sys.exit(-1)
 
 	root_path = sys.argv[1];
+	platform_name = sys.argv[2];
 
 	root_path = os.path.abspath(root_path)
 
@@ -113,7 +113,7 @@ def main():
 		print("The path has to be a directory.")
 		sys.exit(-1)
 
-	helper = CompilerHelper(root_path)
+	helper = CompilerHelper(root_path, platform_name)
 
 	helper.compile()
 

+ 16 - 2
tools/editors/toolchain/toolchain.py

@@ -35,6 +35,8 @@ from pycrown import Repository
 class Toolchain:
 	def __init__(self):
 
+		self.m_current_platform = "linux"
+
 		builder = Gtk.Builder()
 		builder.add_from_file("ui/toolchain.glade")
 
@@ -58,11 +60,23 @@ class Toolchain:
 		self.m_run_button.set_sensitive(True)
 		self.m_root_path = button.get_filename()
 
+	def on_platform_combobox_changed(self, combo):
+		tree_iter = combo.get_active_iter()
+		if tree_iter != None:
+			model = combo.get_model()
+			platform, name = model[tree_iter][:2]
+			# Sets the current platform name
+			self.m_current_platform = platform
+
+	def on_target_combobox_changed(self, combo):
+		print("Not implemented.")
+
+
 	def on_run_button_clicked(self, button):
 		root_path = str(self.m_root_path)
-		dest_path = root_path + "_compiled"
+		dest_path = root_path + "_" + self.m_current_platform
 
-		comp = subprocess.call(["python", "resource-compiler.py", str(self.m_root_path)])
+		comp = subprocess.call(["python", "resource-compiler.py", str(self.m_root_path), self.m_current_platform])
 		crown = subprocess.call(["crown-linux", "--root-path", dest_path, "--dev"])
 
 	def on_browser_button_clicked(self, button):

+ 60 - 0
tools/editors/toolchain/ui/toolchain.glade

@@ -1,6 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.6 -->
+  <object class="GtkListStore" id="platform_list_store">
+    <columns>
+      <!-- column-name gchararray2 -->
+      <column type="gchararray"/>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">linux</col>
+        <col id="1" translatable="yes">Linux</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">windows</col>
+        <col id="1" translatable="yes">Windows</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">android</col>
+        <col id="1" translatable="yes">Android</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="target_list_store">
+    <columns>
+      <!-- column-name guint1 -->
+      <column type="guint"/>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0">0</col>
+        <col id="1" translatable="yes">Devel</col>
+      </row>
+      <row>
+        <col id="0">1</col>
+        <col id="1" translatable="yes">Release</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkWindow" id="window1">
     <property name="can_focus">False</property>
     <property name="window_position">center-always</property>
@@ -21,6 +61,7 @@
             <property name="can_focus">False</property>
             <property name="row_spacing">10</property>
             <property name="column_spacing">10</property>
+            <property name="row_homogeneous">True</property>
             <child>
               <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
@@ -82,6 +123,16 @@
               <object class="GtkComboBox" id="platform_combobox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="model">platform_list_store</property>
+                <property name="active">0</property>
+                <property name="entry_text_column">1</property>
+                <signal name="changed" handler="on_platform_combobox_changed" swapped="no"/>
+                <child>
+                  <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                  <attributes>
+                    <attribute name="text">1</attribute>
+                  </attributes>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -94,6 +145,15 @@
               <object class="GtkComboBox" id="target_combobox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="model">target_list_store</property>
+                <property name="active">0</property>
+                <signal name="changed" handler="on_target_combobox_changed" swapped="no"/>
+                <child>
+                  <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                  <attributes>
+                    <attribute name="text">1</attribute>
+                  </attributes>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">1</property>