mirror of
https://github.com/jam422470459/EPD-nRF52-hema213.git
synced 2025-12-06 16:42:49 +08:00
add border for emulator
This commit is contained in:
22
emulator.c
22
emulator.c
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#define BITMAP_WIDTH 400
|
#define BITMAP_WIDTH 400
|
||||||
#define BITMAP_HEIGHT 300
|
#define BITMAP_HEIGHT 300
|
||||||
#define WINDOW_WIDTH 420
|
#define WINDOW_WIDTH 450
|
||||||
#define WINDOW_HEIGHT 340
|
#define WINDOW_HEIGHT 380
|
||||||
#define WINDOW_TITLE TEXT("Emurator")
|
#define WINDOW_TITLE TEXT("Emurator")
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
@@ -162,6 +162,24 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
FillRect(hdc, &clientRect, bgBrush);
|
FillRect(hdc, &clientRect, bgBrush);
|
||||||
DeleteObject(bgBrush);
|
DeleteObject(bgBrush);
|
||||||
|
|
||||||
|
// Calculate border position (same as bitmap position)
|
||||||
|
int scale = 1;
|
||||||
|
int drawX = (clientRect.right - BITMAP_WIDTH * scale) / 2;
|
||||||
|
int drawY = (clientRect.bottom - BITMAP_HEIGHT * scale) / 2;
|
||||||
|
|
||||||
|
// Draw border around the bitmap area
|
||||||
|
HPEN borderPen = CreatePen(PS_DOT, 1, RGB(0, 0, 255));
|
||||||
|
HPEN oldPen = SelectObject(hdc, borderPen);
|
||||||
|
HBRUSH oldBrush = SelectObject(hdc, GetStockObject(NULL_BRUSH)); // No fill
|
||||||
|
|
||||||
|
Rectangle(hdc, drawX - 1, drawY - 1,
|
||||||
|
drawX + BITMAP_WIDTH * scale + 1,
|
||||||
|
drawY + BITMAP_HEIGHT * scale + 1);
|
||||||
|
|
||||||
|
SelectObject(hdc, oldPen);
|
||||||
|
SelectObject(hdc, oldBrush);
|
||||||
|
DeleteObject(borderPen);
|
||||||
|
|
||||||
// Use the stored timestamp
|
// Use the stored timestamp
|
||||||
gui_data_t data = {
|
gui_data_t data = {
|
||||||
.color = g_bwr_mode ? 2 : 1,
|
.color = g_bwr_mode ? 2 : 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user