mirror of https://github.com/axmolengine/axmol.git
Merge pull request #1935 from moadib/bb_eglview_event_handler
fixed #1015: Added CCEGLView::EventHandler class for Blackberry platform.
This commit is contained in:
commit
9b5d0bd251
|
@ -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()
|
||||
|
@ -576,6 +586,9 @@ bool CCEGLView::handleEvents()
|
|||
if (event == NULL)
|
||||
break;
|
||||
|
||||
if (m_pEventHandler && m_pEventHandler->HandleBPSEvent(event))
|
||||
continue;
|
||||
|
||||
domain = bps_event_get_domain(event);
|
||||
|
||||
if (domain == navigator_get_domain())
|
||||
|
|
|
@ -29,16 +29,29 @@ THE SOFTWARE.
|
|||
#include "platform/CCEGLViewProtocol.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
|
||||
#include <bps/event.h>
|
||||
|
||||
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();
|
||||
void swapBuffers();
|
||||
|
@ -68,6 +81,8 @@ private:
|
|||
bool m_isGLInitialized;
|
||||
bool m_isWindowActive;
|
||||
|
||||
EventHandler* m_pEventHandler;
|
||||
|
||||
EGLDisplay m_eglDisplay;
|
||||
EGLContext m_eglContext;
|
||||
EGLSurface m_eglSurface;
|
||||
|
|
Loading…
Reference in New Issue