Lugdunum  0.1.0
Application.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 
5 #include <lug/Core/Export.hpp>
6 #include <lug/Core/Version.hpp>
9 #include <lug/System/Time.hpp>
10 
11 namespace lug {
12 namespace Core {
13 
21 public:
22  struct Info {
23  std::string name;
25  };
26 
27 public:
28  explicit Application(const Info& info);
29 
30  Application(const Application&) = delete;
31  Application(Application&&) = delete;
32 
33  Application& operator=(const Application&) = delete;
34  Application& operator=(Application&&) = delete;
35 
36  virtual ~Application() = default;
37 
43  const Application::Info& getInfo() const;
44 
50  lug::Graphics::Graphics& getGraphics();
51  const lug::Graphics::Graphics& getGraphics() const;
52 
58  lug::Graphics::Render::Window* getWindow();
59  const lug::Graphics::Render::Window* getWindow() const;
60 
66  void setRenderWindowInfo(lug::Graphics::Render::Window::InitInfo& initInfo);
67 
73  const lug::Graphics::Render::Window::InitInfo& getRenderWindowInfo() const;
74  lug::Graphics::Render::Window::InitInfo& getRenderWindowInfo();
75 
81  void setGraphicsInfo(const lug::Graphics::Graphics::InitInfo& initInfo);
82 
88  const lug::Graphics::Graphics::InitInfo& getGraphicsInfo() const;
89  lug::Graphics::Graphics::InitInfo& getGraphicsInfo();
90 
103  bool init(int argc, char* argv[]);
104 
116  bool beginInit(int argc, char* argv[]);
117 
126  bool finishInit();
127 
135  bool run();
136 
142  void close();
143 
151  virtual void onEvent(const lug::Window::Event& event) = 0;
152 
158  virtual void onFrame(const System::Time& elapsedTime) = 0;
159 
160 private:
161  bool beginFrame(const lug::System::Time& elapsedTime);
162  bool endFrame();
163 
164 private:
166  bool _closed{false};
167 
168 
171  { // rendererInitInfo
172  "shaders/", // shaders root
175  },
176  { // mandatoryModules
177  lug::Graphics::Module::Type::Core
178  },
179  {}, // optionalModules
180  };
181 
183  { // windowInitInfo
184  800, // width
185  600, // height
186  "Lugdunum - Default title", // title
188  },
189 
190  {} // renderViewsInitInfo
191  };
192 
193  lug::Graphics::Render::Window* _window{nullptr};
194 
195 protected:
197 };
198 
199 
200 #include <lug/Core/Application.inl>
201 
202 } // Core
203 } // lug
Stores the version of the Application.
Definition: Version.hpp:9
Represents an event.
Definition: Event.hpp:89
lug::Graphics::Graphics _graphics
Utility structure used to initialize the Graphics component.
Definition: Graphics.hpp:30
Class for application.
Definition: Application.hpp:20
void close(Handle handle)
Definition: Library.inl:48
#define LUG_CORE_API
Definition: Export.hpp:11
Class for graphics.
Definition: Graphics.hpp:25