diff options
Diffstat (limited to 'view.hpp')
-rw-r--r-- | view.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/view.hpp b/view.hpp new file mode 100644 index 0000000..29915fd --- /dev/null +++ b/view.hpp @@ -0,0 +1,29 @@ +#ifndef MBUOY_VIEW_HPP +#define MBUOY_VIEW_HPP + +namespace mbuoy { + +template<auto... Objs> +class view_t +{ +public: + consteval view_t() { + auto ptr = data; + (Objs.init(ptr), ...); + } + + void render() { + (Objs.render(), ...); + } + +private: + unsigned char data[(0 + ... + Objs.size())] = {}; +}; + +template<auto... Objs> +constinit auto view = view_t<Objs...>(); + +} // namespace mbuoy + +#endif // MBUOY_VIEW_HPP + |