wavelength 1.0.0
Loading...
Searching...
No Matches
beampool.h
Go to the documentation of this file.
1#pragma once
2
3#include "gfx/beam.h"
4#include "gfx/beamparams.h"
5#include "gfx/fxpool.h"
6#include "rnd/rnddrawable.h"
7#include "script/dataarray.h"
8
16template <bool bArg>
17class BeamPool : public FxPool<Beam, bArg> {
18public:
28 BeamPool(int nCount, RndDrawable *pParent, const char *pszName)
29 : FxPool<Beam, bArg>(nCount), mParams(pszName) {
30 for (Beam *pBeam = this->mItems.get(); pBeam != this->mItems.get() + this->mCount;
31 ++pBeam) {
32 pParent->AddDraw(pBeam->GetLine(), nullptr);
33 }
34 }
35
42 ~BeamPool() override = default;
43
54 void LoadConfig(DataArray *pConfig, DataArray *pDefaults, bool bReload, float fScale) {
55 mParams.Load(pConfig, pDefaults, bReload, fScale);
56 for (Beam *pBeam = this->mItems.get(); pBeam != this->mItems.get() + this->mCount;
57 ++pBeam) {
58 pBeam->Configure(&mParams);
59 }
60 }
61
62private:
63 BeamParams mParams;
64};
Look of a family of beams, read from the configuration entry of its name.
Definition beamparams.h:15
BeamPool(int nCount, RndDrawable *pParent, const char *pszName)
Construct a pool and draw every beam under a parent.
Definition beampool.h:28
~BeamPool() override=default
Destroy the pool.
void LoadConfig(DataArray *pConfig, DataArray *pDefaults, bool bReload, float fScale)
Read the look of the beams and give it to every beam.
Definition beampool.h:54
Beam a ship fires at a gem, a line that two waves ripple along.
Definition beam.h:20
Reference-counted array of script data nodes.
Definition dataarray.h:20
std::unique_ptr< Beam[]> mItems
Definition fxpool.h:134
FxPool(int nCount)
Definition fxpool.h:24
Mix-in for an object that draws itself and then a list of other drawables.
Definition rnddrawable.h:16