瀏覽代碼

world aangepast

Aaldert 9 年之前
父節點
當前提交
dba9c581b1
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 1 2
      World.cpp
  2. 2 0
      World.h

+ 1 - 2
World.cpp

@@ -3,7 +3,6 @@
 #include "Entity.h"
 #include "json.h"
 #include "Model.h"
-#include "CrystalPoint.h"
 #include <fstream>
 #include <iostream>
 #include <algorithm>
@@ -179,6 +178,7 @@ World::World(const std::string &fileName):
 	if (!v["world"]["music"].isNull())
 	{
 		music_id = CrystalPoint::GetSoundSystem().LoadSound(v["world"]["music"].asString().c_str(), true);
+		music = CrystalPoint::GetSoundSystem().GetSound(music_id);
 	}
 
 	if (!v["portal"].isNull())
@@ -254,7 +254,6 @@ void World::draw()
 
 void World::update(float elapsedTime)
 {
-	Sound* music = CrystalPoint::GetSoundSystem().GetSound(music_id);
 	music->SetPos(player->position, Vec3f());
 
 	if (music->IsPlaying() ==  false)

+ 2 - 0
World.h

@@ -8,6 +8,7 @@
 #include "Interface.h"
 #include "Crystal.h"
 #include "Skybox.h"
+#include "CrystalPoint.h"
 #include "Portal.h"
 
 class Entity;
@@ -16,6 +17,7 @@ class World
 {
 private:
 	std::vector<std::pair<int, std::pair<std::string, bool>>> objecttemplates;
+	Sound* music;
 
 	Player* player;
 	HeightMap* heightmap;