Project.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #include <Atomic/Core/Object.h>
  8. #include <Atomic/IO/FileSystem.h>
  9. using namespace Atomic;
  10. #include "../Platform/Platform.h"
  11. namespace ToolCore
  12. {
  13. class ProjectUserPrefs;
  14. class ProjectBuildSettings;
  15. class Project : public Object
  16. {
  17. friend class ProjectFile;
  18. OBJECT(Project);
  19. public:
  20. /// Construct.
  21. Project(Context* context);
  22. /// Destruct.
  23. virtual ~Project();
  24. bool Load(const String& fullpath);
  25. void Save(const String& fullpath = "");
  26. /// Paths
  27. const String& GetResourcePath() { return resourcePath_; }
  28. void SetResourcePath(const String& resourcePath)
  29. {
  30. resourcePath_ = AddTrailingSlash(resourcePath);
  31. componentsPath_ = resourcePath_ + "Components";
  32. scriptsPath_ = resourcePath_ + "Scripts";
  33. modulesPath_ = resourcePath_ + "Modules";
  34. }
  35. const String& GetComponentsPath() { return componentsPath_; }
  36. const String& GetScriptsPath() { return scriptsPath_; }
  37. const String& GetModulesPath() { return modulesPath_; }
  38. bool IsComponentsDirOrFile(const String& fullPath);
  39. bool IsScriptsDirOrFile(const String& fullPath);
  40. bool IsModulesDirOrFile(const String& fullPath);
  41. void AddPlatform(PlatformID platformID);
  42. bool ContainsPlatform(PlatformID platformID);
  43. void RemovePlatform(PlatformID platformID);
  44. bool IsDirty() { return dirty_; }
  45. void SetDirty() { if (!loading_) dirty_ = true; }
  46. ProjectBuildSettings* GetBuildSettings() { return buildSettings_; }
  47. ProjectUserPrefs* GetUserPrefs() { return userPrefs_; }
  48. const String& GetProjectPath() const { return projectPath_; }
  49. const String& GetProjectFilePath() { return projectFilePath_; }
  50. String GetUserPrefsFullPath();
  51. String GetBuildSettingsFullPath();
  52. const String& GetVersion() { return version_; }
  53. void SetVersion(const String& version) { version_ = version; }
  54. void SaveBuildSettings();
  55. bool LoadBuildSettings();
  56. void SaveUserPrefs();
  57. bool LoadUserPrefs();
  58. private:
  59. String version_;
  60. String projectPath_;
  61. String projectFilePath_;
  62. String resourcePath_;
  63. String componentsPath_;
  64. String scriptsPath_;
  65. String modulesPath_;
  66. bool loading_;
  67. bool dirty_;
  68. SharedPtr<ProjectUserPrefs> userPrefs_;
  69. SharedPtr<ProjectBuildSettings> buildSettings_;
  70. List<PlatformID> platforms_;
  71. };
  72. }