// CPalette.h

class BWindowScreen;

#define kNumColors	112

class CPalette {
public:
					CPalette(
						BWindowScreen		*inWindow);
					~CPalette();
	void				InitPalette();
	void				SetPen(
						uint8		inPenIndex,
						uint8		inRed,
						uint8		inGreen,
						uint8		inBlue);
	void				GetPen(
						uint8		inPenIndex,
						uint8		*outRed,
						uint8		*outGreen,
						uint8		*outBlue);
	int32			Go();

private:
	void				WaitForVBlank();
	static int32		Entry(
						void				*arg);
	int32			MainLoop();
	
	/* vars */
	static rgb_color	sInitPalette[kNumColors];
	
	thread_id			mID;
	bool				mQuitting;
	BWindowScreen		*mWindow;
	rgb_color			mColors[256];
	bool				mDirtyColor[256];
};
