summaryrefslogtreecommitdiff
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)
370 */ 370 */
371unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; 371unsigned char display[LCD_WIDTH][LCD_HEIGHT/8];
372 372
373static int font=0;
374static int xmargin=0;
375static int ymargin=0;
376
373/* 377/*
374 * ASCII character generation tables 378 * ASCII character generation tables
375 * 379 *
@@ -445,13 +449,35 @@ void lcd_clear_display (void)
445 memset (display, 0, sizeof display); 449 memset (display, 0, sizeof display);
446} 450}
447 451
452void lcd_setfont(int newfont)
453{
454 font = newfont;
455}
456
457void lcd_setmargins(int x, int y)
458{
459 xmargin = x;
460 ymargin = y;
461}
462
448/* 463/*
449 * Put a string at specified position and font 464 * Put a string at specified character position
450 */ 465 */
451void lcd_puts(int x, int y, char *str, int font) 466void lcd_puts(int x, int y, char *str)
467{
468 lcd_putsxy( xmargin + x*fonts[font],
469 ymargin + y*fontheight[font],
470 str, font );
471}
472
473/*
474 * Put a string at specified bit position
475 */
476
477void lcd_putsxy(int x, int y, char *str, int thisfont)
452{ 478{
453 int nx = fonts[font]; 479 int nx = fonts[thisfont];
454 int ny = fontheight[font]; 480 int ny = fontheight[thisfont];
455 int ch; 481 int ch;
456 unsigned char *src; 482 unsigned char *src;
457 int lcd_x = x; 483 int lcd_x = x;
@@ -680,7 +706,7 @@ void lcd_clearpixel(int x, int y)
680/* 706/*
681 * Return width and height of a given font. 707 * Return width and height of a given font.
682 */ 708 */
683void lcd_fontsize(char font, char *width, char *height) 709void lcd_getfontsize(int font, int *width, int *height)
684{ 710{
685 if(font < sizeof(fonts)) { 711 if(font < sizeof(fonts)) {
686 *width = fonts[font]; 712 *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 @@
28extern void lcd_init(void); 28extern void lcd_init(void);
29extern void lcd_clear_display(void); 29extern void lcd_clear_display(void);
30extern void lcd_backlight(bool on); 30extern void lcd_backlight(bool on);
31extern void lcd_puts(int x, int y, char *string);
31 32
32#ifdef HAVE_LCD_CHARCELLS 33#ifdef HAVE_LCD_CHARCELLS
33# define LCD_ICON_BATTERY 0 34# define LCD_ICON_BATTERY 0
@@ -60,7 +61,6 @@ extern void lcd_backlight(bool on);
60# define LCD_ICON_PARAM 10 61# define LCD_ICON_PARAM 10
61# define LCD_PARAM_SYMBOL 0xF0 62# define LCD_PARAM_SYMBOL 0xF0
62 63
63extern void lcd_puts(int x, int y, char *string);
64extern void lcd_define_pattern (int which,char *pattern,int length); 64extern void lcd_define_pattern (int which,char *pattern,int length);
65 65
66#endif 66#endif
@@ -73,8 +73,11 @@ extern void lcd_define_pattern (int which,char *pattern,int length);
73#define LCD_WIDTH 112 /* Display width in pixels */ 73#define LCD_WIDTH 112 /* Display width in pixels */
74#define LCD_HEIGHT 64 /* Display height in pixels */ 74#define LCD_HEIGHT 64 /* Display height in pixels */
75 75
76extern void lcd_update (void); 76extern void lcd_update(void);
77extern void lcd_puts(int x, int y, char *str, int font); 77extern void lcd_putsxy(int x, int y, char *string, int font);
78extern void lcd_setfont(int font);
79extern void lcd_getfontsize(int font, int *width, int *height);
80extern void lcd_setmargins(int xmargin, int ymargin);
78extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, 81extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
79 bool clear); 82 bool clear);
80extern void lcd_clearrect (int x, int y, int nx, int ny); 83extern 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 );
85extern void lcd_drawpixel(int x, int y); 88extern void lcd_drawpixel(int x, int y);
86extern void lcd_clearpixel(int x, int y); 89extern void lcd_clearpixel(int x, int y);
87 90
88void lcd_fontsize(char font, char *width, char *height);
89 91
90#if defined(HAVE_LCD_CHARCELLS) && defined(SIMULATOR) 92#if defined(HAVE_LCD_CHARCELLS) && defined(SIMULATOR)
91#include <charundef.h> 93#include <charundef.h>