Android Orientation

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Android Orientation

Post by Ensayia »

Don't know if this belongs here or in Android, now that the projects have sort of merged.

Is there any easy way to set portrait / landscape orientation when loading a game on Android? I don't see anything in the wiki about it.

Thanks!
User avatar
CanadianGamer
Party member
Posts: 132
Joined: Tue Jun 30, 2015 1:23 pm
Location: Canada
Contact:

Re: Android Orientation

Post by CanadianGamer »

I don't think there is a way to easily do that.
I guess you could change that when building into an apk
but other than that I don't think so.
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
monolifed
Party member
Posts: 188
Joined: Sat Feb 06, 2016 9:42 pm

Re: Android Orientation

Post by monolifed »

Is there a way to tell screen orientation?
Löve seems to prefer landscape orientation
User avatar
D0NM
Party member
Posts: 250
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: Android Orientation

Post by D0NM »

ingsoc451 wrote:Is there a way to tell screen orientation?
Löve seems to prefer landscape orientation
have you seen this? viewtopic.php?f=4&t=81634&p=193732&hili ... pe#p193732
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Twitter: @Zabuyaki.
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Android Orientation

Post by bobbyjones »

I build it in landscape automagically. It can also be built in a way that can be auto, auto-landscape,auto-portrait(I think), and portrait. You would just have to set it in the manefest(I can't spell today) I believe. I suggested to slime that I can write code to make it possible to be changed in app but SDL handles the window creation and such in love. So the change has to be made in SDL for love to support it on Android. It is supported in SDL for iOS tho.
monolifed
Party member
Posts: 188
Joined: Sat Feb 06, 2016 9:42 pm

Re: Android Orientation

Post by monolifed »

D0NM wrote:
ingsoc451 wrote:Is there a way to tell screen orientation?
Löve seems to prefer landscape orientation
have you seen this? viewtopic.php?f=4&t=81634&p=193732&hili ... pe#p193732
I didn't see it. Thank you.
User avatar
bgordebak
Party member
Posts: 130
Joined: Thu Jul 10, 2014 2:04 am
Location: Ankara, Turkey

Re: Android Orientation

Post by bgordebak »

I did a simple hack for this. I don't know if it'll be a problem when I release the game, but right now it works. Here's how it goes:

Code: Select all

function love.draw()
	screen_width = love.graphics.getWidth()
	screen_height = love.graphics.getHeight()
	if screen_width < screen_height then
		orientation = "portrait"
	else
		orientation = "landscape"
	end
	--draw accordingly
end
Last edited by bgordebak on Tue Feb 07, 2017 3:13 pm, edited 1 time in total.
User avatar
bgordebak
Party member
Posts: 130
Joined: Thu Jul 10, 2014 2:04 am
Location: Ankara, Turkey

Re: Android Orientation

Post by bgordebak »

You can change your AndroidManifest.xml so that android:screenOrientation is "unspecified" or "portrait". It's fairly easy.

It works fine for me.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest