Android Question [XUI2D] res., density and screens-size

LucaMs

Expert
Licensed User
Longtime User
Almost for fun (for the moment, completed a certain project, I think I will study this platform well) I only wanted to modify a couple of PNGs in the example "Walking character".

Actually the first idea was to add a banner (not ads, a drawing) as an object but then, not knowing that sw, I decided to draw it directly on the PNG used as the game background.

At runtime this banner had poor quality, although the background had the same original quality; so I noticed that even the birds (not modified), on my smartphone, appeared to be involuntarily pixelated.

As for the images of birds, I realized that they were too big and that they lose quality during the downsizing process. I don't know if XUI2D performs this "adaptation" or the Android APIs do it in this case (perhaps both). Decreasing the resolution of these PNGs included in the project, the birds look much better.

I know that in Android projects usually (almost always, I would say) different folders of graphic resources are used and that it is the OS that at runtime chooses the most suitable for the device (I don't know why with B4A this is not the case, we use some methods such as InitializeResize of Bitmaps and this has the problem just described, that is if the factor of increase or decrease of the dimensions is too big, quality of the images is lost).

First question: how to manage a couple of folders with different graphic resources in XUI2D?

Second question: why the "banner" drawn loses so much quality (and maybe I would like a suggestion on how to do it differently, perhaps like the original idea, create a banner object).


Thanks
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Second question: why the "banner" drawn loses so much quality (and maybe I would like a suggestion on how to do it differently, perhaps like the original idea, create a banner object).

[Erel wrote:]
You should also download Tiled map editor: https://www.mapeditor.org/
Most of the examples use a tiled json file to define the objects. In the Mario and Tiles Map example the background is based on a tiles layer.
;)



(Questions are still open :))
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I know that in Android projects usually (almost always, I would say) different folders of graphic resources are used and that it is the OS that at runtime chooses the most suitable for the device (I don't know why with B4A this is not the case, we use some methods such as InitializeResize of Bitmaps and this has the problem just described, that is if the factor of increase or decrease of the dimensions is too big, quality of the images is lost).
This has nothing to do with XUI2D sprites.

For performance reasons the graphic layer created by XUI2D is always with a scale of 160 pixels per inch.
 
Upvote 0
Top