Commits

Christian Fischer committed d971c17

removed deprecated engine state - updateables registered in the engine will now be performed independend of any state

Comments (0)

Files changed (2)

src/core/wiesel/engine.cpp

 
 
 Engine::Engine() {
-	state				= Engine_Uninitialized;
 	exit_requested		= false;
 	application			= NULL;
 
 		now_t  = clock();
 		float dt = (float(now_t - last_t) / CLOCKS_PER_SEC);
 
-		switch(getState()) {
-			case Engine_Uninitialized: {
-				// do nothing
-				break;
-			}
-
-			case Engine_Suspended: {
-				// do nothing
-				break;
-			}
-
-			case Engine_Background: {
-				// do nothing
-				break;
-			}
-
-			case Engine_Running: {
-				// run all updateable objects
-				for(int i=updateables.size(); --i>=0;) {
-					updateables.at(i)->update(dt);
-				}
-
-				break;
-			}
+		// run all updateable objects
+		for(int i=updateables.size(); --i>=0;) {
+			updateables.at(i)->update(dt);
 		}
 
 		// the application's onRun will be invoked every frame
 	return;
 }
 
-
-
-
-
-void Engine::startApp() {
-	assert(application != NULL);
-
-	switch(getState()) {
-		case Engine_Uninitialized: {
-			if (application) {
-				application->onInit();
-			}
-
-			state = Engine_Background;
-
-			break;
-		}
-
-		default: {
-			break;
-		}
-	}
-
-	return;
-}
-
-
-void Engine::enterBackground() {
-	assert(application != NULL);
-
-	switch(getState()) {
-		case Engine_Running: {
-			if (application != NULL) {
-				application->onEnterBackground();
-			}
-
-			state = Engine_Background;
-
-			break;
-		}
-
-		default: {
-			break;
-		}
-	}
-
-	return;
-}
-
-
-void Engine::enterForeground() {
-	assert(application != NULL);
-
-	switch(getState()) {
-		case Engine_Background: {
-			if (application != NULL) {
-				application->onEnterForeground();
-			}
-
-			state = Engine_Running;
-
-			break;
-		}
-
-		default: {
-			break;
-		}
-	}
-
-	return;
-}
-
-
-void Engine::suspendApp() {
-	assert(application != NULL);
-
-	switch(getState()) {
-		case Engine_Running: {
-			enterBackground();
-
-			// NOBR
-		}
-
-		case Engine_Background: {
-			if (application) {
-				application->onSuspend();
-			}
-
-			state = Engine_Suspended;
-
-			break;
-		}
-
-		default: {
-			break;
-		}
-	}
-
-	return;
-}
-
-
-void Engine::resumeSuspendedApp() {
-	assert(application != NULL);
-
-	switch(getState()) {
-		case Engine_Suspended: {
-			if (application) {
-				application->onResumeSuspended();
-			}
-
-			state = Engine_Background;
-
-			break;
-		}
-
-		default: {
-			break;
-		}
-	}
-
-	return;
-}

src/core/wiesel/engine.h

 
 
 	/**
-	 * @brief manages the current state of the application.
-	 */
-	enum EngineState
-	{
-		Engine_Uninitialized,		//<! The initial state of the engine before initialization.
-		Engine_Running,				//<! The engine was initialized and is running.
-		Engine_Background,			//<! The engine is running in background
-		Engine_Suspended,			//<! The engine was suspended - no update or render calls will be invoked.
-	};
-
-
-
-	/**
 	 * @brief An interface to the game engine.
 	 */
 	class WIESEL_CORE_EXPORT Engine {
 		 */
 		void unregisterUpdateable(IUpdateable *updateable);
 
-	// public methods
-	public:
-		/**
-		 * @brief get the engine's current state.
-		 */
-		inline EngineState getState() const {
-			return state;
-		}
-
-	// application control
-	protected:
-		/**
-		 * @brief start the application, when application state is \ref Application_Uninitialized.
-		 * Fails, if no application is available.
-		 * In other states, this method will have no effect.
-		 */
-		void startApp();
-
-		/**
-		 * @brief the application will enter the background.
-		 */
-		void enterBackground();
-
-		/**
-		 * @brief the application will enter the foreground.
-		 */
-		void enterForeground();
-
-		/**
-		 * @brief suspends a running application.
-		 * Fails, if no application is available.
-		 * In other states, this method will have no effect.
-		 */
-		void suspendApp();
-
-		/**
-		 * @brief resumes a suspended application.
-		 * Fails, if no application is available.
-		 * In other states, this method will have no effect.
-		 * After resuming, the application is in the Background state.
-		 */
-		void resumeSuspendedApp();
-
 	// static members
 	private:
 		static WIESEL_CORE_EXPORT Engine	instance;
 	private:
 		std::vector<IUpdateable*>		updateables;
 
-		EngineState						state;
 		bool							exit_requested;
 
 		std::vector<Platform*>			platforms;