2020-08-04 12:31:33 +08:00
|
|
|
#ifndef __GGRAPH_H__
|
|
|
|
#define __GGRAPH_H__
|
|
|
|
|
|
|
|
#include "FairyGUIMacros.h"
|
|
|
|
#include "GObject.h"
|
|
|
|
#include "cocos2d.h"
|
|
|
|
|
|
|
|
NS_FGUI_BEGIN
|
|
|
|
|
|
|
|
class GGraph : public GObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GGraph();
|
|
|
|
virtual ~GGraph();
|
|
|
|
|
|
|
|
CREATE_FUNC(GGraph);
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
void drawRect(float aWidth, float aHeight, int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor);
|
|
|
|
void drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor);
|
|
|
|
void drawPolygon(int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor, const ax::Vec2* points, int count);
|
|
|
|
void drawRegularPolygon(int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor, int sides, float startAngle = 0, const float* distances = nullptr, int distanceCount = 0);
|
2020-08-04 12:31:33 +08:00
|
|
|
bool isEmpty() const { return _type == 0; }
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Color3B getColor() const;
|
|
|
|
void setColor(const ax::Color3B& value);
|
2020-08-04 12:31:33 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
virtual ax::Value getProp(ObjectPropID propId) override;
|
|
|
|
virtual void setProp(ObjectPropID propId, const ax::Value& value) override;
|
2020-08-04 12:31:33 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void handleInit() override;
|
|
|
|
virtual void setup_beforeAdd(ByteBuffer* buffer, int beginPos) override;
|
|
|
|
virtual void handleSizeChanged() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateShape();
|
|
|
|
|
|
|
|
int _type;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Color4F _lineColor;
|
|
|
|
ax::Color4F _fillColor;
|
2020-08-04 12:31:33 +08:00
|
|
|
int _lineSize;
|
|
|
|
float* _cornerRadius;
|
2022-08-08 18:02:17 +08:00
|
|
|
std::vector<ax::Vec2>* _polygonPoints;
|
2020-08-04 12:31:33 +08:00
|
|
|
float _polygonPointOffset;
|
|
|
|
int _sides;
|
|
|
|
float _startAngle;
|
|
|
|
std::vector<float>* _distances;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::DrawNode* _shape;
|
2020-08-04 12:31:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_FGUI_END
|
|
|
|
|
|
|
|
#endif
|