axmol/extensions/fairygui/event/HitTest.h

53 lines
820 B
C
Raw Normal View History

2020-08-04 12:31:33 +08:00
#ifndef __HITTEST_H__
#define __HITTEST_H__
#include "FairyGUIMacros.h"
#include "cocos2d.h"
NS_FGUI_BEGIN
class GComponent;
class ByteBuffer;
class IHitTest
{
public:
2022-08-08 18:02:17 +08:00
virtual bool hitTest(GComponent* obj, const ax::Vec2& localPoint)
2020-08-04 12:31:33 +08:00
{
return true;
}
};
class PixelHitTestData
{
public:
int pixelWidth;
float scale;
unsigned char* pixels;
size_t pixelsLength;
PixelHitTestData();
~PixelHitTestData();
void load(ByteBuffer* buffer);
};
class PixelHitTest : public IHitTest
{
public:
PixelHitTest(PixelHitTestData* data, int offsetX, int offsetY);
2022-08-08 18:02:17 +08:00
virtual bool hitTest(GComponent* obj, const ax::Vec2& localPoint) override;
2020-08-04 12:31:33 +08:00
int offsetX;
int offsetY;
float scaleX;
float scaleY;
private:
PixelHitTestData* _data;
};
NS_FGUI_END
#endif