MCPcopy Create free account
hub / github.com/NetHack/NetHack / onPaint

Function onPaint

outdated/sys/wince/mhmap.c:572–724  ·  view source on GitHub ↗

on WM_PAINT */

Source from the content-addressed store, hash-verified

570
571/* on WM_PAINT */
572void
573onPaint(HWND hWnd)
574{
575 PNHMapWindow data;
576 PAINTSTRUCT ps;
577 HDC hDC;
578 HDC tileDC;
579 HGDIOBJ saveBmp;
580 RECT paint_rt;
581 int i, j;
582
583 /* get window data */
584 data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
585
586 hDC = BeginPaint(hWnd, &ps);
587
588 /* calculate paint rectangle */
589 if (!IsRectEmpty(&ps.rcPaint)) {
590 /* calculate paint rectangle */
591 paint_rt.left =
592 max(data->xPos
593 + (ps.rcPaint.left - data->map_orig.x) / data->xScrTile,
594 0);
595 paint_rt.top = max(
596 data->yPos + (ps.rcPaint.top - data->map_orig.y) / data->yScrTile,
597 0);
598 paint_rt.right = min(
599 data->xPos
600 + (ps.rcPaint.right - data->map_orig.x) / data->xScrTile + 1,
601 COLNO);
602 paint_rt.bottom = min(
603 data->yPos
604 + (ps.rcPaint.bottom - data->map_orig.y) / data->yScrTile + 1,
605 ROWNO);
606
607 if (data->bAsciiMode || Is_rogue_level(&u.uz)) {
608 /* You enter a VERY primitive world! */
609 HGDIOBJ oldFont;
610
611 oldFont = SelectObject(hDC, data->hMapFont);
612 SetBkMode(hDC, TRANSPARENT);
613
614 /* draw the map */
615 for (i = paint_rt.left; i < paint_rt.right; i++)
616 for (j = paint_rt.top; j < paint_rt.bottom; j++)
617 if (data->map[i][j] >= 0) {
618 char ch;
619 TCHAR wch;
620 RECT glyph_rect;
621 int color;
622 unsigned special;
623 int mgch;
624 HBRUSH back_brush;
625 COLORREF OldFg;
626
627 nhcoord2display(data, i, j, &glyph_rect);
628
629#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)

Callers 1

MapWndProcFunction · 0.70

Calls 5

nhcoord2displayFunction · 0.70
nhglyph2charcolorFunction · 0.70
nhcolor_to_RGBFunction · 0.70
GetNHAppFunction · 0.70

Tested by

no test coverage detected