iocp 구현하기

This commit is contained in:
2025-05-31 03:19:58 +09:00
parent 466a80f02b
commit a65483a9c3
55 changed files with 608 additions and 683 deletions

View File

@@ -0,0 +1,34 @@
#include <GLFW/glfw3.h>
#include "glfw/glfw_monitor.h"
#include "precomp.h"
namespace veng {
gsl::span<GLFWmonitor *> GetMonitors() {
std::int32_t monitor_count = 0;
GLFWmonitor **monitor_pointers = glfwGetMonitors(&monitor_count);
return gsl::span<GLFWmonitor *>(monitor_pointers, monitor_count);
}
glm::ivec2 GetMonitorPosition(gsl::not_null<GLFWmonitor *> monitor) {
glm::ivec2 monitor_position;
glfwGetMonitorPos(monitor, &monitor_position.x, &monitor_position.y);
return monitor_position;
}
glm::ivec2 GetMonitorWorkAreaSize(gsl::not_null<GLFWmonitor *> monitor) {
glm::ivec2 monitor_size;
glfwGetMonitorWorkarea(monitor, nullptr, nullptr, &monitor_size.x,
&monitor_size.y);
return monitor_size;
}
void MoveWindowToMonitor(gsl::not_null<GLFWwindow *> window,
gsl::not_null<GLFWmonitor *> monitor) {
glm::ivec2 window_size;
glfwGetWindowSize(window, &window_size.x, &window_size.y);
const glm::ivec2 window_new_position = GetMonitorPosition(monitor) +
(GetMonitorWorkAreaSize(monitor) / 2) -
(window_size / 2);
glfwSetWindowPos(window, window_new_position.x, window_new_position.y);
}
} // namespace veng