AnimEngine
Application.hpp
1 #pragma once
2 #ifndef ANIM_PROJECT1_APPLICATION_HPP_
3 #define ANIM_PROJECT1_APPLICATION_HPP_
4 #define GLFW_INCLUDE_NONE
5 #include <GLFW/glfw3.h>
6 #include "world/Scene.hpp"
7 #include "systems/AnimationSystem.hpp"
8 #include "systems/RenderSystem.hpp"
9 #include <string>
10 #include <vector>
11 
12 
13 class StartupState {
14  public:
15  StartupState() = default;
16  StartupState(int argc, char** argv);
17 
18  virtual void parseArgs(int argc, char** argv);
19 
20  virtual const std::string& helpStr() const;
21 
22  virtual void postValidate();
23 
24  virtual std::vector<std::string>::iterator parseOption(
25  std::vector<std::string>::iterator carg,
26  const std::vector<std::string>& args);
27 
28  virtual std::vector<std::string>::iterator parseInput(
29  std::vector<std::string>::iterator carg,
30  const std::vector<std::string>& args);
31 
32  bool developer_mode = false;
33  double framerate = -1;
34  std::string renderOutputPath;
35  std::vector<std::string> inputPaths;
36 
37  protected:
38 };
39 
40 class Application {
41  public:
42  static Application& getInstance(){
43  static Application instance;
44  return(instance);
45  }
46 
47  void init(int argc, char** argv);
48  void run();
49  void cleanup();
50 
51  void runRealtime();
52  void runRender(const std::string& aOutputDir, double aFramerate = 24.0);
53 
54  const GLFWwindow* getWindow() const { return (mWindow); }
55 
56  bool shouldExit() const;
57 
58  Application(Application const&) = delete;
59  void operator=(Application const&) = delete;
60 
61  protected:
62  Application(){}
63 
64  void initGL();
65  void initGLFW();
66  void initShaders();
67  void initScene();
68 
69  void doSceneFrame(Scene& scene, Animation_System* animationSystem, Render_System* renderSystem);
70 
71  void initPanelAlphas();
72  void initPanelPortals(Scene& aShot);
73 
74  std::vector<Scene> shots;
75 
76  GLuint mPanelOutline = 0;
77  std::vector<GLuint> mPanelMasks;
78 
79  struct Configuration{
80  StartupState startup_state;
81  int w_width = 853;
82  int w_height = 480;
83  } config;
84 
85  bool mShouldExit = false;
86  GLFWwindow* mWindow = nullptr;
87 };
88 
89 #endif
Definition: AnimationSystem.hpp:9
Definition: RenderSystem.hpp:10
Definition: Application.hpp:79
Definition: Application.hpp:40
Definition: Application.hpp:13
Definition: Scene.hpp:12