mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3695 from dumganhar/iss2087-new-event-dispatcher
Make XXXEventListener as friend class of XXXEvent. Move the test of eventdispatchertest.
This commit is contained in:
commit
f23ca6a52c
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Acceleration _acc;
|
Acceleration _acc;
|
||||||
|
friend class AccelerationEventListener;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -56,7 +56,7 @@ bool AccelerationEventListener::init(std::function<void(Acceleration*, Event* ev
|
||||||
{
|
{
|
||||||
auto listener = [this](Event* event){
|
auto listener = [this](Event* event){
|
||||||
auto accEvent = static_cast<AccelerationEvent*>(event);
|
auto accEvent = static_cast<AccelerationEvent*>(event);
|
||||||
this->onAccelerationEvent(&accEvent->acc, event);
|
this->onAccelerationEvent(&accEvent->_acc, event);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (EventListener::init(AccelerationEvent::EVENT_TYPE, listener))
|
if (EventListener::init(AccelerationEvent::EVENT_TYPE, listener))
|
||||||
|
|
|
@ -207,6 +207,8 @@ public:
|
||||||
private:
|
private:
|
||||||
KeyCode _keyCode;
|
KeyCode _keyCode;
|
||||||
bool _isPressed;
|
bool _isPressed;
|
||||||
|
|
||||||
|
friend class KeyboardEventListener;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -14,8 +14,6 @@ struct {
|
||||||
const char *test_name;
|
const char *test_name;
|
||||||
std::function<TestScene*()> callback;
|
std::function<TestScene*()> callback;
|
||||||
} g_aTestNames[] = {
|
} g_aTestNames[] = {
|
||||||
|
|
||||||
{ "NewEventDispatcherTest", []() { return new EventDispatcherTestScene(); } },
|
|
||||||
{ "Accelerometer", []() { return new AccelerometerTestScene(); } },
|
{ "Accelerometer", []() { return new AccelerometerTestScene(); } },
|
||||||
{ "ActionManagerTest", [](){return new ActionManagerTestScene(); } },
|
{ "ActionManagerTest", [](){return new ActionManagerTestScene(); } },
|
||||||
{ "ActionsEaseTest", [](){return new ActionsEaseTestScene();} },
|
{ "ActionsEaseTest", [](){return new ActionsEaseTestScene();} },
|
||||||
|
@ -44,6 +42,7 @@ struct {
|
||||||
#endif
|
#endif
|
||||||
{ "CurrentLanguageTest", []() { return new CurrentLanguageTestScene(); } },
|
{ "CurrentLanguageTest", []() { return new CurrentLanguageTestScene(); } },
|
||||||
{ "DrawPrimitivesTest", [](){return new DrawPrimitivesTestScene();} },
|
{ "DrawPrimitivesTest", [](){return new DrawPrimitivesTestScene();} },
|
||||||
|
{ "EventDispatcherTest", []() { return new EventDispatcherTestScene(); } },
|
||||||
{ "EffectAdvancedTest", []() { return new EffectAdvanceScene(); } },
|
{ "EffectAdvancedTest", []() { return new EffectAdvanceScene(); } },
|
||||||
{ "EffectsTest", [](){return new EffectTestScene();} },
|
{ "EffectsTest", [](){return new EffectTestScene();} },
|
||||||
{ "ExtensionsTest", []() { return new ExtensionsTestScene(); } },
|
{ "ExtensionsTest", []() { return new ExtensionsTestScene(); } },
|
||||||
|
|
Loading…
Reference in New Issue