Changeset a6f6833 in opengl-game for game-gui-glfw.cpp


Ignore:
Timestamp:
Sep 15, 2019, 5:27:13 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
92cbc6a
Parents:
09e15a4
Message:

Remove getWindowSize() from game-gui and instead add getWindowWidth(), getWindowHeight(), and refreshWindowSize() (which updates the internal variables returned by the first two functions)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • game-gui-glfw.cpp

    r09e15a4 ra6f6833  
    5656   window = glfwCreateWindow(windowWidth, windowHeight, title.c_str(), mon, nullptr);
    5757
     58   // TODO: I should check the window size after it's created to make sure it matches the requested size
     59   // glfwGetFramebufferSize(window, width, height) segfaults on OSX, check other platforms
     60   // I think glfwGetWindowSize(window, width, height) works fine.
     61
    5862   glfwSetMouseButtonCallback(window, glfw_mouse_button_callback);
    5963   glfwSetKeyCallback(window, glfw_key_callback);
     
    8993}
    9094
     95void GameGui_GLFW::refreshWindowSize() {
     96   // glfwGetFramebufferSize(window, width, height) segfaults on OSX, check other platforms
     97   // I think glfwGetWindowSize(window, width, height) works fine.
     98   glfwGetWindowSize(window, &windowWidth, &windowHeight);
     99}
     100
     101int GameGui_GLFW::getWindowWidth() {
     102   return windowWidth;
     103}
     104
     105int GameGui_GLFW::getWindowHeight() {
     106   return windowHeight;
     107}
     108
    91109#ifdef GAMEGUI_INCLUDE_VULKAN
    92110
     
    95113      RTWO_SUCCESS : RTWO_ERROR;
    96114}
    97 
    98 #endif
    99115
    100116vector<const char*> GameGui_GLFW::getRequiredExtensions() {
     
    109125}
    110126
    111 void GameGui_GLFW::getWindowSize(int* width, int* height) {
    112    // This function segfaults on OSX, check other platforms
    113    //glfwGetFramebufferSize(window, width, height);
    114 
    115    *width = windowWidth;
    116    *height = windowHeight;
    117 }
     127#endif
    118128
    119129void glfw_error_callback(int error, const char* description) {
Note: See TracChangeset for help on using the changeset viewer.