Changeset 5edbd58 in opengl-game


Ignore:
Timestamp:
Sep 2, 2019, 5:23:40 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
301d0d4
Parents:
2beb6c7
Message:

For both openglgame and vulkangame, pass in the window width and height and a fullscreen flag to the run() function

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main-opengl.cpp

    r2beb6c7 r5edbd58  
    33#include <iostream>
    44
     5#include "consts.hpp"
    56#include "crash-logger.hpp"
    67
     
    2829
    2930   try {
    30       game.run();
     31      game.run(640, 480, GUI_FLAGS_WINDOW_FULLSCREEN);
    3132   } catch (const exception& e) {
    3233      cerr << e.what() << endl;
  • main-vulkan.cpp

    r2beb6c7 r5edbd58  
    33#include <iostream>
    44
     5#include "consts.hpp"
    56#include "crash-logger.hpp"
    67
     
    2829
    2930   try {
    30       game.run();
     31      game.run(800, 600, GUI_FLAGS_WINDOW_FULLSCREEN);
    3132   } catch (const exception& e) {
    3233      cerr << e.what() << endl;
  • opengl-game.cpp

    r2beb6c7 r5edbd58  
    22
    33#include <iostream>
     4
     5#include "consts.hpp"
    46
    57#include "game-gui-glfw.hpp"
     
    1517}
    1618
    17 void OpenGLGame::run() {
    18    if (initWindow() == RTWO_ERROR) {
     19void OpenGLGame::run(unsigned int width, unsigned int height, unsigned char guiFlags) {
     20   if (initWindow(width, height, guiFlags) == RTWO_ERROR) {
    1921      return;
    2022   }
     
    2426}
    2527
    26 bool OpenGLGame::initWindow() {
     28bool OpenGLGame::initWindow(unsigned int width, unsigned int height, unsigned char guiFlags) {
    2729   gui = new GameGui_GLFW();
    2830
     
    3436   cout << "GUI init succeeded" << endl;
    3537
    36    window = (GLFWwindow*) gui->CreateWindow("OpenGL Game", SCREEN_WIDTH, SCREEN_HEIGHT);
     38   window = (GLFWwindow*) gui->CreateWindow("OpenGL Game", width, height);
    3739   if (window == nullptr) {
    3840      cout << "Window could not be created!" << endl;
  • opengl-game.hpp

    r2beb6c7 r5edbd58  
    33
    44#include "game-gui-glfw.hpp"
    5 
    6 const int SCREEN_WIDTH = 800;
    7 const int SCREEN_HEIGHT = 600;
    85
    96class OpenGLGame {
     
    129      ~OpenGLGame();
    1310
    14       void run();
     11      void run(unsigned int width, unsigned int height, unsigned char guiFlags);
    1512
    1613   private:
     
    1815      GLFWwindow* window;
    1916
    20       bool initWindow();
     17      bool initWindow(unsigned int width, unsigned int height, unsigned char guiFlags);
    2118      void initOpenGL();
    2219      void mainLoop();
  • vulkan-game.cpp

    r2beb6c7 r5edbd58  
    22
    33#include <iostream>
     4
     5#include "consts.hpp"
    46
    57#define GAMEGUI_INCLUDE_VULKAN
     
    1618}
    1719
    18 void VulkanGame::run() {
    19    if (initWindow() == RTWO_ERROR) {
     20void VulkanGame::run(unsigned int width, unsigned int height, unsigned char guiFlags) {
     21   if (initWindow(width, height, guiFlags) == RTWO_ERROR) {
    2022      return;
    2123   }
     
    2527}
    2628
    27 bool VulkanGame::initWindow() {
     29bool VulkanGame::initWindow(unsigned int width, unsigned int height, unsigned char guiFlags) {
    2830   gui = new GameGui_SDL();
    2931
     
    3537   cout << "GUI init succeeded" << endl;
    3638
    37    window = (SDL_Window*) gui->CreateWindow("Vulkan Game", SCREEN_WIDTH, SCREEN_HEIGHT);
     39   window = (SDL_Window*) gui->CreateWindow("Vulkan Game", width, height);
    3840   if (window == nullptr) {
    3941      cout << "Window could not be created!" << endl;
  • vulkan-game.hpp

    r2beb6c7 r5edbd58  
    33
    44#include "game-gui-sdl.hpp"
    5 
    6 const int SCREEN_WIDTH = 800;
    7 const int SCREEN_HEIGHT = 600;
    85
    96class VulkanGame {
     
    129      ~VulkanGame();
    1310
    14       void run();
     11      void run(unsigned int width, unsigned int height, unsigned char guiFlags);
    1512
    1613   private:
     
    1815      SDL_Window* window;
    1916
    20       bool initWindow();
     17      bool initWindow(unsigned int width, unsigned int height, unsigned char guiFlags);
    2118      void initVulkan();
    2219      void mainLoop();
Note: See TracChangeset for help on using the changeset viewer.