2023-01-20 10:01:15 +01:00
|
|
|
#include "gamepad.h"
|
2022-12-31 12:14:57 +01:00
|
|
|
#include <gsa.h>
|
|
|
|
|
|
|
|
void init() {
|
2023-01-20 09:30:34 +01:00
|
|
|
i32 x, y;
|
2022-12-31 12:14:57 +01:00
|
|
|
|
2023-01-20 09:30:34 +01:00
|
|
|
for(y = 0; y < 11; ++y) {
|
|
|
|
for(x = 0; x < 19; ++x) {
|
|
|
|
maps[0].tiles[x][y] = 0x1000;
|
|
|
|
}
|
|
|
|
}
|
2023-01-07 14:22:22 +01:00
|
|
|
|
2023-01-20 09:30:34 +01:00
|
|
|
for(y = 0; y < 11; y += 2) {
|
|
|
|
maps[0].tiles[0][y] = 0x1101;
|
|
|
|
maps[0].tiles[1][y] = 0x1102;
|
|
|
|
maps[0].tiles[0][y + 1] = 0x1201;
|
|
|
|
maps[0].tiles[1][y + 1] = 0x1202;
|
|
|
|
|
|
|
|
maps[0].tiles[17][y] = 0x1101;
|
|
|
|
maps[0].tiles[18][y] = 0x1102;
|
|
|
|
maps[0].tiles[17][y + 1] = 0x1201;
|
|
|
|
maps[0].tiles[18][y + 1] = 0x1202;
|
|
|
|
}
|
2022-12-31 12:14:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void tick() {
|
2023-01-20 10:01:15 +01:00
|
|
|
i32 x, y;
|
|
|
|
|
|
|
|
x = sw_gamepads[0].button_down[SW_GAMEPAD_BUTTON_DPAD_LEFT] -
|
|
|
|
sw_gamepads[0].button_down[SW_GAMEPAD_BUTTON_DPAD_RIGHT];
|
|
|
|
y = sw_gamepads[0].button_down[SW_GAMEPAD_BUTTON_DPAD_UP] -
|
|
|
|
sw_gamepads[0].button_down[SW_GAMEPAD_BUTTON_DPAD_DOWN];
|
|
|
|
|
|
|
|
maps[0].scrollx -= x;
|
|
|
|
maps[0].scrolly -= y;
|
2022-12-31 12:14:57 +01:00
|
|
|
}
|