AEPreferences.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  2. // Please see LICENSE.md in repository root for license information
  3. // https://github.com/AtomicGameEngine/AtomicGameEngine
  4. #pragma once
  5. #include <Atomic/Core/Object.h>
  6. #include <Atomic/IO/FileSystem.h>
  7. using namespace Atomic;
  8. namespace AtomicEditor
  9. {
  10. class AEPreferences : public Object
  11. {
  12. OBJECT(AEPreferences);
  13. public:
  14. struct StartupPreferences
  15. {
  16. IntVector2 windowPos;
  17. int windowWidth;
  18. int windowHeight;
  19. };
  20. /// Construct.
  21. AEPreferences(Context* context);
  22. /// Destruct.
  23. ~AEPreferences();
  24. void RegisterRecentProject(const String& fullpath);
  25. const Vector<String>& GetRecentProjects() { return recentProjects_; }
  26. void SetAndroidSDKPath(const String& path) { androidSDKPath_ = path; Write(); }
  27. String GetAndroidSDKPath() { return AddTrailingSlash(androidSDKPath_); }
  28. void Read();
  29. void Write();
  30. static bool ReadStartupPrefs(Context* context, StartupPreferences& prefs);
  31. void UpdateRecentFiles(bool write = true);
  32. private:
  33. void HandleEditorShutdown(StringHash eventType, VariantMap& eventData);
  34. void Clear();
  35. String GetPreferencesFullPath();
  36. String androidSDKPath_;
  37. String lastProjectFullPath_;
  38. Vector<String> recentProjects_;
  39. };
  40. }