android - Cocos2d-x 3.9 wrong origin and visible size when in landscape? -


i put profile in landscape:

<activity     android:name="org.cocos2dx.cpp.appactivity"     android:screenorientation="landscape"     android:configchanges="orientation|keyboardhidden|screensize"     android:label="@string/app_name"     android:theme="@android:style/theme.notitlebar.fullscreen" >     <intent-filter>         <action android:name="android.intent.action.main" />          <category android:name="android.intent.category.launcher" />     </intent-filter> </activity> 

then start game , print origin , visible size.

log("debug: origin = %f, %f", origin.x, origin.y); log("debug: visiblesize = %f, %f", visiblesize.width, visiblesize.height); 

the output was: (btw, design resolution 1024 x 768)

d/cocos2d-x debug info: debug: origin = 0.000000, 75.772583 d/cocos2d-x debug info: debug: visiblesize = 1024.000000, 616.454834 

notice "back-home-apps" system bar on right side of screen. tried put image middle of screen setting it's position (origin.x + visiblesize.width / 2, origin.y + visiblesize.height / 2), can see, because of wrong visible size , origin, image towards lower part of screen.

enter image description here

i expecting origin should (0,0) , visible size should (1024 - height-of-system-bar) x 768. can see origin has delta on y axis, , visible size take hit on y axis --- if cocos2d-x thought screen in portrait orientation , system bar @ bottom of screen.

how tell cocos2d phone in landscape orientation?

solved puzzle. 2 things here:

  1. i wrongly calculating coordinates. did ((origin.x + visiblesize.width / 2), (origin.y + visiblesize.height / 2)). made mistake of typing question rather copy/pasting code, confusion.

  2. after fix, origin , visible size still not screen size, , caused me using no_border policy (which failed mention in question). cocos2d enlarged content fill screen space, causing axis longer necessary clamped in middle.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -