aboutsummaryrefslogtreecommitdiff
path: root/source/nds/draw.c
diff options
context:
space:
mode:
authorNebuleon Fumika2012-12-20 23:52:09 -0500
committerNebuleon Fumika2012-12-20 23:52:09 -0500
commit712c249e8c2b614555a6492b520244fe12cd1910 (patch)
tree3b1fc258f4d31f1fff4a396a6194c02e486b0add /source/nds/draw.c
parent8a4343ff8e4114f19f034130a4b841a6b9a98217 (diff)
downloadsnes9x2005-712c249e8c2b614555a6492b520244fe12cd1910.tar.gz
snes9x2005-712c249e8c2b614555a6492b520244fe12cd1910.tar.bz2
snes9x2005-712c249e8c2b614555a6492b520244fe12cd1910.zip
Simplify the GUI code.
* gui.c: Simplify row and column checks when handling touch events. * draw.c, err_msg: Use ConsoleInit instead of a custom drawstring function when an initialisation error that is NOT related to DS2 I/O occurs. This allows \r\n to work. * gui.c, initialisation: Remove the Engrish in the "initial <subsystem name> error" messages. Make them appear in English and French. Unfortunately, the console doesn't support Chinese characters, and I don't know Chinese.
Diffstat (limited to 'source/nds/draw.c')
-rw-r--r--source/nds/draw.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/source/nds/draw.c b/source/nds/draw.c
index 6223c6e..b6c3f9b 100644
--- a/source/nds/draw.c
+++ b/source/nds/draw.c
@@ -1273,57 +1273,11 @@ void show_log(void* screen_addr)
}
/*************************************************************/
-extern const unsigned char font_map[128][8];
-
-//font size 8*8
-static inline void drawfont(unsigned short *addr, unsigned short f_color, unsigned short b_color, unsigned char ch)
-{
- unsigned char *dot_map;
- unsigned int j, k;
- unsigned char dot;
- unsigned short *dst;
-
- dot_map = (unsigned char*)font_map[ch&0x7F];
-
- for(j= 0; j < 8; j++)
- {
- dot = *dot_map++;
- dst = addr + j*SCREEN_WIDTH;
- for(k = 0; k < 8; k++)
- *dst++ = (dot & (0x80>>k)) ? f_color : b_color;
- }
-}
-
-static void drawstring(unsigned int x, unsigned int y, enum SCREEN_ID screen, char *string,
- unsigned short f_color, unsigned short b_color)
-{
- unsigned short *scr_addr, *dst;
-
- if(screen & UP_MASK)
- scr_addr = up_screen_addr;
- else
- scr_addr = down_screen_addr;
-
- if(x>= 32 || y>= 24) return;
-
- while(*string)
- {
- dst = scr_addr + (y*8)*SCREEN_WIDTH + x*8;
- drawfont(dst, f_color, b_color, *string++);
-
- x += 1;
- if(x>= 32)
- {
- x = 0;
- y+= 1;
- if(y >= 24) break;
- }
- }
-}
-
void err_msg(enum SCREEN_ID screen, char *msg)
{
- drawstring(0, 0, screen, msg, COLOR16(16, 16, 16), COLOR16(0, 0, 0));
+ // A wild console appeared!
+ ConsoleInit(RGB15(31, 31, 31), RGB15(0, 0, 0), UP_SCREEN, 512);
+ printf(msg);
}
/*
@@ -1372,5 +1326,3 @@ void blit_to_screen(void* screen_addr, u16 *src, u32 w, u32 h, u32 dest_x, u32 d
*dst++ = *src++;
}
}
-
-