00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "controlaspect.h"
00024 #include <zeitgeist/logserver/logserver.h>
00025 #include <oxygen/sceneserver/sceneserver.h>
00026
00027 using namespace std;
00028 using namespace boost;
00029 using namespace oxygen;
00030 using namespace zeitgeist;
00031
00032 shared_ptr<Scene>
00033 ControlAspect::GetActiveScene()
00034 {
00035 shared_ptr<SceneServer> sceneServer =
00036 shared_dynamic_cast<SceneServer>(GetCore()->Get("/sys/server/scene"));
00037
00038 if (sceneServer.get() == 0)
00039 {
00040 GetLog()->Error() << "(ControlAspect) cannot get SceneServer\n";
00041 return shared_ptr<Scene>();
00042 }
00043
00044 shared_ptr<Scene> activeScene = sceneServer->GetActiveScene();
00045
00046 if (activeScene.get() == 0)
00047 {
00048 GetLog()->Error() << "(ControlAspect) SceneServer reported no active scene\n";
00049 return shared_ptr<Scene>();
00050 }
00051
00052 return activeScene;
00053 }
00054
00055 shared_ptr<ControlAspect>
00056 ControlAspect::GetControlAspect(const string& name)
00057 {
00058 static const string gcsPath = "/sys/server/gamecontrol/";
00059
00060 shared_ptr<ControlAspect> aspect = shared_dynamic_cast<ControlAspect>
00061 (GetCore()->Get(gcsPath + name));
00062
00063 if (aspect.get() == 0)
00064 {
00065 GetLog()->Error() << "(ControlAspect) found no " << name << "\n";
00066 }
00067
00068 return aspect;
00069 }
00070
00071