Skip to content

Commit 99ed814

Browse files
committed
Update rcore_desktop_win32.c
1 parent 77b9214 commit 99ed814

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/platforms/rcore_desktop_win32.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,17 +1136,17 @@ Image GetClipboardImage(void)
11361136
// Show mouse cursor
11371137
void ShowCursor(void)
11381138
{
1139-
CORE.Input.Mouse.cursorHidden = false;
11401139
SetCursor(LoadCursorW(NULL, (LPCWSTR)IDC_ARROW));
1140+
CORE.Input.Mouse.cursorHidden = false;
11411141
}
11421142

11431143
// Hides mouse cursor
11441144
void HideCursor(void)
11451145
{
1146-
// NOTE: we use SetCursor instead of ShowCursor because it makes it easy
1147-
// to only hide the cursor while it's inside the client area
1148-
CORE.Input.Mouse.cursorHidden = true;
1146+
// NOTE: We use SetCursor() instead of ShowCursor() because
1147+
// it makes it easy to only hide the cursor while it's inside the client area
11491148
SetCursor(NULL);
1149+
CORE.Input.Mouse.cursorHidden = true;
11501150
}
11511151

11521152
// Enables cursor (unlock cursor)
@@ -1346,7 +1346,7 @@ void PollInputEvents(void)
13461346
//----------------------------------------------------------------------------------
13471347

13481348
// Initialize modern OpenGL context
1349-
// NOTE: We need to create a dummy context first to query requried extensions
1349+
// NOTE: We need to create a dummy context first to query required extensions
13501350
HGLRC InitOpenGL(HWND hwnd, HDC hdc)
13511351
{
13521352
// First, create a dummy context to get WGL extensions
@@ -1621,8 +1621,7 @@ int InitPlatform(void)
16211621

16221622
CORE.Window.ready = true;
16231623

1624-
// TODO: Should this function be called before or after drawing context is created? --> After swInit() called!
1625-
//UpdateWindowSize(UPDATE_WINDOW_FIRST, platform.hwnd, platform.appScreenWidth, platform.appScreenHeight, platform.desiredFlags);
1624+
// Update flags (in case of deferred state change required)
16261625
UpdateFlags(platform.hwnd, platform.desiredFlags, platform.appScreenWidth, platform.appScreenHeight);
16271626

16281627
CORE.Window.render.width = CORE.Window.screen.width;
@@ -1887,6 +1886,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
18871886
} break;
18881887
case WM_SETCURSOR:
18891888
{
1889+
// Called when mouse moves, enters/leaves window...
18901890
if (LOWORD(lparam) == HTCLIENT)
18911891
{
18921892
SetCursor(CORE.Input.Mouse.cursorHidden? NULL : LoadCursorW(NULL, (LPCWSTR)IDC_ARROW));
@@ -1972,6 +1972,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
19721972
return result;
19731973
}
19741974

1975+
// Handle keyboard input event
19751976
static void HandleKey(WPARAM wparam, LPARAM lparam, char state)
19761977
{
19771978
KeyboardKey key = GetKeyFromWparam(wparam);
@@ -1991,12 +1992,15 @@ static void HandleKey(WPARAM wparam, LPARAM lparam, char state)
19911992
// TODO: Add key to the queue as well?
19921993
}
19931994

1995+
// Handle mouse button input event
19941996
static void HandleMouseButton(int button, char state)
19951997
{
1998+
// Register current mouse button state
19961999
CORE.Input.Mouse.currentButtonState[button] = state;
19972000
CORE.Input.Touch.currentTouchState[button] = state;
19982001
}
19992002

2003+
// Handle raw input event
20002004
static void HandleRawInput(LPARAM lparam)
20012005
{
20022006
RAWINPUT input = { 0 };
@@ -2020,6 +2024,7 @@ static void HandleRawInput(LPARAM lparam)
20202024
//if (CORE.Input.Mouse.currentPosition.y != 0) abort();
20212025
}
20222026

2027+
// Handle window resizing event
20232028
static void HandleWindowResize(HWND hwnd, int *width, int *height)
20242029
{
20252030
if (CORE.Window.flags & FLAG_WINDOW_MINIMIZED) return;
@@ -2051,10 +2056,8 @@ static void HandleWindowResize(HWND hwnd, int *width, int *height)
20512056
*height = screenHeight;
20522057
}
20532058

2054-
CORE.Window.screenScale = MatrixScale(
2055-
(float)CORE.Window.render.width/CORE.Window.screen.width,
2056-
(float)CORE.Window.render.height/CORE.Window.screen.height,
2057-
1.0f);
2059+
CORE.Window.screenScale = MatrixScale( (float)CORE.Window.render.width/CORE.Window.screen.width,
2060+
(float)CORE.Window.render.height/CORE.Window.screen.height, 1.0f);
20582061
}
20592062

20602063
// Update window style

0 commit comments

Comments
 (0)