DirectX - App Lifecycle



In this chapter, we will focus on various states of execution which is important from application point of view. A basic application includes three states of execution as given below −

  • Running
  • Suspended
  • NotRunning
App Lifecycle

NotRunning

The application always starts with NotRunning state. Whenever the user is ready to play the game, user will activate it.

Activated

Whenever the game is initialized, it moves to the activated state. After the game is activated, the game moves to running state.

Running

In this state, the game is considered to be in Running state where all the required events are running.

Suspended

Whenever user is running the game, it may happen that user will leave the game or switches into some other app. This state is defined as “Suspended” state and it consumes very little battery.

Terminate

Windows may at any time decide the game to be closed to make it available for other apps. The user may sometimes close the app permanently. At this point, the game is Terminated and is returned to NotRunning state.

Terminate

There is no explicit functionality to save the game, all you need to know is understanding the process lifecycle. Windows gives you a feature of five seconds duration before suspension and after running state to save any information which user wants to store before the game is fully suspended.

Advertisements