slides.pdf

(135 KB) Pobierz
Systems Programming
TP 5 –Sprites – Interruptions – Timers
Sprite – What is it?
�½
�½
2D Image made out of pixels!
For the GBA, sprites sizes that are supported are
�½
�½
�½
�½
8x8 pixels
16x16 pixels
32x32 pixels
64x64 pixels
�½
�½
Sprites are hardware accelerated thus really fast
Animations can be created using sprites
Mario in Super Mario bros in the Nintendo
Entertainment System was a 32x32 pixel
sprite.
2
How to manage the sprites?
Three memory addresses:
SpriteMEM:
SpriteData:
SpritePal:
Information about the sprite.
The pixels of the sprite.
The color palette for the sprite.
3
Graphics mode for sprites – Tile Modes
�½
Mode 0:
�½
�½
Support for 4 backgrounds (bg0, bg1, bg2, bg3)
No scaling / rotation
Support of 3 backgrounds (bg0, bg1, bg2)
Scaling and rotation supported only in bg2
Support of 2 backgrounds (bg2, bg3)
Scaling and rotation supported on bg2 and bg3
�½
Mode 1:
�½
�½
�½
Mode 2:
�½
�½
4
Time to get your hands dirty…
�½
�½
You can get away with using C for this TP.
We will be using mode 2 for this TP
*(unsigned short*) 0x4000000 = 2 | 0x1000 |
0x40;
Enable
sprites
Use a
specific
sprite layout
map
5
Zgłoś jeśli naruszono regulamin