Added CCEGLView::EventHandler class for Blackberry platform

Added CCEGLView ::getWindowGroupId() method for Blackberry platform
This commit is contained in:
moadib 2013-01-30 18:28:06 +04:00
parent ba3b2b7aa6
commit 4d271e782b
2 changed files with 28 additions and 0 deletions

View File

@ -77,6 +77,7 @@ static CCTouch *s_pTouches[MAX_TOUCHES] = { NULL };
static CCEGLView* s_pInstance = NULL; static CCEGLView* s_pInstance = NULL;
CCEGLView::CCEGLView() CCEGLView::CCEGLView()
: m_pEventHandler(NULL)
{ {
m_eglDisplay = EGL_NO_DISPLAY; m_eglDisplay = EGL_NO_DISPLAY;
m_eglContext = EGL_NO_CONTEXT; m_eglContext = EGL_NO_CONTEXT;
@ -103,7 +104,16 @@ CCEGLView::CCEGLView()
CCEGLView::~CCEGLView() CCEGLView::~CCEGLView()
{ {
}
void CCEGLView::setEventHandler(EventHandler* pHandler)
{
m_pEventHandler = pHandler;
}
const char* CCEGLView::getWindowGroupId() const
{
return m_windowGroupID;
} }
void CCEGLView::release() void CCEGLView::release()
@ -576,6 +586,9 @@ bool CCEGLView::handleEvents()
if (event == NULL) if (event == NULL)
break; break;
if (m_pEventHandler && m_pEventHandler->HandleBPSEvent(event))
continue;
domain = bps_event_get_domain(event); domain = bps_event_get_domain(event);
if (domain == navigator_get_domain()) if (domain == navigator_get_domain())

View File

@ -29,16 +29,29 @@ THE SOFTWARE.
#include "platform/CCEGLViewProtocol.h" #include "platform/CCEGLViewProtocol.h"
#include "platform/CCPlatformMacros.h" #include "platform/CCPlatformMacros.h"
#include <bps/event.h>
NS_CC_BEGIN NS_CC_BEGIN
class CC_DLL CCEGLView : public CCEGLViewProtocol class CC_DLL CCEGLView : public CCEGLViewProtocol
{ {
public:
class CC_DLL EventHandler
{
public:
virtual bool HandleBPSEvent(bps_event_t* event) = 0;
virtual ~EventHandler() {}
};
public: public:
CCEGLView(); CCEGLView();
virtual ~CCEGLView(); virtual ~CCEGLView();
bool isOpenGLReady(); bool isOpenGLReady();
void setEventHandler(EventHandler* pHandler);
const char* getWindowGroupId() const;
// keep compatible // keep compatible
void end(); void end();
void swapBuffers(); void swapBuffers();
@ -68,6 +81,8 @@ private:
bool m_isGLInitialized; bool m_isGLInitialized;
bool m_isWindowActive; bool m_isWindowActive;
EventHandler* m_pEventHandler;
EGLDisplay m_eglDisplay; EGLDisplay m_eglDisplay;
EGLContext m_eglContext; EGLContext m_eglContext;
EGLSurface m_eglSurface; EGLSurface m_eglSurface;