[nostalgia/core] Make sprite functions take core::Context argument
This commit is contained in:
parent
579b328212
commit
803b90d54c
@ -13,7 +13,7 @@
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Interrupt Handler
|
||||
|
||||
using interrupt_handler = void (*)(void);
|
||||
using interrupt_handler = void (*)();
|
||||
#define REG_ISR *reinterpret_cast<interrupt_handler*>(0x03007FFC)
|
||||
#define REG_IE *reinterpret_cast<volatile uint16_t*>(0x04000200)
|
||||
#define REG_IF *reinterpret_cast<volatile uint16_t*>(0x04000202)
|
||||
|
@ -214,7 +214,7 @@ void clearTileLayer(Context*, int layer) {
|
||||
memset(&MEM_BG_MAP[layer], 0, GbaTileRows * GbaTileColumns);
|
||||
}
|
||||
|
||||
void hideSprite(unsigned idx) {
|
||||
void hideSprite(Context*, unsigned idx) {
|
||||
GbaSpriteAttrUpdate oa;
|
||||
oa.attr0 = 2 << 8;
|
||||
oa.idx = idx;
|
||||
@ -234,7 +234,7 @@ void hideSprite(unsigned idx) {
|
||||
}
|
||||
}
|
||||
|
||||
void setSprite(unsigned idx, unsigned x, unsigned y, unsigned tileIdx, unsigned spriteShape, unsigned spriteSize, unsigned flipX) {
|
||||
void setSprite(Context*, unsigned idx, unsigned x, unsigned y, unsigned tileIdx, unsigned spriteShape, unsigned spriteSize, unsigned flipX) {
|
||||
GbaSpriteAttrUpdate oa;
|
||||
oa.attr0 = static_cast<uint16_t>(y & ox::onMask<uint8_t>(7))
|
||||
| (static_cast<uint16_t>(1) << 10) // enable alpha
|
||||
|
@ -127,6 +127,8 @@ void setTile(Context *ctx, int layer, int column, int row, uint8_t tile);
|
||||
|
||||
void clearTileLayer(Context*, int layer);
|
||||
|
||||
void setSprite(unsigned idx, unsigned x, unsigned y, unsigned tileIdx, unsigned spriteShape = 0, unsigned spriteSize = 0, unsigned flipX = 0);
|
||||
void hideSprite(Context*, unsigned);
|
||||
|
||||
void setSprite(Context*, unsigned idx, unsigned x, unsigned y, unsigned tileIdx, unsigned spriteShape = 0, unsigned spriteSize = 0, unsigned flipX = 0);
|
||||
|
||||
}
|
||||
|
@ -200,10 +200,10 @@ void setTile(Context *ctx, int layer, int column, int row, uint8_t tile) {
|
||||
id->bgTileMaps[z][y][x] = tile;
|
||||
}
|
||||
|
||||
void hideSprite(unsigned) {
|
||||
void hideSprite(Context*, unsigned) {
|
||||
}
|
||||
|
||||
void setSprite(unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned) {
|
||||
void setSprite(Context*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ using namespace nostalgia;
|
||||
static unsigned spriteX = 72;
|
||||
static unsigned spriteY = 64;
|
||||
|
||||
static int mainLoop(core::Context*) {
|
||||
static int mainLoop(core::Context *ctx) {
|
||||
if (core::buttonDown(core::GamePad_Right)) {
|
||||
spriteX += 2;
|
||||
} else if (core::buttonDown(core::GamePad_Left)) {
|
||||
@ -28,15 +28,15 @@ static int mainLoop(core::Context*) {
|
||||
} else if (core::buttonDown(core::GamePad_Up)) {
|
||||
spriteY -= 2;
|
||||
}
|
||||
core::setSprite(0, spriteX + 8, spriteY, 'n' - ('a' - 1));
|
||||
core::setSprite(1, spriteX + 16, spriteY, 'o' - ('a' - 1));
|
||||
core::setSprite(2, spriteX + 24, spriteY, 's' - ('a' - 1));
|
||||
core::setSprite(3, spriteX + 32, spriteY, 't' - ('a' - 1));
|
||||
core::setSprite(4, spriteX + 40, spriteY, 'a' - ('a' - 1));
|
||||
core::setSprite(5, spriteX + 48, spriteY, 'l' - ('a' - 1));
|
||||
core::setSprite(6, spriteX + 56, spriteY, 'g' - ('a' - 1));
|
||||
core::setSprite(7, spriteX + 64, spriteY, 'i' - ('a' - 1));
|
||||
core::setSprite(8, spriteX + 72, spriteY, 'a' - ('a' - 1));
|
||||
core::setSprite(ctx, 0, spriteX + 8, spriteY, 'n' - ('a' - 1));
|
||||
core::setSprite(ctx, 1, spriteX + 16, spriteY, 'o' - ('a' - 1));
|
||||
core::setSprite(ctx, 2, spriteX + 24, spriteY, 's' - ('a' - 1));
|
||||
core::setSprite(ctx, 3, spriteX + 32, spriteY, 't' - ('a' - 1));
|
||||
core::setSprite(ctx, 4, spriteX + 40, spriteY, 'a' - ('a' - 1));
|
||||
core::setSprite(ctx, 5, spriteX + 48, spriteY, 'l' - ('a' - 1));
|
||||
core::setSprite(ctx, 6, spriteX + 56, spriteY, 'g' - ('a' - 1));
|
||||
core::setSprite(ctx, 7, spriteX + 64, spriteY, 'i' - ('a' - 1));
|
||||
core::setSprite(ctx, 8, spriteX + 72, spriteY, 'a' - ('a' - 1));
|
||||
return 16;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user