ANDROID_SCREEN_ORIENTATION

Monkey Forums/Monkey Beginners/ANDROID_SCREEN_ORIENTATION

yiotoo(Posted 2014) [#1]
Is there a way to the player chose the screen orientation, inside the game or after restart the game?

(i am not considering modify the config.monkey because it can't be changed by the player)

I tried to put this code on OnCreate() and on Main() but i think the "#ANDROID_SCREEN_ORIENTATION=" needs to be near the Import and Globals.
And i can't i tried even SaveState and LoadState for the variable "screen", and it not happens


Select screen 
	Case 0
		#ANDROID_SCREEN_ORIENTATION="user"
	Case 1
		#ANDROID_SCREEN_ORIENTATION="portrait"
	Case 2 
		#ANDROID_SCREEN_ORIENTATION="landscape" 	
End


any idea?


Goodlookinguy(Posted 2014) [#2]
I think you misunderstand how the preprocessor works. The preprocessor code runs before any of the code is parsed.

This code...
Select screen 
	Case 0
		#ANDROID_SCREEN_ORIENTATION="user"
	Case 1
		#ANDROID_SCREEN_ORIENTATION="portrait"
	Case 2 
		#ANDROID_SCREEN_ORIENTATION="landscape" 	
End


becomes this before the code is parsed...
#ANDROID_SCREEN_ORIENTATION="user"
#ANDROID_SCREEN_ORIENTATION="portrait"
#ANDROID_SCREEN_ORIENTATION="landscape"


And it just runs each line. The last line it reads tells it that the android screen orientation should be landscape. So that's what it sets it as. I don't know much about android, so I can't help in the specifics, only the Monkey code itself.


yiotoo(Posted 2014) [#3]
I understood, i just want something in game for the player to ajust the screen as he wishes. I got a review from a guy who said the game will be better at "landscape" but I think the "user" mode is better. So i am thinking to put a function to the player decides without turn the tablet


Gerry Quinn(Posted 2014) [#4]
You can allow free rotation, but I think for games that is problematic because if you move your device suddenly the screen is rotating 90 degrees.

I have certainly toyed with the idea of leaving it fixed to portrait but having a setting which rotates the game graphics to landscape if the user wants. Nobody seems to do this, but it would be easy to implement (not sure if Google would like it though). Just interchange device width and height, and rotate the default matrix at the start of every render.

I'd probably have tried it already, except I am doing ad-supported games at the moment which would make it a bit more complicated.


yiotoo(Posted 2014) [#5]
ty


Ironstorm(Posted 2014) [#6]
I've played several games which uses the "user" screen orientation. If you change the orientation ingame, the game will be paused and the user have to click a "resume game"-button.
For some games, this isn't that bad. For example turn-based games, or puzzles. Of course, for action games or jump and runs this is something unusual.