BASIC

Author Topic: "Yet Another Android Resolution / Scaling Thread"  (Read 8419 times)

Offline Crivens

  • Prof. Inline
  • *****
  • Posts: 913
    • View Profile
No worries. That code should be a full demo project. Good luck with it all!

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

Offline caffeinekid

  • Mr. Drawsprite
  • **
  • Posts: 51
    • View Profile
    • TCKSOFT
This code I sent you works on my tablet Coby Kyros 7024 2.2 as in Windows.

I changed the project settings Android screen size from your 9999x9999 to 2000x2000. Try setting up your real device resolution...

Yeah everything is working fine in windows.. but unfortunately not on this asus transformer tablet :/ I tried changing the project resolution to 800x1280, but it does the same thing.. I think the resolution is being set up fine, as I can see the drawing commands I'm doing to the backbuffer and they seem to be in native (tiny) resolution. It's just the CREATESCREEN part that I think isn't working on this particular device

I used the sc() function for scaling in my project and I've just got a 1 star review saying that on a Asus Transformer no graphics are displayed. Does anyone know how to get around this or if there is a possible fix while still being able to scale the graphics easily up or down?

Offline Falstaff

  • Mr. Polyvector
  • ***
  • Posts: 148
    • View Profile
Yeah I'm just about to re-examine how I do scaling in my game as I sorta put it aside for a bit to focus on other aspects in my game. I don't have my Transformer anymore so I can't do direct testing, but I remember seeing another forum member posting about having one and noticing similar issues..

That being said, Crivens' method he outlines in his post here: http://www.glbasic.com/forum/index.php?topic=6415.0 might be my next attempted implementation. AFAIK it'll run on first run of your app, and loads each image and scales it to the specific resolution of the device, then saves it back to the device. From there on out you just load those custom tailored images and draw them using regular drawing commands. This does of course mean you have to account for the scaling in each line of code you have that deals w/ rendering/collisions, etc (which you haven't had to with your method)

Alternatively, I noticed that the STRETCHSPRITE command worked on the Transformer - so you could use that to scale each image on-the-fly. Of course Crivens' method would be faster than that, but it's another option..

I just wish we could somehow get CREATESCREEN fixed on that device - I don't know if it's a driver issue or a GLB issue, but yeah it sucks in any case, which leaves us with these workarounds.
« Last Edit: 2011-Oct-18 by Falstaff »

Offline caffeinekid

  • Mr. Drawsprite
  • **
  • Posts: 51
    • View Profile
    • TCKSOFT
I hope it's a easy fixable problem in the createscreen command rather than something that is hit and miss across devices because that would kind of put a dampener on things. It seemed like such a good way of supporting lots of screen sizes with the minimum of fuss. :(

Offline Falstaff

  • Mr. Polyvector
  • ***
  • Posts: 148
    • View Profile
Well what do you know, there may be hope yet!

Offline sf-in-sf

  • Mr. Drawsprite
  • **
  • Posts: 93
  • Artist F.P. Brixey
    • View Profile
    • My computed art project
My Android tablet 2.3 fails miserably on grabsprite/mem2sprite, and Gernot says it is a driver issue...

Same problem here, GRABSPRITE not working on android tablet archos 101G9.
Dear Administrator, i'm facing a strange problem with my android tablet:
i use LOADSPRITE (bmp and png), STRETCHSPRITE, GRABSPRITE.
After some tests, GRABSPRITE works on the local win7 compilation, on the Android emulator, but not on the device (Archos 101G9). What's up Doc'? (driver issue?)

The program: one set of a game keeps displaying the same few sprites over and over, and each set has its own sprite size, to maximize screen space usage.
My strategy to spare some repeated stretchings by creating some "pre-fetched" sprites to the right size:
Code: GLBasic [Select]
LOADSPRITE "name.png", 10 // about twice too big
//  SETORIENTATION 0
STRETCHSPRITE 10, 0,0,  newsize, newsize //correct size, smaller. Printed on backbuffer
GRABSPRITE 10, 0,0,  newsize, newsize // or assign a new SpriteNumber, same result (sob)

//inside the drawing function
DRAWSPRITE 10, poz_x, poz_y   // always working

//even later
SHOWSCREEN

 i tried various "setorientation values" to no avail, as well as setting android:resizable="true" in AndroidManifest.xml. I also tried to replace the coordinates 0,0 with 2,2 for stretchsprite and grabsprite, without result.
However, using only some repeated STRETCHSPRITE 's does work (but CPU consumming, not elegant).

Any idea anyone?

PS the rest works well now. i do a fresh win7 boot, connect the tablet or open the simulator, open a console and type "adb devices" or "adb usb", start GLbasic as administrator, then the automatic installation on the device/emulator does work from the IDE compilation for android. Nice job Gernot!  :nw:  =D
On the day the atom is a cube I will start believing in the square pixel.

Offline Jonás Perusquía

  • Mr. Polyvector
  • ***
  • Posts: 170
    • View Profile
    • Ditrabox
Tha main problem should be the resize of the background since it should be easy to resize sprites
<HTML><BASIC><EC>
Be free and do good things

MrTAToad

  • Guest
Tiling a sprite can be done very quickly using POLYVECTOR as long as the graphics size is a power of two.  There are a few commands that dont work with and some that are dependant on having decent drivers