From 4d271e782bcffb71ca3cddf1694796895c8d5dbd Mon Sep 17 00:00:00 2001 From: moadib Date: Wed, 30 Jan 2013 18:28:06 +0400 Subject: [PATCH] Added CCEGLView::EventHandler class for Blackberry platform Added CCEGLView ::getWindowGroupId() method for Blackberry platform --- cocos2dx/platform/blackberry/CCEGLView.cpp | 13 +++++++++++++ cocos2dx/platform/blackberry/CCEGLView.h | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/cocos2dx/platform/blackberry/CCEGLView.cpp b/cocos2dx/platform/blackberry/CCEGLView.cpp index 8beee098ef..6f11c20d47 100644 --- a/cocos2dx/platform/blackberry/CCEGLView.cpp +++ b/cocos2dx/platform/blackberry/CCEGLView.cpp @@ -77,6 +77,7 @@ static CCTouch *s_pTouches[MAX_TOUCHES] = { NULL }; static CCEGLView* s_pInstance = NULL; CCEGLView::CCEGLView() + : m_pEventHandler(NULL) { m_eglDisplay = EGL_NO_DISPLAY; m_eglContext = EGL_NO_CONTEXT; @@ -103,7 +104,16 @@ CCEGLView::CCEGLView() CCEGLView::~CCEGLView() { +} +void CCEGLView::setEventHandler(EventHandler* pHandler) +{ + m_pEventHandler = pHandler; +} + +const char* CCEGLView::getWindowGroupId() const +{ + return m_windowGroupID; } void CCEGLView::release() @@ -575,6 +585,9 @@ bool CCEGLView::handleEvents() // break if no more events if (event == NULL) break; + + if (m_pEventHandler && m_pEventHandler->HandleBPSEvent(event)) + continue; domain = bps_event_get_domain(event); diff --git a/cocos2dx/platform/blackberry/CCEGLView.h b/cocos2dx/platform/blackberry/CCEGLView.h index dc9c9998bb..0a8e7824ee 100644 --- a/cocos2dx/platform/blackberry/CCEGLView.h +++ b/cocos2dx/platform/blackberry/CCEGLView.h @@ -29,15 +29,28 @@ THE SOFTWARE. #include "platform/CCEGLViewProtocol.h" #include "platform/CCPlatformMacros.h" +#include + NS_CC_BEGIN class CC_DLL CCEGLView : public CCEGLViewProtocol { +public: +class CC_DLL EventHandler + { + public: + virtual bool HandleBPSEvent(bps_event_t* event) = 0; + + virtual ~EventHandler() {} + }; public: CCEGLView(); virtual ~CCEGLView(); bool isOpenGLReady(); + + void setEventHandler(EventHandler* pHandler); + const char* getWindowGroupId() const; // keep compatible void end(); @@ -67,6 +80,8 @@ private: bool m_isGLInitialized; bool m_isWindowActive; + + EventHandler* m_pEventHandler; EGLDisplay m_eglDisplay; EGLContext m_eglContext;