2013-10-12 05:35:38 +08:00
|
|
|
#ifndef __MOUSE_TEST_H_
|
|
|
|
#define __MOUSE_TEST_H_
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
#include "../testBasic.h"
|
2015-03-04 06:52:55 +08:00
|
|
|
#include "../BaseTest.h"
|
2013-10-12 05:35:38 +08:00
|
|
|
|
2015-03-04 06:52:55 +08:00
|
|
|
class BaseMouseTest : public BaseTest
|
2013-10-12 05:35:38 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-04 06:52:55 +08:00
|
|
|
BaseMouseTest(void);
|
|
|
|
virtual ~BaseMouseTest(void);
|
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
void restartCallback(Ref* sender) override;
|
|
|
|
void nextCallback(Ref* sender) override;
|
|
|
|
void backCallback(Ref* sender) override;
|
2015-03-04 06:52:55 +08:00
|
|
|
|
|
|
|
// overrides
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
virtual void onEnter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MouseTestScene : public TestScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void runThisTest();
|
|
|
|
};
|
|
|
|
|
|
|
|
class MouseEventTest : public BaseMouseTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(MouseEventTest);
|
|
|
|
MouseEventTest();
|
|
|
|
~MouseEventTest();
|
2013-10-12 05:35:38 +08:00
|
|
|
|
|
|
|
void onMouseDown(Event* event);
|
|
|
|
void onMouseUp(Event* event);
|
|
|
|
void onMouseMove(Event* event);
|
|
|
|
void onMouseScroll(Event* event);
|
2015-03-04 06:52:55 +08:00
|
|
|
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-10-12 05:35:38 +08:00
|
|
|
|
|
|
|
private:
|
2014-03-26 23:33:58 +08:00
|
|
|
Label* _labelAction;
|
|
|
|
Label* _labelPosition;
|
2013-10-12 05:35:38 +08:00
|
|
|
EventListenerMouse* _mouseListener;
|
|
|
|
};
|
|
|
|
|
2015-03-04 06:52:55 +08:00
|
|
|
class HideMouseTest : public BaseMouseTest
|
2013-10-12 05:35:38 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-03-04 06:52:55 +08:00
|
|
|
CREATE_FUNC(HideMouseTest);
|
|
|
|
HideMouseTest();
|
|
|
|
~HideMouseTest();
|
|
|
|
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
EventListenerMouse* _lis;
|
2013-10-12 05:35:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|