Nebula
Loading...
Searching...
No Matches
gameapplication.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14#include "app/application.h"
15#include "game/gameserver.h"
16#include "core/singleton.h"
17#include "core/coreserver.h"
19#include "io/ioserver.h"
20#include "io/iointerface.h"
23#include "http/httpinterface.h"
24#include "http/httpserverproxy.h"
26
27//------------------------------------------------------------------------------
28namespace App
29{
31{
33
34public:
38 virtual ~GameApplication();
40 virtual bool Open();
42 virtual void Close();
44 virtual void Run();
46 virtual void StepFrame();
47
49
50protected:
52 virtual void SetupGameFeatures();
54 virtual void CleanupGameFeatures();
56 virtual void SetupAppFromCmdLineArgs();
57
64
65
66#if __NEBULA_HTTP__
67 Ptr<Debug::DebugInterface> debugInterface;
68 Ptr<Http::HttpInterface> httpInterface;
69 Ptr<Http::HttpServerProxy> httpServerProxy;
70
71 ushort defaultTcpPort;
72#endif
73
74 // game server
76
77 // profiling
78 _declare_timer(GameApplicationFrameTimeAll);
79
81 {
82 public:
86 private:
87 virtual void OnExit() const
88 {
89 // make sure we gracefully shutdown everything
90 if (app->isOpen)
91 app->Close();
92 }
93
95 };
96
98};
99
100} // namespace App
101//------------------------------------------------------------------------------
Provides a simple application model for Nebula apps.
Definition application.h:19
bool isOpen
Definition application.h:68
Definition gameapplication.h:81
GameApplication * app
Definition gameapplication.h:94
GameAppExitHandler(GameApplication *app)
Definition gameapplication.h:83
virtual void OnExit() const
virtual method called from SysFunc::Exit()
Definition gameapplication.h:87
Nebula's default game application.
Definition gameapplication.h:31
Ptr< Resources::ResourceServer > resourceServer
Definition gameapplication.h:60
Ptr< BaseGameFeature::BaseGameFeatureUnit > baseGameFeature
Definition gameapplication.h:63
Ptr< IO::IoInterface > ioInterface
Definition gameapplication.h:62
static IndexT FrameIndex
Definition gameapplication.h:48
Ptr< IO::IoServer > ioServer
Definition gameapplication.h:61
virtual void CleanupGameFeatures()
cleanup game features
Definition gameapplication.cc:297
Ptr< Core::CoreServer > coreServer
Definition gameapplication.h:58
virtual __DeclareSingleton(GameApplication) public ~GameApplication()
destructor
Definition gameapplication.cc:50
Ptr< IO::GameContentServer > gameContentServer
Definition gameapplication.h:59
virtual void StepFrame()
step one frame
Definition gameapplication.cc:241
virtual void SetupAppFromCmdLineArgs()
setup app from cmd lines
Definition gameapplication.cc:306
_declare_timer(GameApplicationFrameTimeAll)
GameAppExitHandler exitHandler
Definition gameapplication.h:97
virtual void SetupGameFeatures()
setup game features
Definition gameapplication.cc:287
Ptr< Game::GameServer > gameServer
Definition gameapplication.h:75
virtual void Run()
run the application
Definition gameapplication.cc:228
virtual void Close()
close the application
Definition gameapplication.cc:175
virtual bool Open()
open the application
Definition gameapplication.cc:60
ExitHandlers are static objects which register themselves automatically once at startup and are calle...
Definition exithandler.h:22
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Definition gameapplication.cc:24
Definition coreserver.cc:11
#define __DeclareSingleton(type)
Definition osxsingleton.h:24
unsigned short ushort
Definition types.h:32
int IndexT
Definition types.h:48