Procházet zdrojové kódy

terrain sample updated with script

mikymod před 12 roky
rodič
revize
325da16e16
3 změnil soubory, kde provedl 9 přidání a 1 odebrání
  1. 1 0
      CMakeLists.txt
  2. 1 1
      samples/lua/lua.cpp
  3. 7 0
      samples/terrain/terrain.cpp

+ 1 - 0
CMakeLists.txt

@@ -92,4 +92,5 @@ if (CROWN_BUILD_TESTS)
 	add_subdirectory(tests)
 endif (CROWN_BUILD_TESTS)
 
+add_subdirectory(game)
 

+ 1 - 1
samples/lua/lua.cpp

@@ -17,7 +17,7 @@ int main(int argc, char** argv)
 
   ResourceManager res_manager(archive, allocator);
 
-  ResourceId script = res_manager.load("lua/hello.lua");
+  ResourceId script = res_manager.load("lua/init.lua");
 
   res_manager.flush();
 

+ 7 - 0
samples/terrain/terrain.cpp

@@ -2,6 +2,7 @@
 #include "Terrain.h"
 #include "FPSSystem.h"
 #include "Game.h"
+#include "ScriptSystem.h"
 
 using namespace crown;
 
@@ -124,11 +125,15 @@ public:
 		red_up    = device()->load("textures/red_up.tga");
 		red_down  = device()->load("textures/red_down.tga");
 		grass     = device()->load("textures/grass.tga");
+		script	  = device()->load("lua/init.lua");
 
 		device()->resource_manager()->flush();
 
 		TextureResource* grass_texture = (TextureResource*)device()->data(grass);
 		grass_id = device()->renderer()->load_texture(grass_texture);
+
+		ScriptResource* script_resource = (ScriptResource*)device()->data(script);
+		device()->script_system()->load(script_resource);
 	}
 
 	void on_unload()
@@ -229,6 +234,8 @@ private:
 	ResourceId red_down;
 	TextureId grass_id;
 
+	ResourceId script;
+
 	bool optShowSkybox;
 	bool optShowCrate;
 	bool optShowTerrain;