changeset 1207:804ff842d377 compiletime-tests

fix: problems with include-structure on windows
author sam@sambook-windows.localdomain
date Tue, 16 Jul 2024 15:56:55 +0700
parents 77822066a419
children 8cf9a05b03eb
files semicongine/platform/windows/window.nim semicongine/rendering/vulkan/platform/win32.nim
diffstat 2 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/platform/windows/window.nim	Tue Jul 16 15:17:20 2024 +0700
+++ b/semicongine/platform/windows/window.nim	Tue Jul 16 15:56:55 2024 +0700
@@ -1,6 +1,5 @@
-import ../thirdparty/winim/winim
-import ../thirdparty/winim/winim/extra
-import ../thirdparty/winim/winim/core
+import ../../thirdparty/winim/winim/inc/[windef, winuser, wincon, winbase]
+import ../../thirdparty/winim/winim/[winstr, utils]
 
 include ./virtualkey_map
 
@@ -22,8 +21,8 @@
 let
   andCursorMask = [0xff]
   xorCursorMask = [0x00]
-  invisibleCursor = CreateCursor(HINSTANCE(0), 0, 0, 1, 1, pointer(addr andCursorMask), pointer(addr xorCursorMask))
-  defaultCursor = LoadCursor(HINSTANCE(0), IDC_ARROW)
+  invisibleCursor = CreateCursor(0, 0, 0, 1, 1, pointer(addr andCursorMask), pointer(addr xorCursorMask))
+  defaultCursor = LoadCursor(0, IDC_ARROW)
 var currentCursor = defaultCursor
 
 proc MapLeftRightKeys(key: INT, lparam: LPARAM): INT =
@@ -40,7 +39,7 @@
 proc WindowHandler(hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM): LRESULT {.stdcall.} =
   case uMsg
   of WM_DESTROY:
-    currentEvents.add(Event(eventType: events.EventType.Quit))
+    currentEvents.add(Event(eventType: EventType.Quit))
   of WM_KEYDOWN, WM_SYSKEYDOWN:
     let key = MapLeftRightKeys(INT(wParam), lParam)
     currentEvents.add(Event(eventType: KeyPressed, key: KeyTypeMap.getOrDefault(key, Key.UNKNOWN)))
@@ -60,9 +59,9 @@
   of WM_RBUTTONUP:
     currentEvents.add(Event(eventType: MouseReleased, button: MouseButton.Mouse3))
   of WM_MOUSEMOVE:
-    currentEvents.add(Event(eventType: events.MouseMoved, x: GET_X_LPARAM(lParam), y: GET_Y_LPARAM(lParam)))
+    currentEvents.add(Event(eventType: MouseMoved, x: GET_X_LPARAM(lParam), y: GET_Y_LPARAM(lParam)))
   of WM_MOUSEWHEEL:
-    currentEvents.add(Event(eventType: events.MouseWheel, amount: float32(GET_WHEEL_DELTA_WPARAM(wParam)) / WHEEL_DELTA))
+    currentEvents.add(Event(eventType: MouseWheel, amount: float32(GET_WHEEL_DELTA_WPARAM(wParam)) / WHEEL_DELTA))
   of WM_SIZING:
     currentEvents.add(Event(eventType: ResizedWindow))
   of WM_SIZE:
--- a/semicongine/rendering/vulkan/platform/win32.nim	Tue Jul 16 15:17:20 2024 +0700
+++ b/semicongine/rendering/vulkan/platform/win32.nim	Tue Jul 16 15:56:55 2024 +0700
@@ -113,13 +113,13 @@
     sType*: VkStructureType
     pNext*: pointer
     fullScreenExclusiveSupported*: VkBool32
-  HINSTANCE *{.header: "windows.h".} = object
-  HWND *{.header: "windows.h".} = object
-  HMONITOR *{.header: "windows.h".} = object
-  HANDLE *{.header: "windows.h".} = object
-  SECURITY_ATTRIBUTES *{.header: "windows.h".} = object
-  DWORD *{.header: "windows.h".} = object
-  LPCWSTR *{.header: "windows.h".} = object
+  HINSTANCE {.header: "windows.h".} = int
+  HWND {.header: "windows.h".} = int
+  HMONITOR {.header: "windows.h".} = int
+  HANDLE {.header: "windows.h".} = int
+  SECURITY_ATTRIBUTES {.header: "windows.h".} = object
+  DWORD {.header: "windows.h".} = int32
+  LPCWSTR {.header: "windows.h".} = ptr uint16
 # extension VK_KHR_external_semaphore_win32
 var
   vkImportSemaphoreWin32HandleKHR*: proc(device: VkDevice, pImportSemaphoreWin32HandleInfo: ptr VkImportSemaphoreWin32HandleInfoKHR): VkResult {.stdcall.}