aboutsummaryrefslogtreecommitdiffstats
path: root/view.hpp
blob: 29915fd11f221ebc25ab1894b31ee862e0aa3312 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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