mirror of
https://github.com/irmen/prog8.git
synced 2024-11-22 00:31:56 +00:00
added sprites.reset() to remove sprites from the screen
This commit is contained in:
parent
1d38c3582a
commit
d70b8303b1
@ -34,6 +34,22 @@ sprites {
|
||||
cx16.vpoke(1, sprite_reg+7, height_flag<<6 | width_flag<<4 | palette_offset&15) ; 64x64 pixels, palette offset
|
||||
}
|
||||
|
||||
sub reset(ubyte spritenum_start, ubyte count) {
|
||||
; resets all sprite attributes for the given sprite range
|
||||
; this removes these sprites from the screen completely
|
||||
; (without disabling sprites globally so the mouse cursor remains visible)
|
||||
if spritenum_start > 127
|
||||
return
|
||||
if count + spritenum_start > 128
|
||||
return
|
||||
cx16.VERA_CTRL = $00
|
||||
cx16.VERA_ADDR_H = $11
|
||||
cx16.VERA_ADDR = VERA_SPRITEREGS + spritenum_start * $0008
|
||||
repeat count {
|
||||
unroll 8 cx16.VERA_DATA0 = $00
|
||||
}
|
||||
}
|
||||
|
||||
sub data(ubyte spritenum, ubyte bank, uword addr) {
|
||||
addr >>= 5
|
||||
addr |= (bank as uword)<<11
|
||||
|
@ -2,6 +2,8 @@ TODO
|
||||
====
|
||||
|
||||
|
||||
- make "block address must be at least program load address + 20 (to allow for startup logic)" more flexible; the 20 should be a constant in the compilation target
|
||||
|
||||
...
|
||||
|
||||
|
||||
|
@ -1,12 +1,19 @@
|
||||
%import sprites
|
||||
%import textio
|
||||
%option no_sysinit
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
txt.print_uwhex(sys.progstart(), true)
|
||||
txt.spc()
|
||||
txt.print_uwhex(sys.progend(), true)
|
||||
txt.nl()
|
||||
ubyte sprite
|
||||
|
||||
for sprite in 1 to 99 {
|
||||
sys.wait(1)
|
||||
sprites.init(sprite, 0, 0, sprites.SIZE_8, sprites.SIZE_8, sprites.COLORS_256, 0)
|
||||
sprites.pos(sprite, 10 + sprite*10, 10+sprite*4)
|
||||
}
|
||||
|
||||
sprites.reset(1, 100)
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user