comparison semiconginev2/rendering.nim @ 1256:bfb75c934f4e

add: window focus handling, improve window api a bit
author sam <sam@basx.dev>
date Sun, 28 Jul 2024 17:33:41 +0700
parents c4f98eb4bb05
children e9b8d87b9883
comparison
equal deleted inserted replaced
1255:2b5ca798f6d6 1256:bfb75c934f4e
329 vkDestroyDevice(vulkan.device, nil) 329 vkDestroyDevice(vulkan.device, nil)
330 vkDestroySurfaceKHR(vulkan.instance, vulkan.surface, nil) 330 vkDestroySurfaceKHR(vulkan.instance, vulkan.surface, nil)
331 vkDestroyDebugUtilsMessengerEXT(vulkan.instance, vulkan.debugMessenger, nil) 331 vkDestroyDebugUtilsMessengerEXT(vulkan.instance, vulkan.debugMessenger, nil)
332 vkDestroyInstance(vulkan.instance, nil) 332 vkDestroyInstance(vulkan.instance, nil)
333 333
334 proc ShowSystemCursor*() = vulkan.window.ShowSystemCursor() 334 proc ShowSystemCursor*(value: bool) = vulkan.window.ShowSystemCursor(value)
335 proc HideSystemCursor*() = vulkan.window.HideSystemCursor()
336 proc Fullscreen*(): bool = fullscreen 335 proc Fullscreen*(): bool = fullscreen
337 proc `Fullscreen=`*(enable: bool) = 336 proc SetFullscreen*(enable: bool) =
338 if enable != fullscreen: 337 if enable != fullscreen:
339 fullscreen = enable 338 fullscreen = enable
340 vulkan.window.Fullscreen(fullscreen) 339 vulkan.window.SetFullscreen(fullscreen)
341 340
342 proc GetAspectRatio*(): float32 = 341 proc GetAspectRatio*(): float32 =
343 assert vulkan.swapchain != nil, "Swapchain has not been initialized yet" 342 assert vulkan.swapchain != nil, "Swapchain has not been initialized yet"
344 vulkan.swapchain.width.float32 / vulkan.swapchain.height.float32 343 vulkan.swapchain.width.float32 / vulkan.swapchain.height.float32
345 344