Răsfoiți Sursa

implement features for sounds compiling

mikymod 12 ani în urmă
părinte
comite
27834e0c99
2 a modificat fișierele cu 16 adăugiri și 1 ștergeri
  1. 4 0
      tools/pycrown/Compiler.py
  2. 12 1
      tools/pycrown/Repository.py

+ 4 - 0
tools/pycrown/Compiler.py

@@ -119,6 +119,9 @@ class Compiler:
 	def compile_pixel_shaders(self):
 		self.compile(self.m_repository.pixel_shader_resources());
 
+	def compile_sounds(self):
+		self.compile(self.m_repository.sound_resources());
+
 	# Compiles all the resources in the repository
 	def compile_all(self):
 		self.compile_textures()
@@ -127,6 +130,7 @@ class Compiler:
 		self.compile_scripts()
 		self.compile_vertex_shaders()
 		self.compile_pixel_shaders()
+		self.compile_sounds()
 
 	# Compile a single resource from the repository
 	def compile(self, resources):

+ 12 - 1
tools/pycrown/Repository.py

@@ -30,8 +30,9 @@ MESH_EXTENSION				= ('.dae')
 LUA_EXTENSION				= ('.lua')
 VERTEX_SHADER_EXTENSION		= ('.vs')
 PIXEL_SHADER_EXTENSION		= ('.ps')
+SOUND_EXTENSION				= ('.wav')
 
-resource_extensions = ('.txt', '.tga', '.dae', '.lua', '.vs', '.ps')
+resource_extensions = ('.txt', '.tga', '.dae', '.lua', '.vs', '.ps', '.wav')
 
 # Represents the folder containing the resources
 # Can filter resources by type and other useful stuff
@@ -113,6 +114,16 @@ class Repository:
 
 		return pss
 
+	# Returns a list of all the sound resources found
+	def sound_resources(self):
+		sounds = []
+
+		for res in self.m_resources:
+			if (res.endswith(SOUND_EXTENSION)):
+				sounds.append(res)
+
+		return sounds
+
 	# Scans the root path to find resources
 	def scan(self):
 		# Clear the resources