TDME2  1.9.200
recreatevkcache-main.cpp
Go to the documentation of this file.
1 #include <string>
2 
3 #include <tdme/tdme.h>
6 #include <tdme/engine/Engine.h>
7 #include <tdme/engine/Version.h>
10 #include <tdme/utilities/Console.h>
12 
22 
23 namespace tdme {
24 namespace tools {
25 namespace cli {
26 
27 /**
28  * Delete VK cache
29  * @author andreas.drewke
30  */
32  : public virtual Application
33 {
34 public:
35  // forbid class copy
37 
38  /**
39  * Public constructor
40  */
42  }
43 
44  /**
45  * Public denstructor
46  */
48  }
49 
50  /**
51  * Main
52  * @param argc argument count
53  * @param argv argument values
54  * @return exit code
55  */
56  inline static int main(int argc, char** argv) {
57  auto recreateVKCacheApplication = new RecreateVKCacheApplication();
58  return recreateVKCacheApplication->run(argc, argv, "Recreate VK cache Application", nullptr, Application::WINDOW_HINT_INVISIBLE);
59  }
60 
61  // overridden methods
62  void display() override {
63  Application::exit(0);
64  }
65 
66  void dispose() override {
67  Engine::getInstance()->dispose();
68  }
69 
70  void initialize() override {
71  Engine::getInstance()->initialize();
72  if (Engine::getInstance()->getGraphicsRendererType() != Renderer::RENDERERTYPE_VULKAN) {
73  Console::println("Note: recreatevkcache does not run with --vulkan, Vulkan shader cache can not get created. Exiting.");
74  Application::exit(0);
75  }
76  }
77 
78  void reshape(int32_t width, int32_t height) override {
79  Engine::getInstance()->reshape(width, height);
80  }
81 };
82 
83 };
84 };
85 };
86 
87 int main(int argc, char** argv)
88 {
89  Console::println(string("recreatevkcache ") + Version::getVersion());
90  Console::println(Version::getCopyright());
91  Console::println();
92 
93  //
94  Console::println("Deleting shader/vk folder");
95  try {
96  FileSystem::getInstance()->removePath("shader/vk", true);
97  } catch (Exception& exception) {
98  Console::println(string() + "An error occurred: " + exception.what());
99  }
100  try {
101  if (FileSystem::getInstance()->exists("shader/vk") == false) {
102  FileSystem::getInstance()->createPath("shader/vk");
103  }
104  } catch (Exception& exception) {
105  Console::println(string() + "An error occurred: " + exception.what());
106  }
107  Console::println("Creating shader/vk shader cache");
109  Console::println("Done");
110 
111  //
112  Application::exit(Application::EXITCODE_SUCCESS);
113 }
Application base class, please make sure to allocate application on heap to have correct application ...
Definition: Application.h:41
Engine main class.
Definition: Engine.h:131
File system singleton class.
Definition: FileSystem.h:17
static int main(int argc, char **argv)
Main.
void reshape(int32_t width, int32_t height) override
Console class.
Definition: Console.h:29
String tools class.
Definition: StringTools.h:22
std::exception Exception
Exception base class.
Definition: Exception.h:18
Definition: fwd-tdme.h:4
int main(int argc, char **argv)
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6