Add relative scroll to backgrounds
This commit is contained in:
parent
454c5f7db7
commit
f353c89172
|
@ -25,9 +25,10 @@ public:
|
||||||
const int getCharBlock() { return charBlockIndex; }
|
const int getCharBlock() { return charBlockIndex; }
|
||||||
void useMapScreenBlock(int block) { screenBlockIndex = block; }
|
void useMapScreenBlock(int block) { screenBlockIndex = block; }
|
||||||
void scroll(int x, int y);
|
void scroll(int x, int y);
|
||||||
|
void scrollSpeed(int dx, int dy);
|
||||||
|
|
||||||
Background(int bgIndex, const void *data, int size, const void* map, int mapSize) : data(data), bgIndex(bgIndex), size(size), map(map),
|
Background(int bgIndex, const void *data, int size, const void* map, int mapSize) : data(data), bgIndex(bgIndex), size(size), map(map),
|
||||||
screenBlockIndex(0), charBlockIndex(0), mapSize(mapSize) {}
|
screenBlockIndex(0), charBlockIndex(0), mapSize(mapSize) {}
|
||||||
virtual void persist();
|
virtual void persist();
|
||||||
void updateMap(const void* map);
|
void updateMap(const void* map);
|
||||||
void clearMap();
|
void clearMap();
|
||||||
|
|
|
@ -78,4 +78,9 @@ void Background::buildRegister() {
|
||||||
void Background::scroll(int x, int y) {
|
void Background::scroll(int x, int y) {
|
||||||
REG_BG_OFS[bgIndex].x = x;
|
REG_BG_OFS[bgIndex].x = x;
|
||||||
REG_BG_OFS[bgIndex].y = y;
|
REG_BG_OFS[bgIndex].y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Background::scrollSpeed(int dx, int dy) {
|
||||||
|
REG_BG_OFS[bgIndex].x += dx;
|
||||||
|
REG_BG_OFS[bgIndex].y += dy;
|
||||||
}
|
}
|
Loading…
Reference in New Issue