ProjectBuildSettings.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include <Atomic/Core/Object.h>
  24. #include <Atomic/Resource/JSONValue.h>
  25. using namespace Atomic;
  26. namespace ToolCore
  27. {
  28. class MacBuildSettings : public RefCounted
  29. {
  30. ATOMIC_REFCOUNTED(MacBuildSettings)
  31. public:
  32. MacBuildSettings() {}
  33. const String& GetAppName() const { return appName_; }
  34. const String& GetPackageName() const { return packageName_; }
  35. const String& GetCompanyName() const { return companyName_; }
  36. const String& GetProductName() const { return productName_; }
  37. void SetAppName(const String& name) { appName_ = name; }
  38. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  39. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  40. void SetProductName(const String& productName) { productName_ = productName; }
  41. void Write(JSONValue& parent);
  42. void Read(JSONValue& parent);
  43. private:
  44. String appName_;
  45. String packageName_;
  46. String companyName_;
  47. String productName_;
  48. };
  49. class WebBuildSettings : public RefCounted
  50. {
  51. ATOMIC_REFCOUNTED(WebBuildSettings)
  52. public:
  53. WebBuildSettings()
  54. {
  55. pageTheme_ = 0;
  56. gameWidth_ = "800";
  57. gameHeight_ = "512";
  58. }
  59. const String& GetAppName() const { return appName_; }
  60. const String& GetGameWidth() const { return gameWidth_; }
  61. const String& GetGameHeight() const { return gameHeight_; }
  62. const String& GetFaviconName() const { return faviconName_; }
  63. int GetPageTheme() const { return pageTheme_; }
  64. void SetAppName(const String& name) { appName_ = name; }
  65. void SetGameWidth(const String& packageName) { gameWidth_ = packageName; }
  66. void SetGameHeight(const String& companyName) { gameHeight_ = companyName; }
  67. void SetFaviconName(const String& productName) { faviconName_ = productName; }
  68. void SetPageTheme( int number ) { pageTheme_ = number; }
  69. void Write(JSONValue& parent);
  70. void Read(JSONValue& parent);
  71. private:
  72. String appName_;
  73. String gameWidth_;
  74. String gameHeight_;
  75. String faviconName_;
  76. int pageTheme_;
  77. };
  78. class WindowsBuildSettings : public RefCounted
  79. {
  80. ATOMIC_REFCOUNTED(WindowsBuildSettings)
  81. public:
  82. WindowsBuildSettings() {}
  83. const String& GetAppName() const { return appName_; }
  84. const String& GetPackageName() const { return packageName_; }
  85. const String& GetCompanyName() const { return companyName_; }
  86. const String& GetProductName() const { return productName_; }
  87. void SetAppName(const String& name) { appName_ = name; }
  88. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  89. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  90. void SetProductName(const String& productName) { productName_ = productName; }
  91. void Write(JSONValue& parent);
  92. void Read(JSONValue& parent);
  93. private:
  94. String appName_;
  95. String packageName_;
  96. String companyName_;
  97. String productName_;
  98. };
  99. class AndroidBuildSettings : public RefCounted
  100. {
  101. ATOMIC_REFCOUNTED(AndroidBuildSettings)
  102. public:
  103. AndroidBuildSettings() {}
  104. const String& GetAppName() const { return appName_; }
  105. const String& GetPackageName() const { return packageName_; }
  106. const String& GetCompanyName() const { return companyName_; }
  107. const String& GetProductName() const { return productName_; }
  108. const String& GetSDKVersion() const { return targetSDKVersion_; }
  109. const String& GetMinSDKVersion() const { return minSDKVersion_; }
  110. const String& GetActivityName() const { return activityName_; }
  111. const String& GetIconPath() const { return iconPath_; }
  112. void SetAppName(const String& name) { appName_ = name; }
  113. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  114. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  115. void SetProductName(const String& productName) { productName_ = productName; }
  116. void SetSDKVersion(const String& value) { targetSDKVersion_ = value; }
  117. void SetMinSDKVersion(const String& value) { minSDKVersion_ = value; }
  118. void SetActivityName(const String& value) { activityName_ = value; }
  119. void SetIconPath(const String& value) { iconPath_ = value; }
  120. void Write(JSONValue& parent);
  121. void Read(JSONValue& parent);
  122. private:
  123. String appName_;
  124. String packageName_;
  125. String companyName_;
  126. String productName_;
  127. String targetSDKVersion_;
  128. String minSDKVersion_;
  129. String activityName_;
  130. String iconPath_;
  131. };
  132. class IOSBuildSettings : public RefCounted
  133. {
  134. ATOMIC_REFCOUNTED(IOSBuildSettings)
  135. public:
  136. IOSBuildSettings() {}
  137. const String& GetAppName() const { return appName_; }
  138. const String& GetPackageName() const { return packageName_; }
  139. const String& GetCompanyName() const { return companyName_; }
  140. const String& GetProductName() const { return productName_; }
  141. const String& GetProvisionFile() const { return provisionFile_; }
  142. const String& GetAppIDPrefix() const { return appidPrefix_; }
  143. void SetAppName(const String& name) { appName_ = name; }
  144. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  145. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  146. void SetProductName(const String& productName) { productName_ = productName; }
  147. void SetProvisionFile(const String& value) { provisionFile_ = value; }
  148. void SetAppIDPrefix(const String& value) { appidPrefix_ = value; }
  149. void Write(JSONValue& parent);
  150. void Read(JSONValue& parent);
  151. private:
  152. String appName_;
  153. String packageName_;
  154. String companyName_;
  155. String productName_;
  156. String provisionFile_;
  157. String appidPrefix_;
  158. };
  159. class LinuxBuildSettings : public RefCounted
  160. {
  161. ATOMIC_REFCOUNTED(LinuxBuildSettings)
  162. public:
  163. LinuxBuildSettings() {}
  164. const String& GetAppName() const { return appName_; }
  165. const String& GetPackageName() const { return packageName_; }
  166. const String& GetCompanyName() const { return companyName_; }
  167. const String& GetProductName() const { return productName_; }
  168. void SetAppName(const String& name) { appName_ = name; }
  169. void SetPackageName(const String& packageName) { packageName_ = packageName; }
  170. void SetCompanyName(const String& companyName) { companyName_ = companyName; }
  171. void SetProductName(const String& productName) { productName_ = productName; }
  172. void Write(JSONValue& parent);
  173. void Read(JSONValue& parent);
  174. private:
  175. String appName_;
  176. String packageName_;
  177. String companyName_;
  178. String productName_;
  179. };
  180. class ProjectBuildSettings : public Object
  181. {
  182. ATOMIC_OBJECT(ProjectBuildSettings, Object);
  183. public:
  184. /// Construct.
  185. ProjectBuildSettings(Context* context);
  186. /// Destruct.
  187. virtual ~ProjectBuildSettings();
  188. MacBuildSettings* GetMacBuildSettings() { return macBuildSettings_; }
  189. WindowsBuildSettings* GetWindowsBuildSettings() { return windowsBuildSettings_; }
  190. WebBuildSettings* GetWebBuildSettings() { return webBuildSettings_; }
  191. AndroidBuildSettings* GetAndroidBuildSettings() { return androidBuildSettings_; }
  192. IOSBuildSettings* GetIOSBuildSettings() { return iosBuildSettings_; }
  193. LinuxBuildSettings* GetLinuxBuildSettings() { return linuxBuildSettings_; }
  194. bool Load(const String& path);
  195. void Save(const String& path);
  196. private:
  197. SharedPtr<MacBuildSettings> macBuildSettings_;
  198. SharedPtr<WindowsBuildSettings> windowsBuildSettings_;
  199. SharedPtr<WebBuildSettings> webBuildSettings_;
  200. SharedPtr<AndroidBuildSettings> androidBuildSettings_;
  201. SharedPtr<IOSBuildSettings> iosBuildSettings_;
  202. SharedPtr<LinuxBuildSettings> linuxBuildSettings_;
  203. };
  204. }