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
class FUISprite : public axis::Sprite
2020-08-04 12:31:33 +08:00
{
public:
FUISprite();
virtual ~FUISprite();
CREATE_FUNC(FUISprite);
void clearContent();
void setScale9Grid(axis::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);
virtual void setContentSize(const axis::Size& size) override;
2020-08-04 12:31:33 +08:00
protected:
virtual void draw(axis::Renderer *renderer, const axis::Mat4 &transform, uint32_t flags) override;
2020-08-04 12:31:33 +08:00
axis::Tex2F textureCoordFromAlphaPoint(axis::Vec2 alpha);
axis::Vec3 vertexFromAlphaPoint(axis::Vec2 alpha);
2020-08-04 12:31:33 +08:00
void updateBar(void);
void updateRadial(void);
virtual void updateColor(void) override;
axis::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;
axis::TrianglesCommand::Triangles _fillTriangles;
axis::V3F_C4B_T2F *_vertexData;
2020-08-04 12:31:33 +08:00
unsigned short *_vertexIndex;
static axis::Texture2D* _empty;
2020-08-04 12:31:33 +08:00
};
NS_FGUI_END
#endif