View Single Post
Old 16 March 2016, 11:36   #30
buzzybee
Registered User
 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 526
@majikeyric: I scale the pointer by a factor of 4, so 4 sprites can be on the same line. Plus, the code checks if these four "slots" in spritebuffer are already occupied before writing coords. In yes-case, the code does a litte search for the best available slot; in most cases by adding y+1 and skipping the uppermost line of the sprite in the drawing code.

Also, the code reminds itself of the uppermost and lowermost sprite coords, and searches the buffer only within these y-coordinates / y-slots. Therefore not the whole buffer needs to be searched through every time; only the area between the lowest and highest sprite. This saves a lot of memory access.
buzzybee is offline  
 
Page generated in 0.04895 seconds with 11 queries