add yellow cursor

This commit is contained in:
Adam Jensen 2022-06-16 21:19:40 +01:00
parent 6a43434d0a
commit 55095de038
5 changed files with 19 additions and 2 deletions

View File

@ -79,6 +79,7 @@ LRESULT CALLBACK gameWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
DisplayConfig displayConfig;
HWND hwnd;
void *yellowCursor;
void createWindow() {
WNDCLASSW wndClass = { sizeof(wndClass) };
@ -89,7 +90,19 @@ void createWindow() {
// wndClass.hIcon = LoadIconW(0, (LPCWSTR)0x7F00);
wndClass.lpszClassName = L"DeusExHRDCE";
// wndClass.hbrBackground = (HBRUSH)GetStockObject(5);
// wndClass.hCursor = LoadCursorW(0, (LPCWSTR)0x7F00);
wndClass.hCursor = LoadCursorW(0, (LPCWSTR)0x7F00); // normal cursor
if (true) { // HACK
ICONINFO ii;
auto pointerIcon = LoadIconA(wndClass.hInstance, (LPCSTR)109);
GetIconInfo(pointerIcon, &ii);
ii.fIcon = 0;
ii.xHotspot = 5;
ii.yHotspot = 5;
wndClass.hCursor = CreateIconIndirect(&ii); // new and improved (yellow) cursor
}
yellowCursor = wndClass.hCursor;
RegisterClassW(&wndClass);

View File

@ -1,2 +1,3 @@
#pragma once
extern void *yellowCursor;
int WinMain2(HINSTANCE hInstance, LPSTR lpCmdLine);

BIN
res/cursor.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1 +1,2 @@
102 ICON "icon.ico"
109 ICON "cursor.ico"

View File

@ -9,6 +9,7 @@
#include "spinnycube.h"
#include "types.h"
#include "matrix.h"
#include "main2.h" // for yellowCursor
#include "drm/ResolveReceiver.h"
#include "drm/sections/MaterialSection.h"
#include "drm/sections/RenderResourceSection.h"
@ -504,8 +505,9 @@ int spinnyCube(HWND window,
#if ENABLE_IMGUI
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui_ImplWin32_NewFrame(); // this will reset our pretty cursor
ImGui::NewFrame();
SetCursor((HCURSOR)yellowCursor); // ahh, much better
#endif
// cubePass.viewport ->