1 /* ---------------------------------------------------------------------- *
2  * lcwin32.c
3  * This file is part of lincity.
4  * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
5  * ---------------------------------------------------------------------- */
6 #include "lcconfig.h"
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <math.h>
10 #include <assert.h>
11 #include "lcstring.h"
12 #include "lcintl.h"
13 #include "lin-city.h"
14 #include "common.h"
15 #include "lctypes.h"
16 #include "pixmap.h"
17 #include "screen.h"
18 
19 #define USE_WINDOWS_FONT 1
20 #undef USE_WINDOWS_FONT
21 
22 int
AdjustX(int x)23 AdjustX (int x)
24 {
25     x <<= pix_double;
26     x += borderx;
27     return x;
28 }
29 
30 int
AdjustY(int y)31 AdjustY (int y)
32 {
33     y <<= pix_double;
34     y += bordery;
35     return y;
36 }
37 
38 int
UnAdjustX(int x)39 UnAdjustX (int x)
40 {
41     x -= borderx;
42     x >>= pix_double;
43     return x;
44 }
45 
46 int
UnAdjustY(int y)47 UnAdjustY (int y)
48 {
49     y -= bordery;
50     y >>= pix_double;
51     return y;
52 }
53 
54 void
HandleError(char * description,int degree)55 HandleError (char *description, int degree)
56 {
57     MessageBox (NULL, description, _("ERROR"), MB_OK);
58     if (degree == FATAL)
59     {
60         exit (-1);
61     }
62 }
63 
64 void
setcustompalette(void)65 setcustompalette (void)
66 {
67     char s[100];
68     unsigned int n, r, g, b;
69     int i, flag[256];
70     FILE *inf;
71 
72     for (i = 0; i < 256; i++)
73 	flag[i] = 0;
74     if ((inf = fopen (colour_pal_file, "r")) == 0)
75 	HandleError ("Can't find the colour pallet file", FATAL);
76 
77     while (feof (inf) == 0) {
78 	fgets (s, 99, inf);
79 	if (sscanf (s, "%u %u %u %u", &n, &r, &g, &b) == 4)
80 	{
81 	    r = ((r * (1 - gamma_correct_red))
82 		 + (64 * sin ((float) r * M_PI / 128))
83 		 * gamma_correct_red);
84 	    g = ((g * (1 - gamma_correct_green))
85 		 + (64 * sin ((float) g * M_PI / 128))
86 		 * gamma_correct_green);
87 	    b = ((b * (1 - gamma_correct_blue))
88 		 + (64 * sin ((float) b * M_PI / 128))
89 		 * gamma_correct_blue);
90 	    AddPaletteEntry (n, r, g, b);
91 	    flag[n] = 1;
92 	}
93     }
94     fclose (inf);
95     for (i = 0; i < 256; i++) {
96         if (flag[i] == 0) {
97 	    printf ("Colour %d not loaded\n", i);
98 	    HandleError ("Can't continue", FATAL);
99 	}
100     }
101     UpdatePalette ();
102 }
103 
104 COLORREF
GetPaletteColorref(int col)105 GetPaletteColorref (int col)
106 {
107     assert (col >= 0 || col <= 255);
108     if (display.hasPalette)
109 	return PALETTEINDEX (col);
110     else
111 	return display.colorrefPal[col];
112 }
113 
114 HBRUSH
GetPaletteBrush(int col)115 GetPaletteBrush (int col)
116 {
117     assert (col >= 0 || col <= 255);
118     if (display.brushPal[col] == 0)
119 	display.brushPal[col] = CreateSolidBrush (GetPaletteColorref (col));
120     return display.brushPal[col];
121 }
122 
123 int CALLBACK
EnumFontFamProc(ENUMLOGFONT FAR * lpelf,NEWTEXTMETRIC FAR * lpntm,int FontType,LPARAM lParam)124 EnumFontFamProc (ENUMLOGFONT FAR * lpelf,     // pointer to logical-font data
125 		 NEWTEXTMETRIC FAR * lpntm,   // pointer to physical-font data
126 		 int FontType,	// type of font
127 		 LPARAM lParam	// address of application-defined data
128 )
129 {
130     int i = 0;
131     //  if (0 != strcmp (lpelf->elfLogFont.lfFaceName, "iso8859-1-16x16"))
132     if (0 != strcmp (lpelf->elfLogFont.lfFaceName, "Lincity"))
133     //  if (0 != strcmp (lpelf->elfLogFont.lfFaceName, "Tester"))
134     //  if (0 != strcmp (lpelf->elfLogFont.lfFaceName, "iso8859-1-9x15"))
135     // if (0 == strcmp (lpelf->elfLogFont.lfFaceName, "iso8859-1-8x8"))
136         return 0;
137 
138     // GCS:  I'm not sure if it's OK to just copy the pointer here.
139     //       This may cause problems, but let's give it a whirl.
140     // *((LOGFONT**) lParam) = &(lpelf->elfLogFont);
141 
142     // GCS:  No wait, I changed my mind.  Copy the entire LOGFONT struct.
143     *(LOGFONT *) lParam = lpelf->elfLogFont;
144     return 1;
145 }
146 
147 void
init_windows_font(void)148 init_windows_font (void)
149 {
150 #if defined (USE_WINDOWS_FONT)
151     int rc;
152     LOGFONT logfont;
153     int fonts_added = AddFontResource (windowsfontfile);
154     if (fonts_added != 1) {
155 	HandleError ("Can't open the font file", FATAL);
156     }
157     SendMessage (HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
158     ProcessPendingEvents ();
159 
160     // GCS: This typedef is for the typecast...
161     // typedef int (FAR WINAPI *voidfnptr)(void);
162     // KSH: Changed the typedef to get around VC 6 strict type enformcement
163 #if defined (commentout)
164     typedef int (FAR WINAPI * voidfnptr) (const struct tagLOGFONTA *, const struct tagTEXTMETRICA *, unsigned long, long);
165     EnumFontFamilies (display.hdcMem, "Lincity", (voidfnptr) EnumFontFamProc, (LPARAM) & logfont);
166 #endif
167     // GCS: Hmm.  There must be a way to get this to work on both compilers.
168     //            How about this?
169     //EnumFontFamilies (display.hdcMem, "iso8859-1-16x16", (FONTENUMPROC) EnumFontFamProc, (LPARAM) & logfont);
170     //rc = EnumFontFamilies (display.hdcMem, "iso8859-1-8x8", (FONTENUMPROC) EnumFontFamProc, (LPARAM) & logfont);
171     rc = EnumFontFamilies (display.hdcMem, "Lincity", (FONTENUMPROC) EnumFontFamProc, (LPARAM) & logfont);
172 
173     display.hFont = CreateFontIndirect (&logfont);
174     if (!display.hFont) {
175 	HandleError ("Error executing CreateFontIndirect", FATAL);
176     }
177     SelectObject (display.hdcMem, display.hFont);
178 #endif /* defined (USE_WINDOWS_FONT) */
179 }
180 
181 void
gl_setpalettecolor(long x,long r,long g,long b)182 gl_setpalettecolor (long x, long r, long g, long b)
183 {
184     if (x >= 0 && x <= 255) {
185 	AddPaletteEntry (x, r, g, b);
186     }
187 }
188 
189 void
Fgl_setfontcolors(int bg,int fg)190 Fgl_setfontcolors (int bg, int fg)
191 {
192     text_fg = fg;
193     text_bg = bg;
194 }
195 
196 void
Fgl_setfont(int fw,int fh,void * fp)197 Fgl_setfont (int fw, int fh, void *fp)
198 {
199     open_font = fp;
200     open_font_height = fh;
201 }
202 
203 void
Fgl_setpixel(int x,int y,int col)204 Fgl_setpixel (int x, int y, int col)
205 {
206     int i;
207 
208     if (clipping_flag)
209         if (x < xclip_x1 || x > xclip_x2 || y < xclip_y1 || y > xclip_y2)
210 	    return;
211     col &= 0xff;
212 
213     // Draw to pixmap buffer
214     i = pixmap_index(x,y);
215     pixmap[i] = (unsigned char) col;
216 
217     // Draw to DC
218     if (display.useDIB) {
219 	BYTE *pixel = display.pBits;
220 	unsigned long row = display.pbminfo->bmiHeader.biHeight - (y + bordery);
221 	unsigned long rowlength = display.pbminfo->bmiHeader.biWidth;
222 	unsigned long mod = rowlength % sizeof (DWORD);
223 	if (mod) {
224 	    rowlength += (sizeof (DWORD) - mod);
225 	}			// Pad out to DWORD boundary
226 	pixel += row * rowlength + x + borderx;	// Ptr arith w/ 4 bytes per pixel
227 	*pixel = col;
228     } else {
229 	if (pix_double) {
230 	    RECT rect;
231 	    HBRUSH hbr, hbrOld;
232 	    rect.left = AdjustX (x);
233 	    rect.top = AdjustY (y);
234 	    rect.right = AdjustX (x + 1);
235 	    rect.bottom = AdjustY (y + 1);
236 	    hbr = GetPaletteBrush (col);
237 	    hbrOld = (HBRUSH) SelectObject (display.hdcMem, hbr);
238 	    FillRect (display.hdcMem, &rect, hbr);
239 	    hbr = (HBRUSH) SelectObject (display.hdcMem, hbrOld);
240 	} else {
241 	    SetPixel (display.hdcMem, x + borderx, y + bordery, GetPaletteColorref (col));
242 	}
243     }
244     // It's too slow to write directly to screen or to queue update event
245     // for every pixel.  Instead, the caller will have to do this.
246 }
247 
248 
249 int
Fgl_getpixel(int x,int y)250 Fgl_getpixel (int x, int y)
251 {
252     return pixmap_getpixel (x, y);
253 }
254 
255 
256 void
Fgl_hline(int x1,int y1,int x2,int col)257 Fgl_hline (int x1, int y1, int x2, int col)
258 {
259     int xor = 0;
260     RECT rect;
261 
262     if (col == -1) {
263 	xor = 1;
264     }
265     col &= 0xff;
266     pixmap_hline (x1, y1, x2, col);
267 
268     // Calculate extent of update rectangle
269     rect.left = AdjustX (x1);
270     rect.top = AdjustY (y1);
271     rect.right = AdjustX (x2);	// LineTo() does not include final pixel of line
272     rect.bottom = AdjustY (y1 + 1);
273 
274     // Draw to DC
275     if (display.useDIB) {
276 	HPEN hpen, hpenOld;
277 	HBITMAP hOldBitmapMem;
278 	int oldrop2;
279 	hpen = CreatePen (PS_SOLID, 0, GetPaletteColorref (col));
280 	hpenOld = (HPEN) SelectObject (display.hdcMem, hpen);
281 	hOldBitmapMem = (HBITMAP) SelectObject (display.hdcMem, display.hDIB);
282 	MoveToEx (display.hdcMem, x1 + borderx, y1 + bordery, NULL);
283 	if (xor)
284 	    oldrop2 = SetROP2 (display.hdcMem, R2_NOT);
285 	LineTo (display.hdcMem, x2 + borderx, y1 + bordery);
286 	if (xor)
287 	    SetROP2 (display.hdcMem, oldrop2);
288 	display.hDIB = (HBITMAP) SelectObject (display.hdcMem, hOldBitmapMem);
289 	hpen = (HPEN) SelectObject (display.hdcMem, hpenOld);
290 	DeleteObject (hpen);
291     } else {
292 	if (pix_double) {
293 	    HBRUSH hbr, hbrOld;
294 	    int oldrop2;
295 	    hbr = GetPaletteBrush (col);
296 	    hbrOld = (HBRUSH) SelectObject (display.hdcMem, hbr);
297 	    if (xor)
298 		oldrop2 = SetROP2 (display.hdcMem, R2_NOT);
299 	    FillRect (display.hdcMem, &rect, hbr);
300 	    if (xor)
301 		SetROP2 (display.hdcMem, oldrop2);
302 	    hbr = (HBRUSH) SelectObject (display.hdcMem, hbrOld);
303 	} else {
304 	    HPEN hpen, hpenOld;
305 	    int oldrop2;
306 	    hpen = CreatePen (PS_SOLID, 0, GetPaletteColorref (col));
307 	    hpenOld = (HPEN) SelectObject (display.hdcMem, hpen);
308 	    MoveToEx (display.hdcMem, x1 + borderx, y1 + bordery, NULL);
309 	    if (xor)
310 		oldrop2 = SetROP2 (display.hdcMem, R2_NOT);
311 	    LineTo (display.hdcMem, x2 + borderx, y1 + bordery);
312 	    if (xor)
313 		SetROP2 (display.hdcMem, oldrop2);
314 	    hpen = (HPEN) SelectObject (display.hdcMem, hpenOld);
315 	    DeleteObject (hpen);
316 	}
317     }
318 
319     // Queue update event
320     InvalidateRect (display.hWnd, &rect, FALSE);
321 }
322 
323 void
Fgl_line(int x1,int y1,int dummy,int y2,int col)324 Fgl_line (int x1, int y1, int dummy, int y2, int col)
325      /* vertical lines only. */
326 {
327     RECT rect;
328     col &= 0xff;
329     pixmap_vline (x1, y1, y2, col);
330 
331     // Calculate extent of update rectangle
332     rect.left = AdjustX (x1);
333     rect.top = AdjustY (y1);
334     rect.right = AdjustX (x1 + 1);
335     rect.bottom = AdjustY (y2);	// LineTo() does not include final pixel of line
336 
337     // Draw to DC
338     if (display.useDIB) {
339 	HPEN hpen, hpenOld;
340 	HBITMAP hOldBitmapMem;
341 	hpen = CreatePen (PS_SOLID, 0, GetPaletteColorref (col));
342 	hpenOld = (HPEN) SelectObject (display.hdcMem, hpen);
343 	hOldBitmapMem = (HBITMAP) SelectObject (display.hdcMem, display.hDIB);
344 	MoveToEx (display.hdcMem, x1 + borderx, y1 + bordery, NULL);
345 	LineTo (display.hdcMem, x1 + borderx, y2 + bordery);
346 	display.hDIB = (HBITMAP) SelectObject (display.hdcMem, hOldBitmapMem);
347 	hpen = (HPEN) SelectObject (display.hdcMem, hpenOld);
348 	DeleteObject (hpen);
349     } else {
350 	if (pix_double) {
351 	    HBRUSH hbr, hbrOld;
352 	    hbr = GetPaletteBrush (col);
353 	    hbrOld = (HBRUSH) SelectObject (display.hdcMem, hbr);
354 	    FillRect (display.hdcMem, &rect, hbr);
355 	    hbr = (HBRUSH) SelectObject (display.hdcMem, hbrOld);
356 	} else {
357 	    HPEN hpen, hpenOld;
358 	    hpen = CreatePen (PS_SOLID, 0, GetPaletteColorref (col));
359 	    hpenOld = (HPEN) SelectObject (display.hdcMem, hpen);
360 	    MoveToEx (display.hdcMem, AdjustX (x1), AdjustY (y1), NULL);
361 	    LineTo (display.hdcMem, AdjustX (x1), AdjustY (y2));
362 	    hpen = (HPEN) SelectObject (display.hdcMem, hpenOld);
363 	    DeleteObject (hpen);
364 	}
365     }
366 
367     // Queue update event
368     InvalidateRect (display.hWnd, &rect, FALSE);
369 }
370 
371 
372 void
Fgl_write(int x,int y,char * s)373 Fgl_write (int x, int y, char *s)
374 {
375     int i;
376     RECT rect;
377 #if defined (USE_WINDOWS_FONT)
378     SIZE size;
379     // Select background and foreground colors
380     SetTextColor (display.hdcMem, GetPaletteColorref (text_fg));
381     SetBkColor (display.hdcMem, GetPaletteColorref (text_bg));
382 
383     // Draw text to backing store
384     ExtTextOut (display.hdcMem, AdjustX (x), AdjustY (y), 0, NULL,
385 		s, strlen (s), NULL);
386 
387     // Calculate size of text
388     GetTextExtentPoint32 (display.hdcMem, s, strlen (s), &size);
389 #endif
390 
391     // Draws to pixmap only when USE_WINDOWS_FONT is defined
392     for (i = 0; i < (int) (strlen (s)); i++)
393 	my_x_putchar (x + i * 8, y, s[i]);
394 
395     // Queue update event
396 #if defined (USE_WINDOWS_FONT)
397     rect.left = AdjustX (x);
398     rect.top = AdjustY (y);
399     rect.right = AdjustX (x + size.cx);
400     rect.bottom = AdjustY (y + size.cy);
401     InvalidateRect (display.hWnd, &rect, FALSE);
402 #else
403     rect.left = AdjustX (x);
404     rect.top = AdjustY (y);
405     rect.right = AdjustX (x + i * 8);
406     rect.bottom = AdjustY (y + 8);
407     InvalidateRect (display.hWnd, &rect, FALSE);
408 #endif
409 }
410 
411 
412 void
open_write(int x,int y,char * s)413 open_write (int x, int y, char *s)
414 {
415     int i;
416     RECT rect;
417     for (i = 0; i < (int) (strlen (s)); i++)
418         open_x_putchar (x + i * 8, y, s[i]);
419 
420     // Queue update event
421     rect.left = AdjustX (x);
422     rect.top = AdjustY (y);
423     rect.right = AdjustX (x + i * 8);
424     rect.bottom = AdjustY (y + open_font_height);
425     InvalidateRect (display.hWnd, &rect, FALSE);
426 }
427 
428 void
my_x_putchar(int xx,int yy,unsigned char c)429 my_x_putchar (int xx, int yy, unsigned char c)
430 {
431     int x, y, b;
432     for (y = 0; y < 8; y++) {
433 	b = main_font[c * 8 + y];
434 	for (x = 0; x < 8; x++) {
435 	    if ((b & 0x80) == 0) {
436 #if defined (USE_WINDOWS_FONT)
437 		pixmap_setpixel (xx + x, yy + y, text_bg);
438 #else
439 		Fgl_setpixel (xx + x, yy + y, text_bg);
440 #endif
441 	    } else {
442 #if defined (USE_WINDOWS_FONT)
443 		pixmap_setpixel (xx + x, yy + y, text_fg);
444 #else
445 		Fgl_setpixel (xx + x, yy + y, text_fg);
446 #endif
447 	    }
448 	    b = b << 1;
449 	}
450     }
451 }
452 
453 
454 void
open_x_putchar(int xx,int yy,unsigned char c)455 open_x_putchar (int xx, int yy, unsigned char c)
456 {
457     int x, y, b;
458     for (y = 0; y < open_font_height; y++) {
459 	b = open_font[c * open_font_height + y];
460 	for (x = 0; x < 8; x++) {
461 	    if ((b & 0x80) == 0)
462 		Fgl_setpixel (xx + x, yy + y, text_bg);
463 	    else
464 		Fgl_setpixel (xx + x, yy + y, text_fg);
465 	    b = b << 1;
466 	}
467     }
468 }
469 
470 
471 void
Fgl_fillbox(int x1,int y1,int w,int h,int col)472 Fgl_fillbox (int x1, int y1, int w, int h, int col)
473 {
474     RECT rect;
475     if (clipping_flag) {
476 	if (x1 < xclip_x1)
477 	    x1 = xclip_x1;
478 	if (x1 + w > xclip_x2)
479 	    w = xclip_x2 - x1;
480 	if (y1 < xclip_y1)
481 	    y1 = xclip_y1;
482 	if (y1 + h > xclip_y2)
483 	    h = xclip_y2 - y1;
484     }
485     col &= 0xff;
486     pixmap_fillbox (x1, y1, w, h, col);
487 
488     // Draw to DC
489     if (display.useDIB) {
490 	HBITMAP hOldBitmapMem;
491 	HBRUSH hbr, hbrOld;
492 	rect.left = x1 + borderx;
493 	rect.top = y1 + bordery;
494 	rect.right = x1 + borderx + w;
495 	rect.bottom = y1 + bordery + h;
496 	hbr = GetPaletteBrush (col);
497 	hbrOld = (HBRUSH) SelectObject (display.hdcMem, hbr);
498 	hOldBitmapMem = (HBITMAP) SelectObject (display.hdcMem, display.hDIB);
499 	FillRect (display.hdcMem, &rect, hbr);
500 	display.hDIB = (HBITMAP) SelectObject (display.hdcMem, hOldBitmapMem);
501 	hbr = (HBRUSH) SelectObject (display.hdcMem, hbrOld);
502     } else {
503 	HBRUSH hbr, hbrOld;
504 	rect.left = AdjustX (x1);
505 	rect.top = AdjustY (y1);
506 	rect.right = AdjustX (x1 + w);
507 	rect.bottom = AdjustY (y1 + h);
508 	hbr = GetPaletteBrush (col);
509 	hbrOld = (HBRUSH) SelectObject (display.hdcMem, hbr);
510 	FillRect (display.hdcMem, &rect, hbr);
511 	hbr = (HBRUSH) SelectObject (display.hdcMem, hbrOld);
512     }
513 
514     // Queue update event
515     InvalidateRect (display.hWnd, &rect, FALSE);
516 }
517 
518 void
Fgl_putbox(int x1,int y1,int w,int h,void * buf)519 Fgl_putbox (int x1, int y1, int w, int h, void *buf)
520 {
521     unsigned char *b = (unsigned char *) buf;
522     RECT rect;
523     int x, y;
524     for (y = y1; y < y1 + h; y++)
525 	for (x = x1; x < x1 + w; x++)
526 	    Fgl_setpixel (x, y, *(b++));
527 
528     // Queue update event
529     rect.left = AdjustX (x1);
530     rect.top = AdjustY (y1);
531     rect.right = AdjustX (x1 + w);
532     rect.bottom = AdjustY (y1 + h);
533     InvalidateRect (display.hWnd, &rect, FALSE);
534     // GCS: Don't update window here -- it causes farms to jump
535     //      around when panning main screen
536     //UpdateWindow (display.hWnd);
537 }
538 
539 void
Fgl_getbox(int x1,int y1,int w,int h,void * buf)540 Fgl_getbox (int x1, int y1, int w, int h, void *buf)
541 {
542     unsigned char *b = (unsigned char *) buf;
543     int x, y;
544     for (y = y1; y < y1 + h; y++)
545         for (x = x1; x < x1 + w; x++)
546 	    *(b++) = (unsigned char) Fgl_getpixel (x, y);
547 }
548 
549 void
RefreshScreen()550 RefreshScreen ()
551 {
552     InvalidateRect (display.hWnd, NULL, FALSE);
553     ProcessNextEvent ();
554 }
555 
556 void
RefreshArea(int x1,int y1,int x2,int y2)557 RefreshArea (int x1, int y1, int x2, int y2)	// bounds of refresh area
558 {
559     RECT rect;
560     rect.left = AdjustX (x1);
561     rect.top = AdjustY (y1);
562     rect.right = AdjustX (x2);
563     rect.bottom = AdjustY (y2);
564     InvalidateRect (display.hWnd, &rect, FALSE);
565     UpdateWindow (display.hWnd);
566 }
567 
568 void
Fgl_enableclipping(void)569 Fgl_enableclipping (void)
570 {
571     clipping_flag = 1;
572 }
573 
574 void
Fgl_setclippingwindow(int x1,int y1,int x2,int y2)575 Fgl_setclippingwindow (int x1, int y1, int x2, int y2)
576 {
577     xclip_x1 = x1;
578     xclip_y1 = y1;
579     xclip_x2 = x2;
580     xclip_y2 = y2;
581 }
582 
583 void
Fgl_disableclipping(void)584 Fgl_disableclipping (void)
585 {
586     clipping_flag = 0;
587 }
588 
589 void
do_call_event(int wait)590 do_call_event (int wait)
591 {
592     if (wait)
593         lc_usleep (1000);
594     HandleMouse ();
595 }
596 
597 void
call_event(void)598 call_event (void)
599 {
600     do_call_event (0);
601 }
602 
603 void
call_wait_event(void)604 call_wait_event (void)
605 {
606     do_call_event (1);
607 }
608 
609 #ifdef USE_PIXMAPS
610 void
init_icon_pixmap(short type)611 init_icon_pixmap (short type)
612 {
613     unsigned char *g;
614     int x, y;
615     HBITMAP hOldBitmapMem;
616     int w, h;
617     int grp;
618 
619     grp = get_group_of_type(type);
620 
621     if( grp >= 0) {
622 	w = main_groups[grp].size * 16;
623 	h = main_groups[grp].size * 16;
624 	w <<= pix_double;
625 	h <<= pix_double;
626 	icon_pixmap[type] = CreateCompatibleBitmap (display.hdcMem, w, h);
627 	hOldBitmapMem = (HBITMAP) SelectObject (display.hdcMem, icon_pixmap[type]);
628 
629 	/* Copy bits to bitmap */
630 	g = (unsigned char *) main_types[type].graphic;
631 	for (y = 0; y < main_groups[grp].size * 16; y++) {
632 	    for (x = 0; x < main_groups[grp].size * 16; x++) {
633 		if (pix_double) {
634 		    RECT rect;
635 		    HBRUSH hbr, hbrOld;
636 		    rect.left = x << 1;
637 		    rect.top = y << 1;
638 		    rect.right = (x + 1) << 1;
639 		    rect.bottom = (y + 1) << 1;
640 		    hbr = GetPaletteBrush (*g++);
641 		    hbrOld = (HBRUSH) SelectObject (display.hdcMem, hbr);
642 		    FillRect (display.hdcMem, &rect, hbr);
643 		    hbr = (HBRUSH) SelectObject (display.hdcMem, hbrOld);
644 		} else {
645 		    SetPixel (display.hdcMem, x, y, GetPaletteColorref (*g++));
646 		}
647 	    }
648 	}
649 	icon_pixmap[type] = (HBITMAP) SelectObject (display.hdcMem, hOldBitmapMem);
650     }
651 }
652 #endif
653 
654 int
lc_get_keystroke(void)655 lc_get_keystroke (void)
656 {
657     return GetKeystroke ();
658 }
659 
660 void
draw_border(void)661 draw_border (void)
662 {
663 }
664 
665 void
init_mouse(void)666 init_mouse (void)
667 {
668 }
669