You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
437 B
C++
30 lines
437 B
C++
#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
|
|
|