Author Topic: Different Devices with different Screen sizes but the same os.  (Read 5209 times)

Offline Marmor

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 908
  • 96A285CC
    • View Profile
    • my youtube channel
Whats your solution to running your app on these situation ?
Will you scale your gfx ?

Is it possible to eunumerate the supportet screen resolutions on a mobile devices for the use of setscreen ?


If you write an app with maybe 800x600 setting in project /option   but the device will have only 640x480 or maybe 1024x768 or something bigger (ipad3)  , so how to detect this ?

Offline Crivens

  • Prof. Inline
  • *****
  • Posts: 913
    • View Profile
Setup the res in project options to 9998x9999 (or 9999x9998 depending on orientation) and then handle all the resizing code yourself. If you look in the code snippets forum I wrote some code a while back to resize a load of images (inc. alpha channel) and then use them at any resolution. Ampos has also posted code to resize the whole screen (a fair bit slower and uses more memory but much easier to code for especially if you have a project already finished or almost finished and want a quick fix especially if it's not a fast updating type of game), and is now (I believe) working on new routines for resizing on the fly with things like rotation, zoom, and print support.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
If you write an app with maybe 800x600 setting in project /option   but the device will have only 640x480 or maybe 1024x768 or something bigger (ipad3)  , so how to detect this ?

Setting the project resolution to max (e.g. 9999x9998) like Crivens suggested then detecting the actual resolution the app starts in with GETDESKTOPSIZE should work well enough.

If you compile for Android you'll need to set android:anyDensity="true" in the <supports-screens> element. Setting this to false causes some devices to try to resize your screen to fit while others won't. That creates problems so to make sure you start in the native resolution of the device make sure anyDensity is always true.

Since scaling is GPU intensive there will inevitably be some devices that can't keep up 100%. Because of this adding frame-skipping to your main loop is kind of vital.

Offline Marmor

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 908
  • 96A285CC
    • View Profile
    • my youtube channel

Thx a lot !


Getdesktopsize and some scaling ,include the 9998,9999 thingy  will work if you will play with the standardscreensize ok .
Also understand the anydensity :true on Android .

But whats the solution to change resolution ?
If i remember right ,so  the using of Setscreen isnt safe on some Devices .


Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
do EVERYTHING in 3D and gone are your scaling issues  :nana:

That's a good point. Rather than drawing to the screen, 2D could be drawn to a "camera" view, where the origin is in the center.

Offline Crivens

  • Prof. Inline
  • *****
  • Posts: 913
    • View Profile
Quote
But whats the solution to change resolution ?
You can't on a mobile device. You either use the project settings resolution or use the 9998x9999 trick to get it to use it's max resolution and then use scaling code accordingly.

Quote
do EVERYTHING in 3D and gone are your scaling issues
Yep. My current WIP is Pseudo2D (ie. looks 2D but is actually 3D). Only thing is that the menu system isn't and uses my scaling code. I would like it all in 3D as all scaling issues go away but I can't get Gernot's 3DES static object code (for the menus) to work in my project (haven't tried latest version mind), and I'm too near completion (ie. beyond caring any more) to change it at this point.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3604
    • View Profile
    • Space Fractal
I do direct scaling using poly vector and I have 3 texture sizes to draw tiles from. I don't use offscreen buffer since its was too slow (I use intens use of tiles, so it's was not possible). I just use desktop size to detect resolution, like other posts due.

But for font and icons I only use one size, so they might up scaling in some resolutions, but still look nice. But only use few of them.

This was a compromise for size and still look very clear, so we diddent need to use 3 sizes for anything.

But don't do low resolutions (like 480x320) and upscaling to tables. it's look too blocky (except by design). Yes I did little up scaling too (but limited that), but only none in game graphics.

Ps. For speed I use 25fps on android (with 3 graphics details), and 30fps on iOS (4s and iPad2 got 50fps). So make sure to support various framerate (mine is a tile puzzler, so 25fps still fell nice).
« Last Edit: 2012-Jan-11 by spacefractal »
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline Crivens

  • Prof. Inline
  • *****
  • Posts: 913
    • View Profile
With the main use of 3D for pseudo 2D I'm now getting 60FPS on a iPod4 (not S) at full retina. Good stuff is 3D...

Quote
But for font and icons I only use one size, so they might up scaling in some resolutions, but still look nice. But only use few of them
Most of my text I have drawn the words then used them as rescaled sprites (including scores). However where I need dynamic text (my shop function for example) then I used a routine where it uses createscreen for only the width and height of the text I want to use and I work out all text on the first loop so I'm not doing this every showscreen loop. Then I resize the createscreen sprites for scaling purposes. Works pretty well.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Crivens, it surprises me that pseudo 2D could be faster than POLYVECTOR 2D. Interesting. Might have to look into that.

spacefractal, limiting the FPS by a set amount works OK but wouldn't frame-skipping be better? That way you know your games will scale up the FPS for faster devices while maintaining an overall game speed that is the same on all devices.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3604
    • View Profile
    • Space Fractal
I limit by limitfps, and off course I have frameSkipping too, i just wanted to do stable constant framerate, so frameskipping is rare. Elsewise I would get too much varied fps on many levels, depend on content (tiles count from from 150 to around 900 onscreen).

Gameplay speed is same, fell same and just multiplied in update() for each regular paint(), except frameskipping.
« Last Edit: 2012-Jan-11 by spacefractal »
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10689
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Would it be cool to have a global offset/scale setting?
That way one could scale all 2D operations (OpenGL/ES only) with no performance impact.

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4143
  • On the shoulders of giants.
    • View Profile
    • My Apps
Would it be cool to have a global offset/scale setting?
That way one could scale all 2D operations (OpenGL/ES only) with no performance impact.
YES PLEASE! =D  :good:  :booze:  :enc:
I came. I saw. I played.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10689
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
I "think" it's possible with glTranslatef and glScalef right after a showscreen.
Can someone test this?

Online Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
resizable GLB-Screen  :)
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Marmor

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 908
  • 96A285CC
    • View Profile
    • my youtube channel
setscale
getscale
setblend
getblend

 :D :D :D