Games XUI2D - How is the tilemap drawn?


Licensed User
Longtime User
hi "erel"

i am pointing this question to erel since he is the creator of xui2d.

i would like to understand how you add the tilemap the panel. and how it is positioning according to the world.

so if my world is 25 meters width and 15 meter height i have from the center of the world 12.5 meters to the right and 12.5 meters to the left and 7.5 meters to the top and 7.5 meters to the bottom.

now when i draw my tilemap is it also draw in the middle of the world?



B4X founder
Staff member
Licensed User
Longtime User
(0,0) = map bottom-left corner.

The correct way to set the world center is:
Dim WorldWidth As Float = 25 'meters
Dim WorldHeight As Float = WorldWidth / RatioSetInDesignerScript 'same ratio as in the designer script
X2.ConfigureDimensions(world.CreateVec2(WorldWidth / 2, WorldHeight / 2), WorldWidth)

The result should look like:


Above image is from the joints example (where the width is 6 meters).

ScreenAABB shows the bottom-left corner and the top-right corner coordinates.