text: #ifndef __APP_H__
  #define __APP_H__
  
  #include "Module.h"
  #include "PerfTimer.h"
  #include "Timer.h"
  
  #include "List.h"
  
  #include "PugiXml/src/pugixml.hpp"
  
  #define CONFIG_FILENAME		"config.xml"
  #define SAVE_STATE_FILENAME "save_game.xml"
  
  // Modules
  class Window;
  class Input;
  class Render;
  class Textures;
  class AudioManager;
  class EntityManager;
  class SceneManager;
  class Collisions;
  class Particles;
  
  class App
  {
  public:
  
  	// Constructor
  	App(int argc, char* args[]);
  
  	// Destructor
  	virtual ~App();
  
  	// Called before render is available
  	bool Awake();
  
  	// Called before the first frame
  	bool Start();
  
  	// Called each loop iteration
  	bool Update();
  
  	// Called before quitting
  	bool CleanUp();
  
  	// Add a new module to handle
  	void AddModule(Module* module);
  
  	// Exposing some properties for reading
  	int GetArgc() const;
  	const char* GetArgv(int index) const;
  	const char* GetTitle() const;
  	const char* GetOrganization() const;
  
      // L02: DONE 1: Create methods to request Load / Save
  	void LoadGameRequest();
  	void SaveGameRequest() const;
  
  	// Load config file
  	// NOTE: It receives config document
  	pugi::xml_node LoadConfig(pugi::xml_document&) const;
  
  	bool isGameSaved();
  
  private:
  
  	// Call modules before each loop iteration
  	void PrepareUpdate();
  
  	// Call modules before each loop iteration
  	void FinishUpdate();
  
  	// Call modules before each loop iteration
  	bool PreUpdate();
  
  	// Call modules on each loop iteration
  	bool DoUpdate();
  
  	// Call modules after each loop iteration
  	bool PostUpdate();
  
  	// Load / Save
  	bool LoadGame();
  	bool SaveGame() const;
  public:
  
  	// Modules
  	Window* win = nullptr;
  	Input* input = nullptr;
  	Render* render = nullptr;
  	Textures* tex = nullptr;
  	AudioManager* audio = nullptr;
  	EntityManager* entityManager = nullptr;
  	SceneManager* sceneManager = nullptr;
  	Collisions* collisions = nullptr;
  	Particles* particles = nullptr;
  
  private:
  
  	int argc = 0;
  	char** args = nullptr;
  	SString title = "";
  	SString organization = "";
  
  	List<Module *> modules;
  
  	// L01: DONE 2: Create new variables from pugui namespace
  	// NOTE: Redesigned LoadConfig() to avoid storing this variables
  	//pugi::xml_document configFile;
  	//pugi::xml_node config;
  	//pugi::xml_node configApp;
  
  	mutable bool saveGameRequested = false;
  	bool loadGameRequested = false;
  
  	// L07: DONE 4: Calculate some timing measures
  	// required variables are provided:
  	PerfTimer ptimer;
  	uint64 frameCount = 0;
  
  	Timer startupTime;
  	Timer frameTime;
  	Timer lastSecFrameTime;
  	uint32 lastSecFrameCount = 0;
  	uint32 prevLastSecFrameCount = 0;
  
  	float dt = 0.0f;
  
  	bool capTo30fps = false;
  
  	int	cappedMs = -1;
  };
  
  #endif	// __APP_H__