2002-10-11 11:10:52 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Alan Korr
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-11 11:10:52 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include "config.h"
|
2002-10-18 09:20:48 +00:00
|
|
|
#include "hwcompat.h"
|
2002-10-11 11:10:52 +00:00
|
|
|
|
|
|
|
#include "lcd.h"
|
2007-03-31 09:58:49 +00:00
|
|
|
#include "lcd-charcell.h"
|
2002-10-11 11:10:52 +00:00
|
|
|
#include "kernel.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "debug.h"
|
|
|
|
#include "system.h"
|
2002-10-21 20:20:09 +00:00
|
|
|
|
|
|
|
#include "font-player.h"
|
2002-10-28 20:00:19 +00:00
|
|
|
#include "lcd-playersim.h"
|
2002-10-11 11:10:52 +00:00
|
|
|
|
|
|
|
/*** definitions ***/
|
|
|
|
|
2007-03-31 09:58:49 +00:00
|
|
|
bool sim_lcd_framebuffer[SIM_LCD_HEIGHT][SIM_LCD_WIDTH];
|
2002-10-28 20:00:19 +00:00
|
|
|
|
2007-03-31 09:58:49 +00:00
|
|
|
static int double_height = 1;
|
2002-10-11 11:10:52 +00:00
|
|
|
|
2002-10-21 20:20:09 +00:00
|
|
|
void lcd_print_icon(int x, int icon_line, bool enable, char **icon)
|
2002-10-11 11:10:52 +00:00
|
|
|
{
|
2012-01-22 20:29:43 +00:00
|
|
|
int row = 0, col = 0; /* shut up gcc */
|
2007-03-31 09:58:49 +00:00
|
|
|
int y = (ICON_HEIGHT+(CHAR_HEIGHT*2+2)*CHAR_PIXEL) * icon_line;
|
2002-10-28 20:00:19 +00:00
|
|
|
|
2007-03-31 09:58:49 +00:00
|
|
|
y += BORDER_MARGIN;
|
|
|
|
x += BORDER_MARGIN;
|
2006-02-20 00:31:10 +00:00
|
|
|
|
2012-01-22 20:29:43 +00:00
|
|
|
for (; icon[row]; row++)
|
2007-03-31 09:58:49 +00:00
|
|
|
{
|
2012-01-22 20:29:43 +00:00
|
|
|
for (; icon[row][col]; col++)
|
2007-03-31 09:58:49 +00:00
|
|
|
{
|
|
|
|
switch (icon[row][col])
|
|
|
|
{
|
|
|
|
case '*':
|
|
|
|
sim_lcd_framebuffer[y+row][x+col] = enable;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ' ':
|
|
|
|
sim_lcd_framebuffer[y+row][x+col] = false;
|
|
|
|
break;
|
|
|
|
}
|
2002-10-28 20:00:19 +00:00
|
|
|
}
|
2002-10-11 11:10:52 +00:00
|
|
|
}
|
2007-03-31 09:58:49 +00:00
|
|
|
sim_lcd_update_rect(x, y, col, row);
|
|
|
|
/* icon drawing updates immediately */
|
2002-10-21 20:20:09 +00:00
|
|
|
}
|
2002-10-11 11:10:52 +00:00
|
|
|
|
2007-03-31 09:58:49 +00:00
|
|
|
void lcd_print_char(int x, int y, unsigned char ch)
|
2002-10-21 20:20:09 +00:00
|
|
|
{
|
2007-03-31 09:58:49 +00:00
|
|
|
int xpos = x * CHAR_WIDTH*CHAR_PIXEL;
|
|
|
|
int ypos = y * CHAR_HEIGHT*CHAR_PIXEL + ICON_HEIGHT;
|
|
|
|
int row, col, r, c;
|
|
|
|
|
|
|
|
if (double_height > 1 && y == 1)
|
|
|
|
return; /* only one row available if text is double height */
|
|
|
|
|
|
|
|
for (row = 0; row < 7; row ++)
|
|
|
|
{
|
|
|
|
unsigned fontbitmap = (*font_player)[ch][row];
|
|
|
|
int height = (row == 3) ? 1 : double_height;
|
|
|
|
|
|
|
|
y = ypos + row * CHAR_PIXEL * double_height;
|
|
|
|
for (col = 0; col < 5; col++)
|
|
|
|
{
|
|
|
|
bool fontbit = fontbitmap & (0x10 >> col);
|
|
|
|
|
|
|
|
x = xpos + col * CHAR_PIXEL;
|
|
|
|
for (r = 0; r < height * CHAR_PIXEL; r++)
|
|
|
|
for (c = 0; c < CHAR_PIXEL; c++)
|
|
|
|
sim_lcd_framebuffer[y+r][x+c] = fontbit;
|
2003-06-05 08:29:21 +00:00
|
|
|
}
|
2002-10-11 11:10:52 +00:00
|
|
|
}
|
2007-03-31 09:58:49 +00:00
|
|
|
if (double_height > 1)
|
|
|
|
{
|
|
|
|
y = ypos + 15*CHAR_PIXEL;
|
|
|
|
for (r = 0; r < CHAR_PIXEL; r++)
|
|
|
|
for (c = 0; c < 5*CHAR_PIXEL; c++)
|
|
|
|
sim_lcd_framebuffer[y+r][xpos+c] = false;
|
|
|
|
}
|
2002-10-11 11:10:52 +00:00
|
|
|
}
|
|
|
|
|
2002-10-18 09:20:48 +00:00
|
|
|
void lcd_double_height(bool on)
|
2002-10-11 11:10:52 +00:00
|
|
|
{
|
2007-03-31 09:58:49 +00:00
|
|
|
int newval = (is_new_player() && on) ? 2 : 1;
|
|
|
|
|
|
|
|
if (newval != double_height)
|
2002-10-18 09:20:48 +00:00
|
|
|
{
|
2007-03-31 09:58:49 +00:00
|
|
|
double_height = newval;
|
|
|
|
lcd_update();
|
2002-10-18 09:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
2002-10-11 11:10:52 +00:00
|
|
|
|
2007-03-31 09:58:49 +00:00
|
|
|
void sim_lcd_define_pattern(int pat, const char *pattern)
|
|
|
|
{
|
|
|
|
if (pat < lcd_pattern_count)
|
|
|
|
memcpy((*font_player)[pat], pattern, 7);
|
|
|
|
}
|