vecs
Fast, flexible ecs in C++ with ergonomic API
Loading...
Searching...
No Matches
vecs::Bundle< Components > Struct Template Reference

A collection of components grouped together as a single bundle. More...

#include <bundle.h>

Inheritance diagram for vecs::Bundle< Components >:
vecs::TagBundle

Public Member Functions

constexpr Bundle (Components &&... components)
 Constructs a Bundle with the given components.
 

Public Attributes

std::tuple< Components... > components
 A tuple holding the components in the bundle.
 

Detailed Description

template<typename... Components>
struct vecs::Bundle< Components >

A collection of components grouped together as a single bundle.

The Bundle struct allows multiple components to be grouped and inserted into entities in a single operation, simplifying entity initialization and reducing repetitive code. Bundles are useful for defining default component configurations, such as commonly used entity setups.

Template Parameters
ComponentsThe types of components in the bundle.

Constructor & Destructor Documentation

◆ Bundle()

template<typename... Components>
vecs::Bundle< Components >::Bundle ( Components &&... components)
inlineconstexpr

Constructs a Bundle with the given components.

Parameters
componentsThe components to include in the bundle, which are forwarded to the tuple.

Example usage:

struct Camera3dBundle: Bundle<ProjectionMatrix, Transform, Camera> {
Camera3dBundle() :
Bundle(ProjectionMatrix::new_3d(...), Transform {}, Camera {}) {}
};
world.spawn().insert(Camera3dBundle {});
A collection of components grouped together as a single bundle.
Definition vecs.h:171

The documentation for this struct was generated from the following files: