Changed puts() to take 'character position'

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@540 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-05-10 14:54:56 +00:00
parent 33ea589f50
commit 71cda11e65
2 changed files with 39 additions and 11 deletions

View file

@ -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);
}
/*
* Put a string at specified position and font
*/
void lcd_puts(int x, int y, char *str, int font)
void lcd_setfont(int newfont)
{
int nx = fonts[font];
int ny = fontheight[font];
font = newfont;
}
void lcd_setmargins(int x, int y)
{
xmargin = x;
ymargin = y;
}
/*
* Put a string at specified character position
*/
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[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];

View file

@ -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>