Changeset b6e60b4 in opengl-game for opengl-game.cpp


Ignore:
Timestamp:
Sep 3, 2019, 7:11:36 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
ed7c953
Parents:
7fc5e27
Message:

In vulkangame and openglgame:

  • use int instead of usigned int for width and heights paremters
  • Fix a bug where GUI_FLAGS_WINDOW_FULLSCREEN was being incorrectly checked
  • Print the size of a window after it has been created
File:
1 edited

Legend:

Unmodified
Added
Removed
  • opengl-game.cpp

    r7fc5e27 rb6e60b4  
    1717}
    1818
    19 void OpenGLGame::run(unsigned int width, unsigned int height, unsigned char guiFlags) {
     19void OpenGLGame::run(int width, int height, unsigned char guiFlags) {
    2020   if (initWindow(width, height, guiFlags) == RTWO_ERROR) {
    2121      return;
    2222   }
     23
    2324   initOpenGL();
    2425   mainLoop();
     
    2627}
    2728
    28 bool OpenGLGame::initWindow(unsigned int width, unsigned int height, unsigned char guiFlags) {
     29bool OpenGLGame::initWindow(int width, int height, unsigned char guiFlags) {
    2930   gui = new GameGui_GLFW();
    3031
    31    if (gui->Init() == RTWO_ERROR) {
     32   if (gui->init() == RTWO_ERROR) {
    3233      cout << "UI library could not be initialized!" << endl;
    33       cout << gui->GetError() << endl;
     34      cout << gui->getError() << endl;
    3435      return RTWO_ERROR;
    3536   }
    3637   cout << "GUI init succeeded" << endl;
    3738
    38    window = (GLFWwindow*) gui->CreateWindow("OpenGL Game", width, height, guiFlags | GUI_FLAGS_WINDOW_FULLSCREEN);
     39   window = (GLFWwindow*) gui->createWindow("OpenGL Game", width, height, guiFlags & GUI_FLAGS_WINDOW_FULLSCREEN);
    3940   if (window == nullptr) {
    4041      cout << "Window could not be created!" << endl;
    4142      return RTWO_ERROR;
    4243   }
     44
     45   int actualWidth=0, actualHeight=0;
     46   gui->getWindowSize(&actualWidth, &actualHeight);
     47
     48   cout << "Target window size: (" << width << ", " << height << ")" << endl;
     49   cout << "Actual window size: (" << actualWidth << ", " << actualHeight << ")" << endl;
    4350
    4451   return RTWO_SUCCESS;
     
    6168
    6269void OpenGLGame::cleanup() {
    63    gui->DestroyWindow();
    64    gui->Shutdown();
     70   gui->destroyWindow();
     71   gui->shutdown();
    6572   delete gui;
    6673}
Note: See TracChangeset for help on using the changeset viewer.