Something went wrong. Try again.
Massive multiplayer game aiming to create a collaborative musical environment.
Something went wrong. Try again.
5.3 kB · 190 lines
at master
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191/*********************************************************************** Vector2***********************************************************************/class Vector2{ // rename 'd_x' and 'd_y' to just 'x' and 'y' float d_x @ x; float d_y @ y;
Vector2 operator+ (const Vector2& vec) const; Vector2 operator- (const Vector2& vec) const; Vector2 operator* (const Vector2& vec) const; bool operator== (const Vector2& vec) const;
Vector2(); Vector2(float x, float y);};
// do a simple copy of Point to Vector2$[CEGUI.Point = CEGUI.Vector2$]
/*********************************************************************** Size***********************************************************************/class Size{ // rename 'd_width' and 'd_height' to just 'width' and 'height' float d_width @ width; float d_height @ height;
bool operator== (const Size& sz) const;
Size(); Size(float w, float h);};
/*********************************************************************** Rect***********************************************************************/class Rect{ // remove member variable 'd_' prefix float d_top @ top; float d_bottom @ bottom; float d_left @ left; float d_right @ right;
Vector2 getPosition() const; float getWidth() const; float getHeight() const; Size getSize() const;
Rect getIntersection(const Rect& rect) const; bool isPointInRect(const Vector2& p) const;
void setPosition(const Vector2& p); void setWidth(float w); void setHeight(float h); void setSize(const Size& sz);
Rect& offset(const Vector2& p); Rect& constrainSizeMax(const Size& sz); Rect& constrainSizeMin(const Size& sz); Rect& constrainSize(const Size& min, const Size& max);
bool operator== (const Rect& r) const;
Rect(); Rect(float l, float t, float r, float b);};
/*********************************************************************** colour***********************************************************************/class colour{ float getAlpha() const; float getRed() const; float getGreen() const; float getBlue() const; float getHue() const; float getSaturation() const; float getLumination() const;
void set(float r, float g, float b, float a); void setAlpha(float a); void setRed(float r); void setGreen(float g); void setBlue(float b); void setRGB(float r, float g, float b); void setHSL(float hue, float saturation, float luminance, float alpha=1);
colour operator+ (const colour& c) const; colour operator- (const colour& c) const; //colour operator* (const colour& c) const; // gives a warning about argb_t to colour conversion bool operator== (const colour& c) const;
colour(); colour(float r, float g, float b, float a);};
/*********************************************************************** ColourRect***********************************************************************/class ColourRect{ colour d_top_left @ top_left; colour d_top_right @ top_right; colour d_bottom_left @ bottom_left; colour d_bottom_right @ bottom_right;
void setAlpha(float alpha); void setTopAlpha(float alpha); void setBottomAlpha(float alpha); void setLeftAlpha(float alpha); void setRightAlpha(float alpha); void modulateAlpha(float alpha);
void setColours(const colour& col);
bool isMonochromatic() const;
ColourRect getSubRectangle( float left, float right, float top, float bottom ) const; colour getColourAtPoint( float x, float y ) const;
//ColourRect& operator*= (const ColourRect& other); // no support for *= operators
ColourRect(); ColourRect(const colour& col); ColourRect(const colour& top_left, const colour& top_right, const colour& bottom_left, const colour& bottom_right);};
/************************************************************************ String*************************************************************************/class String{ static const unsigned long npos;
unsigned long size() const; unsigned long length() const; bool empty() const; unsigned long capacity() const;
unsigned long& operator[] (unsigned long i); unsigned long& at(unsigned long i); string c_str() const;
void reserve(unsigned long num=0); void resize(unsigned long num); void resize(unsigned long num, unsigned long codepoint);
void clear(); String& erase(); // default len is different from usual to handle ambiguity issue String& erase(unsigned long idx, unsigned long len=1);
String& replace(unsigned long begin, unsigned long len, const String&s); //String& replace(unsigned long begin, unsigned long len, unsigned long codepoint);
void swap(String& s); String& insert(unsigned long pos, const String& s); //String& insert(unsigned long pos, unsigned long codepoint);
unsigned long find(unsigned long codepoint, unsigned long idx=0) const; unsigned long rfind(unsigned long codepoint, unsigned long idx=-1) const; unsigned long find(const String& sub, unsigned long idx=0) const; unsigned long rfind(const String& sub, unsigned long idx=-1) const;
String substr(unsigned long idx=0, unsigned long len=-1) const;
void push_back(unsigned long codepoint);
String(); String(unsigned long num, unsigned long codepoint); String(string s); String(const String& s);};