2010-11-03 11:01:17 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2010 cocos2d-x.org
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
#include "CCXEGLView_android.h"
|
|
|
|
#include "GLES/gl.h"
|
|
|
|
|
2010-11-13 17:01:35 +08:00
|
|
|
#include "CCXCocos2dDefine.h"
|
2010-11-03 11:01:17 +08:00
|
|
|
#include "NSSet.h"
|
|
|
|
#include "CCDirector.h"
|
2010-12-06 09:51:21 +08:00
|
|
|
#include "ccMacros.h"
|
2010-11-03 11:01:17 +08:00
|
|
|
|
2010-11-04 17:33:31 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2010-11-03 11:01:17 +08:00
|
|
|
namespace cocos2d {
|
|
|
|
|
|
|
|
CCXEGLView::CCXEGLView()
|
|
|
|
{
|
|
|
|
m_nWidth = 0;
|
|
|
|
m_nHeight = 0;
|
2010-12-09 10:50:02 +08:00
|
|
|
m_pDelegate = NULL;
|
2010-11-03 11:01:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCXEGLView::setFrameWitdAndHeight(int width, int height)
|
|
|
|
{
|
|
|
|
m_nWidth = width;
|
|
|
|
m_nHeight = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
CCXEGLView::~CCXEGLView()
|
|
|
|
{
|
2010-12-09 10:50:02 +08:00
|
|
|
CCX_SAFE_DELETE(m_pDelegate);
|
2010-11-03 11:01:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CGSize CCXEGLView::getSize()
|
|
|
|
{
|
|
|
|
CGSize size(m_nWidth, m_nHeight);
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CCXEGLView::isOpenGLReady()
|
|
|
|
{
|
|
|
|
return (m_nWidth != 0 && m_nHeight !=0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCXEGLView::release()
|
|
|
|
{
|
2010-11-04 17:33:31 +08:00
|
|
|
exit(0);
|
2010-11-03 11:01:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCXEGLView::setTouchDelegate(EGLTouchDelegate * pDelegate)
|
|
|
|
{
|
2010-12-09 10:50:02 +08:00
|
|
|
m_pDelegate = pDelegate;
|
|
|
|
}
|
|
|
|
|
|
|
|
EGLTouchDelegate* CCXEGLView::getDelegate(void)
|
|
|
|
{
|
|
|
|
return m_pDelegate;
|
2010-11-03 11:01:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCXEGLView::swapBuffers()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end of namespace cocos2d
|
2010-11-04 17:33:31 +08:00
|
|
|
|