Skip to content

Commit

Permalink
Add an undocumented test feature: sprite offsetting
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauddupuis committed Aug 7, 2022
1 parent 2cdee44 commit 39eed52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pygamelib/gfx/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1579,12 +1579,14 @@ def render_to_buffer(self, buffer, row, column, buffer_height, buffer_width):
# self.size = i.size
# # display_buffer[row][col] = i

ro = self.row_offset
co = self.column_offset
# Attempt at optimization.
null_sprixel = Sprixel()
get_sprixel = self.sprixel
for sr in range(row, min(self.size[1] + row, buffer_height)):
for sc in range(column, min(self.size[0] + column, buffer_width)):
sprix = get_sprixel(sr - row, sc - column)
sprix = get_sprixel(sr - row + ro, sc - column + co)
# Need to check the empty/null sprixel in the sprite
# because for the sprite we just skip and leave the
# sprixel that is behind but when it comes to screen we
Expand Down

0 comments on commit 39eed52

Please sign in to comment.