app.h 941 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * 2D Physic Engine
  3. * app.h:
  4. * Based on pikuma.com Learn Game Physics Engine Programming course.
  5. * Copyright (c) 2022 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 07/06/2022.
  8. */
  9. #ifndef PHYSICENGINE_APP_H
  10. #define PHYSICENGINE_APP_H
  11. #include <vector>
  12. #include <SDL.h>
  13. #include <timeprobe.h>
  14. #include <physics/particle.h>
  15. class application
  16. {
  17. private:
  18. uint32_t millisecsPreviousFrame;
  19. bool running;
  20. std::vector<particle *>particles;
  21. timeProbe waitTime, renderTime, updateTime;
  22. double deltaTime;
  23. vec2 pushForce = vec2(0, 0);
  24. SDL_Rect liquid;
  25. public:
  26. application() : running(false) {};
  27. ~application() = default;
  28. void parseParameters(int argc, char *argv[]);
  29. bool isRunning() { return this->running; }
  30. void syncAndDeltatime();
  31. void setup();
  32. void input();
  33. void update();
  34. void render();
  35. void destroy();
  36. };
  37. #endif /* PHYSICENGINE_APP_H */