Much Ado About Nullptr


The way BlastEd originally displayed selected tiles was, I felt, a waste of cycles. What would happen was this: for every mouse movement a vector would be initialized, created and populated with the indexed number of tiles within the square. It would then redraw all these tiles. A method that was fine for small selection boxes. And, for the Mega Drive entire tile maps aren't large. But, it's still poorly optimised. It calls a lot to the draw function.  Plus, the mouse pointer isn't contiguous with the tile selection which can lead to artifacts.

The previously described method was simple but inelegant. I've since devised a strategy to lift some of the burden from the draw function.  As always it's a tradeoff between computation and space. With this method I hope to mitigate some of the effort required to selected some tiles.

Bear in mind that the following is just an outline and that Vector is used to reference a dynamic array in C++, and Point is used to describe a co-ordinate (x/y.) Initially two points of an adjacent line are compared and sorted into ascending order so we have left-most and right-most points. All tiles within this collider are pushed back into the vector. The vector is then copied to draw. On each mouse drag the vector is recreated. However, it is then compared to the vector copied to draw and only the tiles that are in and out are marked for redraw.

UML is not available but Ibuprofen can be obtained from your local pharmacy.

Get BlastEd - Mega Drive/Genesis Graphics Tool

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.