aboutsummaryrefslogtreecommitdiffstats
path: root/view.hpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2024-08-10 10:46:54 -0400
committerClyne Sullivan <clyne@bitgloo.com>2024-08-10 10:46:54 -0400
commit00f84e3b984904e36cbee502a470003ecd7d09cf (patch)
tree48836b7af6dc55724f789a75ebed4a7ce01be5fc /view.hpp
parente6dfad81f8c893f95fe2922a075b82e2d262bde2 (diff)
initial upload
Diffstat (limited to 'view.hpp')
-rw-r--r--view.hpp29
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
+