Marmalade 6.2 + cocos2d-x2 Landscape problem

Hi ,

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,

Thanks ,
Amir

another thing is i just checked my last game code(with cocos2d-x 1.0.1) on iphone5 with marmalade 6.2 and its not working right too,

it should be a problem with iphone5 and cocos2d-x? or maybe marmalade 6.1+ and cocos2d-x ?

my current code written with cocos2d-x2 + marmalade 6.2

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);

return true;
}

Hi Amir,

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 );

kmGLMatrixMode( KM_GL_PROJECTION );
kmGLLoadIdentity();
kmGLRotatef( static_cast( -angle ), 0.0f, 0.0f, 1.0f );
kmMat4 orthoMatrix;
kmMat4OrthographicProjection( &orthoMatrix, 0.0f, w, 0.0f, h, –1024.0f, 1024.0f );
kmGLMultMatrix( &orthoMatrix );
kmGLMatrixMode( KM_GL_MODELVIEW );
kmGLLoadIdentity();
}

I hope it helps.

Cheers

Hi Oscar
Thanks for your solution but its not working
im corrently working with marmalade 6.1.2 and cocos2d-x 2.1.0 beta3
Thats really strange…

my game is on landscape right now but coordinates are reverse x~~>y , y~~>x

its like that screen is portrait and we just rotated the rendering stuff , but screen coordinate is still like landsacpe on portrait! it acts wierd:D

What about your icf file ? do you have something special there?

Hi Amir,

I think I don’t have any magic flag haha
I have this:

[S3E]
WinPosX = 0
WinPosY = 0
IOSDispScaleFactor = 200
DispFixRot = Landscape

I hope it helps

Cheers!

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,