Browse Source

Fix scaling on all OSs?

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
f51a262f15
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/window.cpp

+ 3
- 3
src/window.cpp View File

@@ -200,7 +200,7 @@ Window::Window() {
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#endif #endif
glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE);
// glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);


// Create window // Create window
win = glfwCreateWindow(800, 600, "", NULL, NULL); win = glfwCreateWindow(800, 600, "", NULL, NULL);
@@ -362,7 +362,7 @@ void Window::run() {
glfwGetWindowSize(win, &winWidth, &winHeight); glfwGetWindowSize(win, &winWidth, &winHeight);
windowRatio = (float)fbWidth / winWidth; windowRatio = (float)fbWidth / winWidth;


DEBUG("%f %f", pixelRatio, windowRatio);
// DEBUG("%f %f %d %d", pixelRatio, windowRatio, fbWidth, winWidth);
// Resize scene // Resize scene
APP->event->rootWidget->box.size = math::Vec(fbWidth, fbHeight).div(pixelRatio); APP->event->rootWidget->box.size = math::Vec(fbWidth, fbHeight).div(pixelRatio);


@@ -373,7 +373,7 @@ void Window::run() {
bool visible = glfwGetWindowAttrib(win, GLFW_VISIBLE) && !glfwGetWindowAttrib(win, GLFW_ICONIFIED); bool visible = glfwGetWindowAttrib(win, GLFW_VISIBLE) && !glfwGetWindowAttrib(win, GLFW_ICONIFIED);
if (visible) { if (visible) {
// Update and render // Update and render
nvgBeginFrame(vg, winWidth, winHeight, pixelRatio);
nvgBeginFrame(vg, fbWidth, fbHeight, pixelRatio);
nvgScale(vg, pixelRatio, pixelRatio); nvgScale(vg, pixelRatio, pixelRatio);


widget::DrawContext ctx; widget::DrawContext ctx;


Loading…
Cancel
Save