summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2010-11-19 14:52:49 +0000
committerIan C <ianc@noddybox.co.uk>2010-11-19 14:52:49 +0000
commit1f3fcd6a589cbee299d37f418af8ee08d10679a3 (patch)
tree7b6128a2f079a4525df60296c8de564f4635dbc5 /source
parentaa4c85d56726d18ec999f08a90b4e2ac1028515a (diff)
Fixed compilation problems with new libnds.
Note: Resulting binaries untested.
Diffstat (limited to 'source')
-rw-r--r--source/gui.c12
-rw-r--r--source/main.c67
-rw-r--r--source/touchwrap.c2
3 files changed, 39 insertions, 42 deletions
diff --git a/source/gui.c b/source/gui.c
index 3579f69..46ae67a 100644
--- a/source/gui.c
+++ b/source/gui.c
@@ -259,7 +259,9 @@ int GUI_Menu(const char *opts[])
}
else if (key & KEY_TOUCH)
{
- touchPosition tp=touchReadXY();
+ touchPosition tp;
+
+ touchRead(&tp);
if (tp.px>=x && tp.px<(w+w) && tp.py>=y && tp.py<(y+h))
{
@@ -421,9 +423,11 @@ void GUI_Config(void)
}
else if (key & KEY_TOUCH)
{
- touchPosition tp = touchReadXY();
+ touchPosition tp;
int nsel;
+ touchRead(&tp);
+
nsel = (tp.py-18)/14;
if (nsel>=0 && nsel<DS81_NUM_CONFIG_ITEMS)
@@ -532,7 +536,7 @@ int GUI_FileSelect(char pwd[], char selected_file[], const char *filter)
while (((key=keysHeld()) & KEY_TOUCH) && diff == 0)
{
- tp = touchReadXY();
+ touchRead(&tp);
diff = tp.py - drag_start;
swiWaitForVBlank();
}
@@ -579,7 +583,7 @@ int GUI_FileSelect(char pwd[], char selected_file[], const char *filter)
{
touchPosition tp;
- tp = touchReadXY();
+ touchRead(&tp);
if (tp.py >= FSEL_LIST_Y && tp.py <= (FSEL_LIST_Y+FSEL_LIST_H))
{
diff --git a/source/main.c b/source/main.c
index 3407a88..010210c 100644
--- a/source/main.c
+++ b/source/main.c
@@ -81,6 +81,14 @@ typedef enum
#endif
} MenuOpt;
+
+/* Backgrounds
+*/
+static int main_bitmap_bg;
+static int main_text_overlay_bg;
+static int sub_bitmap_bg;
+static int sub_text_overlay_bg;
+
/* ---------------------------------------- IRQ FUNCS
*/
@@ -132,8 +140,7 @@ static void Splash(void)
"20 print \"%the zx81 is ace%\"\n"
"30 goto 20");
- SUB_BG2_XDX = 0x080;
- SUB_BG2_YDY = 0x080;
+ bgSetScale(sub_text_overlay_bg, 0x80, 0x80);
TM_printf(0,11,"%-18.18s",scroller);
@@ -217,12 +224,13 @@ static void Splash(void)
TM_printf(0,11,"%-18.18s",scroller);
}
- SUB_BG2_CX = scr_x << 8;
+ bgSetScroll(sub_text_overlay_bg, scr_x << 8, 0);
+ bgUpdate();
}
- SUB_BG2_XDX = 0x100;
- SUB_BG2_YDY = 0x100;
- SUB_BG2_CX = 0;
+ bgSetScale(sub_text_overlay_bg, 0x100, 0x100);
+ bgSetScroll(sub_text_overlay_bg, 0, 0);
+ bgUpdate();
TM_Cls();
@@ -298,31 +306,24 @@ int main(int argc, char *argv[])
{
Z80 *z80;
- powerON(POWER_ALL_2D);
+ powerOn(POWER_ALL_2D);
/* Set up main screen for ZX81 and load the ROM character data
*/
- videoSetMode(MODE_3_2D | DISPLAY_BG0_ACTIVE | DISPLAY_BG3_ACTIVE);
+ videoSetMode(MODE_3_2D);
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
- BG0_CR = BG_COLOR_256 | BG_32x32 | BG_MAP_BASE(0) |
- BG_TILE_BASE(1) | BG_PRIORITY(0);
- BG0_X0 = 0;
- BG0_Y0 = 0;
+ main_bitmap_bg = bgInit(0, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
+ main_text_overlay_bg = bgInit(3, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
+
+ bgSetPriority(main_bitmap_bg, 1);
+ bgSetPriority(main_text_overlay_bg, 0);
BG_PALETTE[0] = RGB15(31,31,31);
BG_PALETTE[1] = RGB15(0,0,0);
- BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(2) | BG_PRIORITY(1);
- BG3_XDX = 0x100;
- BG3_XDY = 0;
- BG3_YDX = 0;
- BG3_YDY = 0x100;
- BG3_CX = 0;
- BG3_CY = 0;
-
dmaCopy(rom_font_bin,(void *)BG_TILE_RAM(1),rom_font_bin_size);
/* Set up the sub-screen for rotation (basically for use as a framebuffer).
@@ -331,25 +332,17 @@ int main(int argc, char *argv[])
the ZX81 run). Having said the overlay is currently a rotation map
for some pointless frippery! Still be quicker though.
*/
- videoSetModeSub(MODE_4_2D | DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE);
+ videoSetModeSub(MODE_4_2D);
+ videoBgEnableSub(2);
+ videoBgEnableSub(3);
+
vramSetBankC(VRAM_C_SUB_BG_0x06200000);
- SUB_BG2_CR = BG_COLOR_256 | BG_RS_32x32 | BG_MAP_BASE(4) |
- BG_TILE_BASE(0) | BG_PRIORITY(0);
- SUB_BG2_XDX = 0x100;
- SUB_BG2_XDY = 0;
- SUB_BG2_YDX = 0;
- SUB_BG2_YDY = 0x100;
- SUB_BG2_CX = 0;
- SUB_BG2_CY = 0;
-
- SUB_BG3_CR = BG_BMP8_256x256 | BG_BMP_BASE(1) | BG_PRIORITY(1);
- SUB_BG3_XDX = 0x100;
- SUB_BG3_XDY = 0;
- SUB_BG3_YDX = 0;
- SUB_BG3_YDY = 0x100;
- SUB_BG3_CX = 0;
- SUB_BG3_CY = 0;
+ sub_bitmap_bg = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 1, 0);
+ sub_text_overlay_bg = bgInit(2, BgType_Rotation, BgSize_R_256x256, 4, 0);
+
+ bgSetPriority(sub_bitmap_bg, 1);
+ bgSetPriority(sub_text_overlay_bg, 0);
/* Tell 'framebuffer' routines to use this
*/
diff --git a/source/touchwrap.c b/source/touchwrap.c
index 4fa373b..3d1aa98 100644
--- a/source/touchwrap.c
+++ b/source/touchwrap.c
@@ -35,7 +35,7 @@ int AllowTouch(touchPosition *tp)
int16 dy;
int res;
- *tp = touchReadXY();
+ touchRead(tp);
if (DS81_Config[DS81_AVERAGE_TOUCHSCREEN])
{