-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathIrregularButton.h
71 lines (59 loc) · 2.57 KB
/
IrregularButton.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* =====================================================================================
*
* Filename: IrregularButton.h
*
* Description:
*
* Version: 1.0
* Created: 2014/10/29
* Revision: none
* Compiler: gcc
*
* Author: Shuai Yuan (),
* Organization:
*
* =====================================================================================
*/
#ifndef __IRREGULAR_BUTTON_H__
#define __IRREGULAR_BUTTON_H__
#include "cocos2d.h"
#include "ui/CocosGUI.h"
/*
* =====================================================================================
* Class: IrregularButton
* Description:
* =====================================================================================
*/
class IrregularButton : public cocos2d::ui::Button
{
public:
/* ==================== LIFECYCLE ======================================= */
IrregularButton (); /* constructor */
virtual ~IrregularButton (); /* destructor */
static IrregularButton* create();
static IrregularButton* create(const std::string& normalImage,
const std::string& selectedImage = "",
const std::string& disableImage = "",
cocos2d::ui::Widget::TextureResType texType = cocos2d::ui::Widget::TextureResType::LOCAL);
/* ==================== ACCESSORS ======================================= */
/* ==================== MUTATORS ======================================= */
/* ==================== OPERATORS ======================================= */
virtual bool hitTest(const cocos2d::Vec2 &pt) override;
protected:
virtual bool init() override;
virtual bool init(const std::string& normalImage,
const std::string& selectedImage = "",
const std::string& disableImage = "",
cocos2d::ui::Widget::TextureResType texType = cocos2d::ui::Widget::TextureResType::LOCAL) override;
void loadNormalTransparentInfo();
void loadNormalTransparentInfoFromFile();
bool getIsTransparentAtPoint(cocos2d::Vec2 point);
/* ==================== DATA MEMBERS ======================================= */
private:
/* ==================== DATA MEMBERS ======================================= */
int normalImageWidth_;
int normalImageHeight_;
bool* normalTransparent_;
}; /* ----- end of class IrregularButton ----- */
#endif /* __IRREGULAR_BUTTON_H__ */