wavelength 1.0.0
Loading...
Searching...
No Matches
gemslice.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "game/pitchgem.h"
6
13class GemSlice {
14public:
22
31 GemSlice(const std::vector<PitchGem> *pGems, int nOffset);
32
40
49 GemSlice &operator=(const GemSlice &other);
50
58 int Size() const {
59 return mGems != nullptr ? static_cast<int>(mGems->size()) : 0;
60 }
61
70 const PitchGem &At(int nIndex) const {
71 return mGems->at(nIndex);
72 }
73
82 int TickAt(int nIndex) const {
83 return At(nIndex).GetTick() + mOffset;
84 }
85
87 int GetOffset() const {
88 return mOffset;
89 }
90
91private:
92 const std::vector<PitchGem> *mGems;
93 int mOffset;
94};
const PitchGem & At(int nIndex) const
Report the gem at an index.
Definition gemslice.h:70
GemSlice()
Construct a view of no gems.
GemSlice & operator=(const GemSlice &other)
Copy another view.
~GemSlice()
Release the view.
int GetOffset() const
Definition gemslice.h:87
int Size() const
Report the number of gems.
Definition gemslice.h:58
GemSlice(const std::vector< PitchGem > *pGems, int nOffset)
Construct a view of the gems of a bar.
int TickAt(int nIndex) const
Report the tick of the gem at an index, moved to the bar the song plays.
Definition gemslice.h:82
One gem of a pitch track.
Definition pitchgem.h:8
int GetTick() const
Definition pitchgem.h:36