Skip to content
This repository was archived by the owner on Sep 8, 2023. It is now read-only.

Commit 5e1c7b0

Browse files
committedFeb 19, 2023
blockout: add alpha layer to window
Being able to see what is behind the overlay seems like a decent way to make drawing the hole easier.
1 parent 5075c31 commit 5e1c7b0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎Blockout/Blockout.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <memory>
99

1010
#define MAX_LOADSTRING 100
11+
#define ALPHA_PERCENT 92
12+
#define BLOCKOUT_COLOR RGB(0, 0, 0)
1113

1214
// Global Variables:
1315
HINSTANCE hInst; // current instance
@@ -75,7 +77,7 @@ ATOM RegisterClass(HINSTANCE hInstance)
7577
wcex.hInstance = hInstance;
7678
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_BLOCKOUT));
7779
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
78-
wcex.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
80+
wcex.hbrBackground = CreateSolidBrush(BLOCKOUT_COLOR);
7981
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_BLOCKOUT);
8082
wcex.lpszClassName = szWindowClass;
8183
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_BLOCKOUT));
@@ -90,7 +92,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
9092
hInst = hInstance; // Store instance handle in our global variable
9193

9294
HWND hWnd = CreateWindowExW(
93-
WS_EX_TOPMOST, // dwExStyle
95+
WS_EX_LAYERED | WS_EX_TOPMOST, // dwExStyle
9496
szWindowClass, // lpClassName
9597
szTitle, // lpWindowName
9698
WS_TILEDWINDOW |
@@ -110,6 +112,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
110112
return FALSE;
111113
}
112114

115+
SetLayeredWindowAttributes(hWnd, 0, (255 * ALPHA_PERCENT) / 100, LWA_ALPHA);
116+
113117
ShowWindow(hWnd, nCmdShow | nCmdShow);
114118
UpdateWindow(hWnd);
115119

‎readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ to click and draw a transparent hole through which interesting data can be viewe
1010

1111
## Improvements
1212

13-
- [ ] Make it easier to draw the initial hole
13+
- [X] Make it easier to draw the initial hole
1414
- [ ] Support multiple holes

0 commit comments

Comments
 (0)
This repository has been archived.