summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-10 14:54:56 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-10 14:54:56 +0000
commit71cda11e65cf3d7ea6c9363d9505619508c301ba (patch)
treeecc498c877a01b9eb988a59888be90367d7f8e5e
parent33ea589f50c7166ebc8464b2d7bd84b5522983df (diff)
downloadrockbox-71cda11e65cf3d7ea6c9363d9505619508c301ba.tar.gz
rockbox-71cda11e65cf3d7ea6c9363d9505619508c301ba.zip
Changed puts() to take 'character position'
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@540 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/lcd.c36
-rw-r--r--firmware/drivers/lcd.h10
2 files changed, 37 insertions, 9 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index 66b1c682e7..d0e2c623de 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -370,6 +370,10 @@ void lcd_define_pattern (int which,char *pattern,int length)
*/
unsigned char display[LCD_WIDTH][LCD_HEIGHT/8];
+static int font=0;
+static int xmargin=0;
+static int ymargin=0;
+
/*
* ASCII character generation tables
*
@@ -445,13 +449,35 @@ void lcd_clear_display (void)
memset (display, 0, sizeof display);
}
+void lcd_setfont(int newfont)
+{
+ font = newfont;
+}
+
+void lcd_setmargins(int x, int y)
+{
+ xmargin = x;
+ ymargin = y;
+}
+
/*
- * Put a string at specified position and font
+ * Put a string at specified character position
*/
-void lcd_puts(int x, int y, char *str, int font)
+void lcd_puts(int x, int y, char *str)
+{
+ lcd_putsxy( xmargin + x*fonts[font],
+ ymargin + y*fontheight[font],
+ str, font );
+}
+
+/*
+ * Put a string at specified bit position
+ */
+
+void lcd_putsxy(int x, int y, char *str, int thisfont)
{
- int nx = fonts[font];
- int ny = fontheight[font];
+ int nx = fonts[thisfont];
+ int ny = fontheight[thisfont];
int ch;
unsigned char *src;
int lcd_x = x;
@@ -680,7 +706,7 @@ void lcd_clearpixel(int x, int y)
/*
* Return width and height of a given font.
*/
-void lcd_fontsize(char font, char *width, char *height)
+void lcd_getfontsize(int font, int *width, int *height)
{
if(font < sizeof(fonts)) {
*width = fonts[font];
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h
index 21da38188a..3bbf89a92c 100644
--- a/firmware/drivers/lcd.h
+++ b/firmware/drivers/lcd.h
@@ -28,6 +28,7 @@
extern void lcd_init(void);
extern void lcd_clear_display(void);
extern void lcd_backlight(bool on);
+extern void lcd_puts(int x, int y, char *string);
#ifdef HAVE_LCD_CHARCELLS
# define LCD_ICON_BATTERY 0
@@ -60,7 +61,6 @@ extern void lcd_backlight(bool on);
# define LCD_ICON_PARAM 10
# define LCD_PARAM_SYMBOL 0xF0
-extern void lcd_puts(int x, int y, char *string);
extern void lcd_define_pattern (int which,char *pattern,int length);
#endif
@@ -73,8 +73,11 @@ extern void lcd_define_pattern (int which,char *pattern,int length);
#define LCD_WIDTH 112 /* Display width in pixels */
#define LCD_HEIGHT 64 /* Display height in pixels */
-extern void lcd_update (void);
-extern void lcd_puts(int x, int y, char *str, int font);
+extern void lcd_update(void);
+extern void lcd_putsxy(int x, int y, char *string, int font);
+extern void lcd_setfont(int font);
+extern void lcd_getfontsize(int font, int *width, int *height);
+extern void lcd_setmargins(int xmargin, int ymargin);
extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
bool clear);
extern void lcd_clearrect (int x, int y, int nx, int ny);
@@ -85,7 +88,6 @@ extern void lcd_drawline( int x1, int y1, int x2, int y2 );
extern void lcd_drawpixel(int x, int y);
extern void lcd_clearpixel(int x, int y);
-void lcd_fontsize(char font, char *width, char *height);
#if defined(HAVE_LCD_CHARCELLS) && defined(SIMULATOR)
#include <charundef.h>