sprito/example.py

27 lines
603 B
Python
Raw Normal View History

2020-04-09 18:13:04 +02:00
from sprito import *
#fill screen with black
fill_screen(C_BLACK)
#refresh
show_screen()
#draw yellow rectangle
rect(0, 0, 64, 64, C_YELLOW)
show_screen()
2020-04-09 18:13:04 +02:00
#create indexed sprite
sprite = SpriteIndexed(8, 8, [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]*8)
2020-04-09 18:13:04 +02:00
#create raw sprite from sprite
raw_sprite = sprite.to_raw(PALLET_BYTE)
2020-04-09 18:13:04 +02:00
#draw indexed sprite
sprite.draw(0, 0, PALLET_BYTE)
2020-04-09 18:13:04 +02:00
#draw raw sprite
raw_sprite.draw(16, 0)
#invert raw sprite
invert_rect(16, 0, 8, 8)
2020-04-09 18:15:42 +02:00
show_screen()
2020-04-12 19:01:59 +02:00
#store what we drew
copy = store_rect(0, 0, 64, 64)
#draw it again, twice
copy.draw(64, 0)
copy.draw(0, 64)
show_screen()