To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / CollidoscopeApp / include / Chunk.h @ 0:02467299402e
History | View | Annotate | Download (1.08 KB)
| 1 | 0:02467299402e | f | |
|---|---|---|---|
| 2 | #pragma once
|
||
| 3 | |||
| 4 | #include "cinder/Color.h" |
||
| 5 | #include "cinder/gl/Batch.h" |
||
| 6 | |||
| 7 | class DrawInfo; |
||
| 8 | |||
| 9 | class Chunk |
||
| 10 | {
|
||
| 11 | |||
| 12 | public:
|
||
| 13 | |||
| 14 | const static float kWidth; |
||
| 15 | const static float kHalfWidth; |
||
| 16 | |||
| 17 | Chunk( size_t index ); |
||
| 18 | |||
| 19 | void inline setTop(float t) { mAudioTop = t; mAnimate = 0.0f; mResetting = false; /* startes the animation to crate a chunk */ } |
||
| 20 | void inline setBottom(float b) { mAudioBottom = b; mAnimate = 0.0f; mResetting = false; } |
||
| 21 | float inline getTop() const { return mAudioTop; } |
||
| 22 | float inline getBottom() const { return mAudioBottom; } |
||
| 23 | |||
| 24 | void reset(){
|
||
| 25 | mResetting = true;
|
||
| 26 | } |
||
| 27 | |||
| 28 | void update( const DrawInfo& di ); |
||
| 29 | |||
| 30 | void draw( const DrawInfo& di, ci::gl::BatchRef &batch ); |
||
| 31 | |||
| 32 | void drawBar( const DrawInfo& di, ci::gl::BatchRef &batch ); |
||
| 33 | |||
| 34 | void setAsSelectionStart(bool start){ |
||
| 35 | isSelectionStart = start; |
||
| 36 | } |
||
| 37 | |||
| 38 | void setAsSelectionEnd(bool end){ |
||
| 39 | isSelectionEnd = end; |
||
| 40 | } |
||
| 41 | |||
| 42 | private:
|
||
| 43 | |||
| 44 | float mAudioTop;
|
||
| 45 | float mAudioBottom;
|
||
| 46 | |||
| 47 | float mX;
|
||
| 48 | |||
| 49 | float mAnimate = 1.0; |
||
| 50 | int mIndex;
|
||
| 51 | |||
| 52 | bool isSelectionStart = false; |
||
| 53 | bool isSelectionEnd = false; |
||
| 54 | |||
| 55 | bool mResetting = false; |
||
| 56 | |||
| 57 | }; |