OGLplus  (0.59.0) a C++ wrapper for rendering APIs

main.hpp
1 
9 #ifndef OGLPLUS_EXAMPLE_MAIN_HPP // NOLINT(llvm-header-guard)
10 #define OGLPLUS_EXAMPLE_MAIN_HPP
11 
12 #include "resources.hpp"
13 
16 #include <eagine/cleanup_group.hpp>
17 #include <eagine/math/curve.hpp>
18 #include <eagine/timeout.hpp>
19 #include <oglplus/math/vector.hpp>
20 
21 namespace eagine::application {
22 //------------------------------------------------------------------------------
23 class example : public application {
24 public:
25  example(execution_context&, video_context&);
26 
27  auto is_done() noexcept -> bool final {
28  return _is_done.is_expired();
29  }
30 
31  void on_video_resize() noexcept final;
32  void update() noexcept final;
33  void clean_up() noexcept final;
34 
35  auto ctx() noexcept -> auto& {
36  return _ctx;
37  }
38 
39  auto video() noexcept -> auto& {
40  return _video;
41  }
42 
43  auto camera() noexcept -> auto& {
44  return _camera;
45  }
46 
47  auto emit_position() noexcept {
48  return _path.position(ctx().state().frame_time().value() * 0.1F);
49  }
50 
51  auto frame_duration() noexcept {
52  return ctx().state().frame_duration().value();
53  }
54 
55  operator cleanup_group&() noexcept {
56  return _cleanup;
57  }
58 
59 private:
60  cleanup_group _cleanup;
61  execution_context& _ctx;
62  video_context& _video;
63  timeout _is_done{std::chrono::seconds{60}};
64 
65  math::cubic_bezier_loop<oglp::vec3, float> _path;
66 
67  orbiting_camera _camera;
68  emit_program _emit_prog;
69  draw_program _draw_prog;
70  particles _particles;
71 };
72 
73 } // namespace eagine::application
74 
75 #endif
Application harness / wrapper code is placed in this namespace.
Definition: eagine.hpp:72

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).