*
*/
-#include "game-renderer.h"
#include "game-model.h"
-#include "game-texture.h"
+#include "game-renderer.h"
#include "game-scene.h"
+#include "game-texture.h"
#include "fpp-game-tutorial-controller.h"
namespace
{
-
const char* SCENE_URL =
-{
- DEMO_GAME_DIR "/scene.json"
-};
+ {
+ DEMO_GAME_DIR "/scene.json"};
}
/* This example creates 3D environment with first person camera control
It contains following modules:
GameScene - responsible for loading and managing the scene data,
- it wraps around stage. Owns list of entities. Scene can be deserialised
+ it wraps around window. Owns list of entities. Scene can be deserialised
from json file ( see scene.json )
GameEntity - the renderable object that has also a transformation. It wraps DALi actors.
class GameController : public ConnectionTracker
{
public:
-
- GameController( Application& application )
- : mApplication( application )
+ GameController(Application& application)
+ : mApplication(application)
{
// Connect to the Application's Init signal
- mApplication.InitSignal().Connect( this, &GameController::Create );
+ mApplication.InitSignal().Connect(this, &GameController::Create);
}
~GameController()
}
// The Init signal is received once (only) during the Application lifetime
- void Create( Application& application )
+ void Create(Application& application)
{
- // Get a handle to the stage
- mStage = Stage::GetCurrent();
+ // Get a handle to the window
+ mWindow = application.GetWindow();
- mStage.SetBackgroundColor( Color::BLACK );
+ mWindow.SetBackgroundColor(Color::BLACK);
// Use 3D layer
- mStage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
+ mWindow.GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
// Load game scene
- mScene.Load( SCENE_URL );
+ mScene.Load(mWindow, SCENE_URL);
// Display tutorial
- mTutorialController.DisplayTutorial();
+ mTutorialController.DisplayTutorial(mWindow);
// Connect OnKeyEvent signal
- mStage.KeyEventSignal().Connect( this, &GameController::OnKeyEvent );
+ mWindow.KeyEventSignal().Connect(this, &GameController::OnKeyEvent);
}
// Handle a quit key event
void OnKeyEvent(const KeyEvent& event)
{
- if(event.state == KeyEvent::Down)
+ if(event.GetState() == KeyEvent::DOWN)
{
- if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
+ if(IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK))
{
mApplication.Quit();
}
}
private:
-
Application& mApplication;
GameScene mScene;
- Stage mStage;
+ Window mWindow;
FppGameTutorialController mTutorialController;
};
-int DALI_EXPORT_API main( int argc, char **argv )
+int DALI_EXPORT_API main(int argc, char** argv)
{
- Application application = Application::New( &argc, &argv );
- GameController test( application );
+ Application application = Application::New(&argc, &argv);
+ GameController test(application);
application.MainLoop();
return 0;
}