Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to run CoronaCards in landscape orientation in native app
Started by akao Jul 20 2018 12:12 PM

No replies to this topic
coronacards
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

akao

[GLOBAL: userInfoPane.html]
akao
  • Contributor

  • 372 posts
  • Corona SDK

This may be related to https://forums.coronalabs.com/topic/71729-coronaview-run-parameters/. 

 

We have a CoronaCards project that we are trying to run in Landscape (see attached config.lua). We noticed that while running in the simulator, it behaves correctly and shows

 

display.contentHeight == 320
display.contentWidth == 480
However, once built into native code (using the Fishes example as the starting point), those 2 are reversed, and consequently the visuals aren't displayed properly.
 
display.contentHeight == 480
display.contentWidth == 320

I did set the landscape setting in AndroidManifest. But that's clearly not enough. I get the sense there may be another parameter I need to pass into CoronaView, but I can't seem to find documentations or examples of how to do it. Can you point me to the right direction. 

android:screenOrientation="sensorLandscape" >

FYI - I also looked at CoronaView's javadoc, and it looks like it takes in AttributeSet. Is there something I should set there? 

https://docs.coronalabs.com/coronacards/android/html/com/ansca/corona/CoronaView.html

 

 

For reference, my config.lua is: 

 

local aspectRatio = display.pixelHeight / display.pixelWidth

 
application = {
 
content = {
         width = 320,
         height = 480,
         -- width = 480,
         -- height = 320,
         scale = "letterBox",
         xAlign = "center",
         yAlign = "center",
         imageSuffix =
         {
            ["@2x"] = 1, -- try to force all devices to use @2x.
         },
},
}
 

 

And my AndroidManifest is

 

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app" >

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:fullBackupContent="false"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name="com.example.app.MainActivity"
android:label="@string/app_name"
android:screenOrientation="sensorLandscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>



[topic_controls]
[/topic_controls]