Android program tiny

oddchild

New member
Joined
Jul 18, 2017
Messages
14
Hi Guys,


I put this up on monkey but figured it would get read here quicker. I have a game that I have been working on. It runs fine on my tablet and phone but on other (Chinese) devices it seems to show up real small.



Any ideas? Do I need a declaration?

Do I need to make two apks for phone models.
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,210
What screen does this device have? I am not an Android expert, but maybe you need to alter the AndroidManifest.xml file in the target or your project to support large screensizes. There is tons of info when you google about supporting screensizes in Android.

Maybe this will help:

XML:
<supports-screens android:xlargeScreens="true" />

I got this from here:

https://developer.android.com/guide/practices/screens_support.html

Hope it helps.
 

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
334
Could you go more into detail please? What means "small"?

As different devices have different resolutions just a standard DrawText "Hello" would result in different sizes for different devices. For an old 800x480px resolution it would look ok, but on a high resolution tablet with more than 2500x15xx pixels it would look very small. That's why usually a virtual resolution is used. That way it looks equal on all different devices.
 

oddchild

New member
Joined
Jul 18, 2017
Messages
14
Hi Guys,



Yeah I suppose it might be older devices that are showing up better. I suppose the chinese gizmos are newer. I will give it a shot with the xml file. Are there any plans to get cerberus to linux as well?
 

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
334
All you need is kind of a virtual resolution. Let's assume you have a landscape app, so we will use a fix resolution of 1280x720 in my example. That means that the y resolution is always fixed to 720 pixel, where the x-resolution can float between 960 pixels (for 4:3 aspect ratio like the iPad) up to 1280 pixels (for 16:9 aspect ratio):

Code:
'Inside your game class...
Field _scaleRatio:Float
Field _maxX:Float  'this is your floating x value

Method OnCreate:Int()
  Local resX:Float = Float( DeviceWidth() )
  Local resY:Float = Float( DeviceHeight() )
  _scaleRatio = resY / 720.0
  _maxX = resX / _scaleRatio
  Return 0
End Method

Method OnRender:Int()
  'Here happens the "magic" of virtual resolution:
  PushMatrix()
    Scale( _scaleRatio, _scaleRatio )
    'Do your render stuff here...
  PopMatrix()
  Return 0
End Method

There will be a Linux version of Cerberus soon. :)
 

oddchild

New member
Joined
Jul 18, 2017
Messages
14
Hi thanks for your input!!!


Right now the game is showing up as a black screen when I attempt to compile to html. I haven't had a chance to see if it will react differently on my android devices yet.


hariflar.png





This is what it looks like on my phone and older android devices. Newer devices make the buttons quite small so that when someone is trying to push them they hit the nearby button because they are so small and hard to hit.


It is a program to teach Syrian refugees how to read...
 

Ferret3D

New member
Joined
Aug 13, 2017
Messages
88
With this code mi images are not where i expect them to be giving problems when trying to pick an image.
How do i use the _scaleratio in the code below?
Code:
For Local piece:Piece = Eachin pieceList
     If (MouseX() > piece.currX) And (MouseX() < (piece.currX+(piece.image.Width)))
          If (MouseY() > piece.currY) And (MouseY() < (piece.currY+(piece.image.Height)))


          Endif
     Endif
Next
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,210
Did you set the Image.MidHandle flag when you load them? Because then you also have to take this into your calculation.
 
Top Bottom