1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
#ifndef COLOR_POOL_INCLUDED
#define COLOR_POOL_INCLUDED
#include "GridSpace.h"
class ColorPool {
public:
// constructs w/ center location on screen
ColorPool( int inX, int inY );
~ColorPool();
// gets a color from the pool
// set index of -1 (default) to pick a random color
// color is copied
Color *pickColor( int inIndex = -1 );
// gets the symbol for a color
char getColorblindSymbol( Color *inColor );
// gets the index number of a given color
// returns -1 if not found or if color NULL
int getColorIndex( Color *inColor );
void saveState();
// gets state that can be saved to disk
// can be NULL if no saved state
// copied to caller
char *getSavedState();
void restoreFromSavedState( char *inSavedState );
void registerMove();
// undoes move registration
// this is a hack that doesn't work across color addition
// however, this is okay, because transitions always happen after
// an even number of moves, and we only allow undo of the odd moves
void deRegisterMove();
int getLevel() {
return mLevel;
}
// steps animations
void step();
// draws onto screen
void draw( float inAlpha = 1.0f );
int mX, mY;
private:
GridSpace *mSpaces[7];
char mSomeMovesMade;
int mStartingActiveColors;
int mNumActiveColors;
int mColorsToSkip;
char mEndPhase;
char mEndPhaseFirstColor;
int mStepsBetweenUpdates;
int mStepsUntilUpdate;
int mLastStepCount;
float mStepCountTransitionProgress;
// if in the middle of deregistering a move
char mRewinding;
int mLevel;
char *mSavedState;
};
#endif
|