mirror of https://github.com/axmolengine/axmol.git
issue #1177: Updated android project configuration.
This commit is contained in:
parent
d1d0fd619a
commit
909a759ff6
|
@ -328,14 +328,20 @@ void CCDirector::setNextDeltaTimeZero(bool bNextDeltaTimeZero)
|
|||
void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||
{
|
||||
CCSize size = m_obWinSizeInPixels;
|
||||
CCSize sizePoint = m_obWinSizeInPoints;
|
||||
//CCSize sizePoint = m_obWinSizeInPoints;
|
||||
|
||||
glViewport(0, 0, size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
|
||||
//glViewport(0, 0, size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
|
||||
if (m_pobOpenGLView)
|
||||
{
|
||||
m_pobOpenGLView->setViewPortInPoints(0, 0, size.width, size.height);
|
||||
}
|
||||
|
||||
switch (kProjection)
|
||||
{
|
||||
case kCCDirectorProjection2D:
|
||||
{
|
||||
|
||||
|
||||
kmGLMatrixMode(KM_GL_PROJECTION);
|
||||
kmGLLoadIdentity();
|
||||
kmMat4 orthoMatrix;
|
||||
|
@ -348,11 +354,6 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
|||
|
||||
case kCCDirectorProjection3D:
|
||||
{
|
||||
// reset the viewport if 3d proj & retina display
|
||||
if( CC_CONTENT_SCALE_FACTOR() != 1 )
|
||||
{
|
||||
glViewport(-size.width/2, -size.height/2, size.width * CC_CONTENT_SCALE_FACTOR(), size.height * CC_CONTENT_SCALE_FACTOR() );
|
||||
}
|
||||
float zeye = this->getZEye();
|
||||
|
||||
kmMat4 matrixPerspective, matrixLookup;
|
||||
|
@ -361,16 +362,24 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
|||
kmGLLoadIdentity();
|
||||
|
||||
// issue #1334
|
||||
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, zeye*2);
|
||||
if (m_pobOpenGLView && m_pobOpenGLView->isIpad() && m_pobOpenGLView->getMainScreenScale() > 1.0f)
|
||||
{
|
||||
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, zeye-size.height/2, zeye+size.height/2);
|
||||
}
|
||||
else
|
||||
{
|
||||
kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.5f, 1500);
|
||||
}
|
||||
|
||||
// kmMat4PerspectiveProjection( &matrixPerspective, 60, (GLfloat)size.width/size.height, 0.1f, 1500);
|
||||
kmGLMultMatrix(&matrixPerspective);
|
||||
|
||||
kmGLMatrixMode(KM_GL_MODELVIEW);
|
||||
kmGLLoadIdentity();
|
||||
kmVec3 eye, center, up;
|
||||
kmVec3Fill( &eye, sizePoint.width/2, sizePoint.height/2, zeye );
|
||||
kmVec3Fill( ¢er, sizePoint.width/2, sizePoint.height/2, 0 );
|
||||
kmVec3Fill( &up, 0, 1, 0);
|
||||
kmVec3Fill( &eye, size.width/2, size.height/2, zeye );
|
||||
kmVec3Fill( ¢er, size.width/2, size.height/2, 0.0f );
|
||||
kmVec3Fill( &up, 0.0f, 1.0f, 0.0f);
|
||||
kmMat4LookAt(&matrixLookup, &eye, ¢er, &up);
|
||||
kmGLMultMatrix(&matrixLookup);
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ void CCRenderTexture::end(bool bIsTOCacheTexture)
|
|||
glViewport((GLsizei)(-size.width/2), (GLsizei)(-size.height/2), (GLsizei)(size.width * CC_CONTENT_SCALE_FACTOR()), (GLsizei)(size.height * CC_CONTENT_SCALE_FACTOR()));
|
||||
}
|
||||
|
||||
//TODO: Does this line take effect? director->setProjection(director->getProjection());
|
||||
director->setProjection(director->getProjection());
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
||||
if (bIsTOCacheTexture)
|
||||
|
|
|
@ -59,6 +59,11 @@ CCEGLViewProtocol::~CCEGLViewProtocol()
|
|||
|
||||
}
|
||||
|
||||
bool CCEGLViewProtocol::isIpad()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CCSize CCEGLViewProtocol::getSize()
|
||||
{
|
||||
CCSize size(m_sSizeInPoint.width, m_sSizeInPoint.height);
|
||||
|
@ -140,8 +145,10 @@ void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float
|
|||
pTouch->SetTouchInfo(nUnusedIndex, (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
|
||||
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
|
||||
|
||||
s_TouchesIntergerDict.setObject(CCInteger::integerWithInt(nUnusedIndex), id);
|
||||
CCInteger* pInterObj = new CCInteger(nUnusedIndex);
|
||||
s_TouchesIntergerDict.setObject(pInterObj, id);
|
||||
set.addObject(pTouch);
|
||||
pInterObj->release();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
virtual void swapBuffers() = 0;
|
||||
virtual void setIMEKeyboardState(bool bOpen) = 0;
|
||||
|
||||
virtual bool isIpad();
|
||||
virtual CCRect getViewPort();
|
||||
virtual CCSize getSize();
|
||||
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||
|
|
|
@ -57,11 +57,7 @@ void CCEGLView::setFrameWidthAndHeight(int width, int height)
|
|||
{
|
||||
m_sSizeInPixel.width = width;
|
||||
m_sSizeInPixel.height = height;
|
||||
}
|
||||
|
||||
bool CCEGLView::isIpad()
|
||||
{
|
||||
return false;
|
||||
create(width, height);
|
||||
}
|
||||
|
||||
void CCEGLView::create(int width, int height)
|
||||
|
@ -84,8 +80,8 @@ void CCEGLView::create(int width, int height)
|
|||
m_rcViewPort.size.width = viewPortW;
|
||||
m_rcViewPort.size.height = viewPortH;
|
||||
|
||||
CCLog("m_fScreenScaleFactor = %f", m_fScreenScaleFactor);
|
||||
m_bNotHVGA = true;
|
||||
CCLog("CCEGLView::create");
|
||||
}
|
||||
|
||||
CCEGLView::~CCEGLView()
|
||||
|
|
|
@ -37,7 +37,6 @@ public:
|
|||
virtual ~CCEGLView();
|
||||
|
||||
bool isOpenGLReady();
|
||||
bool isIpad();
|
||||
/**
|
||||
* the width and height is the real size of phone
|
||||
*/
|
||||
|
|
|
@ -65,7 +65,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv* env, jobj
|
|||
env->GetFloatArrayRegion(xs, 0, size, x);
|
||||
env->GetFloatArrayRegion(ys, 0, size, y);
|
||||
|
||||
cocos2d::CCDirector::sharedDirector()->getOpenGLView()->handleTouchesEnd(size, id, x, y);
|
||||
cocos2d::CCDirector::sharedDirector()->getOpenGLView()->handleTouchesMove(size, id, x, y);
|
||||
}
|
||||
|
||||
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv* env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
|
||||
|
|
|
@ -399,11 +399,6 @@ bool CCEGLView::isOpenGLReady()
|
|||
return (NULL != m_pEGL);
|
||||
}
|
||||
|
||||
bool CCEGLView::isIpad()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCEGLView::end()
|
||||
{
|
||||
if (m_hWnd)
|
||||
|
|
|
@ -42,7 +42,6 @@ public:
|
|||
virtual ~CCEGLView();
|
||||
|
||||
bool isOpenGLReady();
|
||||
bool isIpad();
|
||||
void end();
|
||||
|
||||
void swapBuffers();
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package org.cocos2dx.tests;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int icon=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int test_demo_gl_surfaceview=0x7f050001;
|
||||
public static final int textField=0x7f050000;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int test_demo=0x7f030000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f040000;
|
||||
}
|
||||
}
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package org.cocos2dx.tests;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int icon=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int test_demo_gl_surfaceview=0x7f050001;
|
||||
public static final int textField=0x7f050000;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int test_demo=0x7f030000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f040000;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue