📄 basic.pkg
字号:
/***********************************************************************
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);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -