summaryrefslogtreecommitdiff
path: root/uisimulator/win32/lcd-win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/win32/lcd-win32.c')
-rw-r--r--uisimulator/win32/lcd-win32.c71
1 files changed, 69 insertions, 2 deletions
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c
index 2b582c0e28..dcdb16f1f1 100644
--- a/uisimulator/win32/lcd-win32.c
+++ b/uisimulator/win32/lcd-win32.c
@@ -21,6 +21,7 @@
21#include <process.h> 21#include <process.h>
22#include "uisw32.h" 22#include "uisw32.h"
23#include "lcd.h" 23#include "lcd.h"
24#include "lcd-playersim.h"
24 25
25unsigned char lcd_framebuffer[LCD_WIDTH][LCD_HEIGHT/8]; /* the display */ 26unsigned char lcd_framebuffer[LCD_WIDTH][LCD_HEIGHT/8]; /* the display */
26char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */ 27char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
@@ -32,12 +33,20 @@ BITMAPINFO2 bmi =
32 BI_RGB, 0, 0, 0, 2, 2, 33 BI_RGB, 0, 0, 0, 2, 2,
33 }, 34 },
34 { 35 {
35 {UI_LCD_BGCOLOR, 0}, /* green background color */ 36 //{UI_LCD_BGCOLOR, 0}, /* green background color */
37 {UI_LCD_BGCOLORLIGHT, 0}, /* green background color */
36 {UI_LCD_BLACK, 0} /* black color */ 38 {UI_LCD_BLACK, 0} /* black color */
37 } 39 }
38 40
39}; /* bitmap information */ 41}; /* bitmap information */
40 42
43#ifdef HAVE_LCD_CHARCELLS
44/* Defined in lcd-playersim.c */
45extern void lcd_print_char(int x, int y);
46extern bool lcd_display_redraw;
47extern unsigned char hardware_buffer_lcd[11][2];
48static unsigned char lcd_buffer_copy[11][2];
49#endif
41 50
42void lcd_set_invert_display(bool invert) 51void lcd_set_invert_display(bool invert)
43{ 52{
@@ -52,6 +61,23 @@ void lcd_update()
52 if (hGUIWnd == NULL) 61 if (hGUIWnd == NULL)
53 _endthread (); 62 _endthread ();
54 63
64#ifdef HAVE_LCD_CHARCELLS
65 for (y = 0; y < 2; y++)
66 {
67 for (x = 0; x < 11; x++)
68 {
69 if (lcd_display_redraw ||
70 lcd_buffer_copy[x][y] != hardware_buffer_lcd[x][y])
71 {
72 lcd_buffer_copy[x][y] = hardware_buffer_lcd[x][y];
73 lcd_print_char(x, y);
74 }
75 }
76 }
77
78 lcd_display_redraw = false;
79#endif
80
55 for (x = 0; x < LCD_WIDTH; x++) 81 for (x = 0; x < LCD_WIDTH; x++)
56 for (y = 0; y < LCD_HEIGHT; y++) 82 for (y = 0; y < LCD_HEIGHT; y++)
57 bitmap[y][x] = ((lcd_framebuffer[x][y/8] >> (y & 7)) & 1); 83 bitmap[y][x] = ((lcd_framebuffer[x][y/8] >> (y & 7)) & 1);
@@ -59,7 +85,7 @@ void lcd_update()
59 InvalidateRect (hGUIWnd, NULL, FALSE); 85 InvalidateRect (hGUIWnd, NULL, FALSE);
60 86
61 /* natural sleep :) Bagder: why is this here? */ 87 /* natural sleep :) Bagder: why is this here? */
62 Sleep (50); 88 //Sleep (50);
63} 89}
64 90
65void lcd_update_rect(int x_start, int y_start, 91void lcd_update_rect(int x_start, int y_start,
@@ -106,3 +132,44 @@ void lcd_backlight (bool on)
106 132
107 InvalidateRect (hGUIWnd, NULL, FALSE); 133 InvalidateRect (hGUIWnd, NULL, FALSE);
108} 134}
135
136void drawdots(int color, struct coordinate *points, int count)
137{
138 while (count--)
139 {
140 if (color)
141 {
142 DRAW_PIXEL(points[count].x, points[count].y);
143 }
144 else
145 {
146 CLEAR_PIXEL(points[count].x, points[count].y);
147 }
148 }
149}
150
151void drawrectangles(int color, struct rectangle *points, int count)
152{
153 while (count--)
154 {
155 int x;
156 int y;
157 int ix;
158 int iy;
159
160 for (x = points[count].x, ix = 0; ix < points[count].width; x++, ix++)
161 {
162 for (y = points[count].y, iy = 0; iy < points[count].width; y++, iy++)
163 {
164 if (color)
165 {
166 DRAW_PIXEL(x, y);
167 }
168 else
169 {
170 CLEAR_PIXEL(x, y);
171 }
172 }
173 }
174 }
175}