瀏覽代碼

manage guis in World

mikymod 12 年之前
父節點
當前提交
2c7c57e03b
共有 2 個文件被更改,包括 24 次插入0 次删除
  1. 19 0
      engine/world/World.cpp
  2. 5 0
      engine/world/World.h

+ 19 - 0
engine/world/World.cpp

@@ -281,6 +281,25 @@ void World::set_sound_volume(SoundId id, const float vol)
 	sound.volume = vol;
 }
 
+//-----------------------------------------------------------------------------
+GuiId World::create_window_gui(const char* name)
+{
+	GuiResource* gr = (GuiResource*)device()->resource_manager()->lookup(GUI_EXTENSION, name);
+	return m_render_world.create_gui(gr);
+}
+
+//-----------------------------------------------------------------------------
+void World::destroy_gui(GuiId id)
+{
+	m_render_world.destroy_gui(id);
+}
+
+//-----------------------------------------------------------------------------
+Gui* World::lookup_gui(GuiId id)
+{
+	return m_render_world.lookup_gui(id);
+}
+
 //-----------------------------------------------------------------------------
 SceneGraphManager* World::scene_graph_manager()
 {

+ 5 - 0
engine/world/World.h

@@ -51,6 +51,7 @@ namespace crown
 typedef Id MeshId;
 typedef Id SoundId;
 typedef Id SpriteId;
+typedef Id GuiId;
 
 struct Sound
 {
@@ -115,6 +116,10 @@ public:
 	void								set_sound_range(SoundId sound, const float range);
 	void								set_sound_volume(SoundId sound, const float vol);
 
+	GuiId								create_window_gui(const char* name);
+	void								destroy_gui(GuiId id);
+	Gui*								lookup_gui(GuiId id);
+
 	SceneGraphManager*					scene_graph_manager();
 	RenderWorld*						render_world();
 	PhysicsWorld*						physics_world();