Esempio n. 1
0
        //----------------------------------------------------
        //----------------------------------------------------
		void Application::Init()
		{
            CS_ASSERT(s_application == nullptr, "Application already initialised!");
            s_application = this;
            
			Logging::Create();

            //Create all application systems.
            m_isSystemCreationAllowed = true;
            CreateDefaultSystems();
			CreateSystems();
            m_isSystemCreationAllowed = false;
            
			PostCreateSystems();
            
            //initialise all of the application systems.
            for (const AppSystemUPtr& system : m_systems)
            {
                system->OnInit();
            }
            
            OnInit();
            PushInitialState();
		}
class GameCode : public Pocket::GameState<GameCode> { public: Pocket::GameWorld world; Pocket::FileArchive fileArchive; void Initialize() { std::string zipFile = "resources"; fileArchive.Initialize(zipFile); File::SetArchive(fileArchive); world.GuidToRoot = [this] (const std::string& guid) { GameObject* root = 0; if (!fileArchive.TryLoadData(guid, [&root, this] (void* data, size_t size) { std::stringstream ss; ss.write((const char*)data, size); root = world.CreateRootFromJson(ss, [](GameObject* root) { CreateDefaultSystems(*root); CreateScriptSystems(*root); }); })) { std::cout << "unable to load: "<<guid <<std::endl; } return root; }; world.GuidToPath = [] (const std::string& guid) { return guid; };world.SetLayerScene(0, world.TryFindRoot("9KkPi0bmTS6f+W3nOFgVRw=="));

    std::cout << Context().ScreenSize << std::endl;

} void Update(float dt) { Context().InputDevice().UpdateInputManager(&world.Input()); world.Update(dt); } void Render() { world.Render(); } }; int main() { Pocket::Engine e; e.Start<GameCode>(); return 0; }