axmol/extensions/fairygui/display/FUISprite.h

67 lines
1.6 KiB
C
Raw Normal View History

2020-08-04 12:31:33 +08:00
#ifndef __FUISPRITE_H__
#define __FUISPRITE_H__
#include "cocos2d.h"
#include "FairyGUIMacros.h"
NS_FGUI_BEGIN
2022-08-08 18:02:17 +08:00
class FUISprite : public ax::Sprite
2020-08-04 12:31:33 +08:00
{
public:
FUISprite();
virtual ~FUISprite();
CREATE_FUNC(FUISprite);
void clearContent();
2022-08-08 18:02:17 +08:00
void setScale9Grid(ax::Rect* value);
2020-08-04 12:31:33 +08:00
void setGrayed(bool value);
FillMethod getFillMethod() const { return _fillMethod; }
void setFillMethod(FillMethod value);
FillOrigin getFillOrigin() const { return _fillOrigin; }
void setFillOrigin(FillOrigin value);
bool isFillClockwise() const { return _fillClockwise; }
void setFillClockwise(bool value);
float getFillAmount() const { return _fillAmount; }
void setFillAmount(float value);
bool isScaleByTile() const { return _scaleByTile; }
void setScaleByTile(bool value);
2022-08-08 18:02:17 +08:00
virtual void setContentSize(const ax::Size& size) override;
2020-08-04 12:31:33 +08:00
protected:
2022-08-08 18:02:17 +08:00
virtual void draw(ax::Renderer *renderer, const ax::Mat4 &transform, uint32_t flags) override;
2020-08-04 12:31:33 +08:00
2022-08-08 18:02:17 +08:00
ax::Tex2F textureCoordFromAlphaPoint(ax::Vec2 alpha);
ax::Vec3 vertexFromAlphaPoint(ax::Vec2 alpha);
2020-08-04 12:31:33 +08:00
void updateBar(void);
void updateRadial(void);
virtual void updateColor(void) override;
2022-08-08 18:02:17 +08:00
ax::Vec2 boundaryTexCoord(char index);
2020-08-04 12:31:33 +08:00
void setupFill();
private:
FillMethod _fillMethod;
FillOrigin _fillOrigin;
float _fillAmount;
bool _fillClockwise;
bool _scaleByTile;
int _vertexDataCount;
2022-08-08 18:02:17 +08:00
ax::TrianglesCommand::Triangles _fillTriangles;
ax::V3F_C4B_T2F *_vertexData;
2020-08-04 12:31:33 +08:00
unsigned short *_vertexIndex;
2022-08-08 18:02:17 +08:00
static ax::Texture2D* _empty;
2020-08-04 12:31:33 +08:00
};
NS_FGUI_END
#endif