-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created window class, various changes
- Loading branch information
1 parent
a94ba7f
commit 2c2132b
Showing
6 changed files
with
91 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "framework.h" | ||
#include "wnd.h" | ||
|
||
#include "Option.h" | ||
|
||
#define wc window->wc | ||
|
||
|
||
// forward declaration of WndProc in main.cpp | ||
extern LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); | ||
bool Window::createWnd(HINSTANCE hInstance) | ||
{ | ||
// Clearing window class for use | ||
ZeroMemory(&wc, sizeof(wc)); | ||
|
||
// Filling needed information | ||
wc.cbSize = sizeof(wc); | ||
wc.style = CS_HREDRAW | CS_VREDRAW; | ||
wc.lpfnWndProc = WndProc; | ||
wc.cbClsExtra = 0; | ||
wc.cbWndExtra = 0; | ||
wc.hInstance = hInstance; | ||
wc.hIcon = 0; | ||
wc.hCursor = LoadCursor(NULL, IDC_ARROW); | ||
wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0)); | ||
wc.lpszMenuName = overlayTitle; | ||
wc.lpszClassName = overlayTitle; | ||
wc.hIconSm = 0; | ||
|
||
// Register window class | ||
RegisterClassExW(&wc); | ||
|
||
// Create the window and use the result as the handle | ||
window->hWnd = CreateWindowEx( | ||
WS_EX_LAYERED, | ||
window->overlayTitle, // name of the window class | ||
window->overlayTitle, // title of the window | ||
WS_POPUP | WS_EX_TOPMOST, // window style | ||
0, // x-position of the window | ||
0, // y-position of the window | ||
option->SCREEN_WIDTH, // width of the window | ||
option->SCREEN_HEIGHT, // height of the window | ||
NULL, // we have no parent window, NULL | ||
NULL, // we aren't using menus, NULL | ||
hInstance, // application handle | ||
NULL); // used with multiple windows, NULL | ||
|
||
if (!window->hWnd) | ||
return FALSE; | ||
|
||
// Set the opacity and transparency color key | ||
SetLayeredWindowAttributes(window->hWnd, RGB(0, 0, 0), 0, LWA_COLORKEY); | ||
|
||
return TRUE; | ||
} | ||
|
||
Window* window = new Window(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
class Window | ||
{ | ||
public: | ||
WCHAR overlayTitle[50] = L"ExOverlay"; // Window Title | ||
HWND hWnd; // Handle for the window | ||
WNDCLASSEX wc; // Struct that holds info for the window class | ||
|
||
bool createWnd(HINSTANCE hInstance); | ||
}; | ||
|
||
extern Window* window; |