Further abstraction of platform window handling

We could now build our own native window class and stop relying on GLFW. However this won't be important for now!
This commit is contained in:
2023-01-31 18:41:46 +01:00
parent ba69726e33
commit 7448017701
16 changed files with 329 additions and 130 deletions

View File

@ -45,13 +45,15 @@ public:
double previous = glfwGetTime();
double lag = 0.0;
while (!appWindow.WindowShouldClose())
while (!appWindow->WindowShouldClose())
{
PollEvents();
double now = glfwGetTime();
double elapsed = now - previous ;
previous = now;
lag += elapsed;
scene.Update();
if (sceneview.isFocused)
{
@ -62,9 +64,9 @@ public:
if (MouseButtonPressed(YOGGIE_MOUSE_BUTTON_RIGHT)) {
glfwSetInputMode(appWindow.GetGLFWHandle(), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
auto newX = getCursorPosX(&appWindow);
auto newY = getCursorPosY(&appWindow);
glfwSetInputMode((GLFWwindow*)appWindow->GetHandle(), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
auto newX = getCursorPosX(appWindow);
auto newY = getCursorPosY(appWindow);
if (firstMouse)
{
@ -94,7 +96,7 @@ public:
}
else if (firstMouse == false)
{
glfwSetInputMode(appWindow.GetGLFWHandle(), GLFW_CURSOR, GLFW_CURSOR_NORMAL);
glfwSetInputMode((GLFWwindow*)appWindow->GetHandle(), GLFW_CURSOR, GLFW_CURSOR_NORMAL);
firstMouse = true;
}