So I was pretty confident I knew how it was done, until today I saw a grid which was parsed and displayed in LF2 correctly, when according to what I "knew", shouldn't have.
Here was my theory:
-- The width of the grid is divided (and probably floored ceiled ) by the X in "row: X".
-- Similarly, the height of the grid is divided by the Y in "col: Y".
-- Multiples of the result would act as the top-left coordinate of the clip in the grid.
- e.g:
- 700x500 sheets loaded with "row: 7 col: 5"
- 700/7 = 100. The clips/dirtyrects' left coordinates are multiples of that (7 of them, since row: 7): 0, 100, 200, 300, 400, 500, 600
- 500/5 = 100. and since col: 5: 0,..400
-- Now what sets the width and height of the clips recangles are the width and height specified in the "w: h:" tags.
-e.g:
- "w: 99 h: 99" would extend the rectangles from their left-top position to the right-bottom by 99 pixels, leaving out the 1 pixel lines. A value of 95 would leave space for a 5 pixel line and so it works.
Now here is the grid I came across:
![[Image: KG7nfZg.png]](http://i.imgur.com/KG7nfZg.png)
Original size: 1776x856
What I thought was the algorithm would kill the chances this would display correctly at step 1. Any idea how LF2 does this?
Here was my theory:
-- The width of the grid is divided (and probably floored ceiled ) by the X in "row: X".
-- Similarly, the height of the grid is divided by the Y in "col: Y".
-- Multiples of the result would act as the top-left coordinate of the clip in the grid.
- e.g:
- 700x500 sheets loaded with "row: 7 col: 5"
- 700/7 = 100. The clips/dirtyrects' left coordinates are multiples of that (7 of them, since row: 7): 0, 100, 200, 300, 400, 500, 600
- 500/5 = 100. and since col: 5: 0,..400
-- Now what sets the width and height of the clips recangles are the width and height specified in the "w: h:" tags.
-e.g:
- "w: 99 h: 99" would extend the rectangles from their left-top position to the right-bottom by 99 pixels, leaving out the 1 pixel lines. A value of 95 would leave space for a 5 pixel line and so it works.
Now here is the grid I came across:
![[Image: KG7nfZg.png]](http://i.imgur.com/KG7nfZg.png)
Original size: 1776x856
Code:
file(190-239): sprite\sys\One_Piece\luffyts_3.bmp w: 175 h: 160 row: 10 col: 5What I thought was the algorithm would kill the chances this would display correctly at step 1. Any idea how LF2 does this?
![[Image: signature.png]](http://s3.postimg.org/wedqxlk3n/signature.png)
A-Engine: A new beat em up game engine inspired by LF2. Coming soon
A-Engine Dev Blog - Update #8: Timeout

Chat


![[Image: FcPXyd9.png]](http://i.imgur.com/FcPXyd9.png)
![[Image: uMSShyX.png]](http://i.imgur.com/uMSShyX.png)


![[Image: sigline.png]](http://www.lf-empire.de/forum/images/unrealblack/english/sigline.png)