i have a problem with running my game on landscape mode, i’ve done things mentioned on this forum(http://www.cocos2d-x.org/boards/6/topics/16857?page=1) it seems that it should work but it isn’t i could run it on portrait but no chance with landscape
please post a working sample on iphone5 screen so i can test it,
current cocos2d-x version is 2.1 and its working with no problem with rendering , it renders correct but locationInView gives wrong points reverse x,y and x is this range [387,747] i didn’t change projection matrix in this example :
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector pDirector = CCDirector::sharedDirector;
pDirector~~>setOpenGLView);
pDirector~~>setProjection;
float w, h;
w = 1136;
h =640;
float angle = s3eSurfaceGetInt 90.0f;
CCEGLView::sharedOpenGLView()>setDesignResolutionSize;
// turn on display FPS
//pDirector>setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don’t call this
pDirector~~>setAnimationInterval;
// create a scene. it’s an autorelease object
CCScene *pScene = PlayScene::scene;
// run
pDirector~~>runWithScene(pScene);
As I told you I’m having problems using Marmalade 6.2 instead try to use Marmalade 6.1.2.
The only thing I see I don’t have in my code is
CCEGLView::sharedOpenGLView()>setDesignResolutionSize;
But I don’t know if it’s relevant in order to work properly.
As well I don’t have
float w, h;
w = 1136;
h =640;
This is my AppDelegate code:
bool AppDelegate::applicationDidFinishLaunching
{
// initialize director
CCDirector **pDirector = CCDirector::sharedDirector;
pDirector>setOpenGLView );
pDirector~~>setProjection;
// Set projection
float w, h;
int angle = s3eSurfaceGetInt** 90;
appplicationUpdateProjection;
// turn on display FPS
pDirector~~>setDisplayStats( false );
// set FPS. the default value is 1.0/60 if you don’t call this
pDirector~~>setAnimationInterval;
// create a scene. it’s an autorelease object
CCScene* pScene = SurvivorGameMode::scene;
// run
pDirector~~>runWithScene( pScene );
return true;
}
And this is my update projection code
void AppDelegate::appplicationUpdateProjection( int angle, float& w, float& h )
{
if ( IwGLGetInt( IW_GL_VIRTUAL_WIDTH ) >= 0 )
{
w = static_cast( IwGLGetInt( IW_GL_VIRTUAL_WIDTH ) );
h = static_cast( IwGLGetInt( IW_GL_VIRTUAL_HEIGHT ) );
}
else
{
w = static_cast( s3eSurfaceGetInt( S3E_SURFACE_WIDTH ) );
h = static_cast( s3eSurfaceGetInt( S3E_SURFACE_HEIGHT) );
}
if ( ( angle 90 ) || ( angle 270 ) )
{
// Swap w and h
float oh = h;
h = w;
w = oh;
}
CCEGLView::sharedOpenGLView()->setFrameSize( w, h );
CCEGLView::sharedOpenGLView()->setViewPortInPoints( 0.0f, 0.0f, w, h );
ah I forgot to post my solution i could finally get it working
that’s what i did after seeing why i get those weird coordination
CCEGLView::sharedOpenGLView()->setFrameSize( h, w );
thats the only line i’ve changed from your code that made my screen coordinate right ,
look CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[]) for the reason
it uses m_obViewPortRect.origin it should be zero to give right coordinates,