1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Alan Korr
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
25 #include "lcd-charcell.h"
33 #include "font-player.h"
34 #include "lcd-playersim.h"
38 bool sim_lcd_framebuffer
[SIM_LCD_HEIGHT
][SIM_LCD_WIDTH
];
40 static int double_height
= 1;
42 void lcd_print_icon(int x
, int icon_line
, bool enable
, char **icon
)
45 int y
= (ICON_HEIGHT
+(CHAR_HEIGHT
*2+2)*CHAR_PIXEL
) * icon_line
;
50 for (row
= 0; icon
[row
]; row
++)
52 for (col
= 0; icon
[row
][col
]; col
++)
54 switch (icon
[row
][col
])
57 sim_lcd_framebuffer
[y
+row
][x
+col
] = enable
;
61 sim_lcd_framebuffer
[y
+row
][x
+col
] = false;
66 sim_lcd_update_rect(x
, y
, col
, row
);
67 /* icon drawing updates immediately */
70 void lcd_print_char(int x
, int y
, unsigned char ch
)
72 int xpos
= x
* CHAR_WIDTH
*CHAR_PIXEL
;
73 int ypos
= y
* CHAR_HEIGHT
*CHAR_PIXEL
+ ICON_HEIGHT
;
76 if (double_height
> 1 && y
== 1)
77 return; /* only one row available if text is double height */
79 for (row
= 0; row
< 7; row
++)
81 unsigned fontbitmap
= (*font_player
)[ch
][row
];
82 int height
= (row
== 3) ? 1 : double_height
;
84 y
= ypos
+ row
* CHAR_PIXEL
* double_height
;
85 for (col
= 0; col
< 5; col
++)
87 bool fontbit
= fontbitmap
& (0x10 >> col
);
89 x
= xpos
+ col
* CHAR_PIXEL
;
90 for (r
= 0; r
< height
* CHAR_PIXEL
; r
++)
91 for (c
= 0; c
< CHAR_PIXEL
; c
++)
92 sim_lcd_framebuffer
[y
+r
][x
+c
] = fontbit
;
95 if (double_height
> 1)
97 y
= ypos
+ 15*CHAR_PIXEL
;
98 for (r
= 0; r
< CHAR_PIXEL
; r
++)
99 for (c
= 0; c
< 5*CHAR_PIXEL
; c
++)
100 sim_lcd_framebuffer
[y
+r
][xpos
+c
] = false;
104 void lcd_double_height(bool on
)
106 int newval
= (is_new_player() && on
) ? 2 : 1;
108 if (newval
!= double_height
)
110 double_height
= newval
;
115 void sim_lcd_define_pattern(int pat
, const char *pattern
)
117 if (pat
< lcd_pattern_count
)
118 memcpy((*font_player
)[pat
], pattern
, 7);