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:
James Chen 2013-09-18 03:35:03 -07:00
commit f23ca6a52c
4 changed files with 5 additions and 3 deletions

View File

@ -39,6 +39,7 @@ public:
private: private:
Acceleration _acc; Acceleration _acc;
friend class AccelerationEventListener;
}; };
NS_CC_END NS_CC_END

View File

@ -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))

View File

@ -207,6 +207,8 @@ public:
private: private:
KeyCode _keyCode; KeyCode _keyCode;
bool _isPressed; bool _isPressed;
friend class KeyboardEventListener;
}; };
NS_CC_END NS_CC_END

View File

@ -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(); } },