Closed Starlight-30036225 closed 8 months ago
No it cannot. Ill fix this later.
The change I attempted to make to the draw cycle was to render pieces in the same step that the board squares were drawn. For instance, when drawing the first square at 0,0 that location on the board would be checked for a piece, which would likely be a rook, then that piece would be drawn. Then the draw cycle would move to the next square.
The problem arises when considering draw layers. The swift API layers each drawn sprite sequentially, meaning images drawn first will be under those drawn after. This causes the strange problem where, while dragging a piece, if moved towards a sprite drawn after itself, it will be displayed behind it.
In this image, the rook has been selected and moved slightly to the right, causing it to be drawn before the square.
An easy solution to this I didn't think to consider is simply render the selected piece after everything else.
I think the drawing of pieces can be greatly simplified.