diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2024-08-10 10:46:54 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2024-08-10 10:46:54 -0400 |
commit | 00f84e3b984904e36cbee502a470003ecd7d09cf (patch) | |
tree | 48836b7af6dc55724f789a75ebed4a7ce01be5fc /view.hpp | |
parent | e6dfad81f8c893f95fe2922a075b82e2d262bde2 (diff) |
initial upload
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 + |