mirror of https://github.com/axmolengine/axmol.git
Shared instance is now a pointer instead of a static instance. Also the CCEGLView::release notifies application about quit
This commit is contained in:
parent
362a82f41c
commit
af29be2d26
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "IwGL.h"
|
||||
|
||||
#include "CCApplication.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCSet.h"
|
||||
#include "CCTouch.h"
|
||||
|
@ -36,6 +37,9 @@
|
|||
|
||||
NS_CC_BEGIN;
|
||||
|
||||
CCEGLView* CCEGLView::m_pInstance = 0 ;
|
||||
|
||||
|
||||
CCEGLView::CCEGLView()
|
||||
: m_pDelegate(NULL)
|
||||
, m_fScreenScaleFactor(1.0)
|
||||
|
@ -182,9 +186,14 @@ void CCEGLView::release()
|
|||
{
|
||||
IW_CALLSTACK("CCEGLView::release");
|
||||
|
||||
s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, &TouchEventHandler);
|
||||
s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, &MotionEventHandler);
|
||||
s3eKeyboardUnRegister(S3E_KEYBOARD_KEY_EVENT, &KeyEventHandler);
|
||||
|
||||
if (IwGLIsInitialised())
|
||||
IwGLTerminate();
|
||||
|
||||
s3eDeviceRequestQuit() ;
|
||||
}
|
||||
|
||||
void CCEGLView::setTouchDelegate(EGLTouchDelegate * pDelegate)
|
||||
|
@ -253,8 +262,10 @@ void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
|
|||
|
||||
CCEGLView& CCEGLView::sharedOpenGLView()
|
||||
{
|
||||
static CCEGLView instance;
|
||||
return instance;
|
||||
if( !m_pInstance ) {
|
||||
m_pInstance = new CCEGLView() ;
|
||||
}
|
||||
return *m_pInstance;
|
||||
}
|
||||
|
||||
float CCEGLView::getScreenScaleFactor()
|
||||
|
@ -275,4 +286,5 @@ CCRect CCEGLView::getViewPort()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
NS_CC_END;
|
||||
|
|
|
@ -88,6 +88,8 @@ private:
|
|||
CCSet * m_pSet;
|
||||
CCTouch * m_pTouch;
|
||||
|
||||
static CCEGLView* m_pInstance ;
|
||||
|
||||
void setTouch(void* systemData);
|
||||
void setMotionTouch(void* systemData);
|
||||
void setKeyTouch(void* systemData);
|
||||
|
|
Loading…
Reference in New Issue