From c6b7d9729d51deca8f04e72f8fdf14014c4bb8c4 Mon Sep 17 00:00:00 2001 From: bjorn Date: Sun, 3 Dec 2017 15:23:38 -0800 Subject: [PATCH] rm lovrGraphicsGetWindow; --- src/graphics/graphics.c | 4 ---- src/graphics/graphics.h | 1 - src/headset/fake.c | 20 +++++++++----------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 32455bf9..32b2c3cd 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -1137,7 +1137,3 @@ void lovrGraphicsBindIndexBuffer(uint32_t indexBuffer) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer); } } - -GLFWwindow* lovrGraphicsGetWindow() { - return state.window; -} diff --git a/src/graphics/graphics.h b/src/graphics/graphics.h index d02a1aa6..027aa899 100644 --- a/src/graphics/graphics.h +++ b/src/graphics/graphics.h @@ -192,4 +192,3 @@ void lovrGraphicsUseProgram(uint32_t program); void lovrGraphicsBindVertexArray(uint32_t vao); void lovrGraphicsBindVertexBuffer(uint32_t vbo); void lovrGraphicsBindIndexBuffer(uint32_t ibo); -GLFWwindow* lovrGraphicsGetWindow(); diff --git a/src/headset/fake.c b/src/headset/fake.c index b1a0c7bf..f0925f25 100644 --- a/src/headset/fake.c +++ b/src/headset/fake.c @@ -138,7 +138,7 @@ static void mouse_button_callback(GLFWwindow* window, int button, int action, in // headset can start up without a window, so we poll window existance here static void check_window_existance() { - GLFWwindow* window = lovrGraphicsGetWindow(); + GLFWwindow* window = glfwGetCurrentContext(); if (window == state.hookedWindow) { // no change @@ -232,7 +232,7 @@ static void fakeSetMirrored(bool mirror) { } static void fakeGetDisplayDimensions(int* width, int* height) { - GLFWwindow* window = lovrGraphicsGetWindow(); + GLFWwindow* window = glfwGetCurrentContext(); if (window) { glfwGetWindowSize(window,width,height); } @@ -324,7 +324,7 @@ static float fakeControllerGetAxis(Controller* controller, ControllerAxis axis) } static bool fakeControllerIsDown(Controller* controller, ControllerButton button) { - GLFWwindow* window = lovrGraphicsGetWindow(); + GLFWwindow* window = glfwGetCurrentContext(); if(!window) { return false; } @@ -349,14 +349,14 @@ static void fakeRenderTo(headsetRenderCallback callback, void* userdata) { // TODO: Head transform // TODO: Eye transform // Projection - - int w,h; - GLFWwindow* window = lovrGraphicsGetWindow(); + + int w,h; + GLFWwindow* window = glfwGetCurrentContext(); if(!window) { return; } - glfwGetWindowSize(window, &w, &h); + glfwGetWindowSize(window, &w, &h); mat4_perspective(state.projection, state.clipNear, state.clipFar, 67 * M_PI / 180.0, (float)w/h); @@ -373,12 +373,10 @@ static void fakeRenderTo(headsetRenderCallback callback, void* userdata) { lovrGraphicsPop(); } - -static void fakeUpdate(float dt) -{ +static void fakeUpdate(float dt) { float k = 4.0f; check_window_existance(); - GLFWwindow* w = lovrGraphicsGetWindow(); + GLFWwindow* w = glfwGetCurrentContext(); if(!w) { return; }