Changeset c559904 in opengl-game


Ignore:
Timestamp:
Sep 14, 2019, 12:58:30 AM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
09e15a4
Parents:
2e77b3f
Message:

Start using the logger class to output basic debugging info to a file in both openglgame and vulkangame

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • opengl-game.cpp

    r2e77b3f rc559904  
    44
    55#include "consts.hpp"
     6#include "logger.hpp"
    67
    78using namespace std;
     
    2425   cout << "OpenGL Game" << endl;
    2526
     27   // TODO: Refactor the logger api to be more flexible,
     28   // esp. since gl_log() and gl_log_err() have issues printing anything besides stirngs
     29   restart_gl_log();
     30   gl_log("starting GLFW\n%s", glfwGetVersionString());
     31
     32   open_log();
     33   get_log() << "starting GLFW" << endl;
     34   get_log() << glfwGetVersionString() << endl;
     35
    2636   if (initWindow(width, height, guiFlags) == RTWO_ERROR) {
    2737      return;
     
    3141   mainLoop();
    3242   cleanup();
     43
     44   close_log();
    3345}
    3446
     47// TODO: Make some more initi functions, or call this initUI if the
     48// amount of things initialized here keeps growing
    3549bool OpenGLGame::initWindow(int width, int height, unsigned char guiFlags) {
     50   // TODO: Put all fonts, textures, and images in the assets folder
    3651   gui = new GameGui_GLFW();
    3752
    3853   if (gui->init() == RTWO_ERROR) {
     54      // TODO: Also print these sorts of errors to the log
    3955      cout << "UI library could not be initialized!" << endl;
    4056      cout << gui->getError() << endl;
  • vulkan-game.cpp

    r2e77b3f rc559904  
    44
    55#include "consts.hpp"
     6#include "logger.hpp"
    67
    78using namespace std;
     
    2021   cout << "Vulkan Game" << endl;
    2122
     23   // This gets the runtime version, use SDL_VERSION() for the comppile-time version
     24   // TODO: Create a game-gui function to get the gui version and retrieve it that way
     25   SDL_GetVersion(&sdlVersion);
     26
     27   // TODO: Refactor the logger api to be more flexible,
     28   // esp. since gl_log() and gl_log_err() have issues printing anything besides stirngs
     29   restart_gl_log();
     30   gl_log("starting SDL\n%s.%s.%s",
     31      to_string(sdlVersion.major).c_str(),
     32      to_string(sdlVersion.minor).c_str(),
     33      to_string(sdlVersion.patch).c_str());
     34
     35   open_log();
     36   get_log() << "starting SDL" << endl;
     37   get_log() <<
     38      (int)sdlVersion.major << "." <<
     39      (int)sdlVersion.minor << "." <<
     40      (int)sdlVersion.patch << endl;
     41
    2242   if (initWindow(width, height, guiFlags) == RTWO_ERROR) {
    2343      return;
     
    3454   mainLoop();
    3555   cleanup();
     56
     57   close_log();
    3658}
    3759
     60// TODO: Make some more initi functions, or call this initUI if the
     61// amount of things initialized here keeps growing
    3862bool VulkanGame::initWindow(int width, int height, unsigned char guiFlags) {
     63   // TODO: Put all fonts, textures, and images in the assets folder
    3964   gui = new GameGui_SDL();
    4065
    4166   if (gui->init() == RTWO_ERROR) {
     67      // TODO: Also print these sorts of errors to the log
    4268      cout << "UI library could not be initialized!" << endl;
    4369      cout << gui->getError() << endl;
  • vulkan-game.hpp

    r2e77b3f rc559904  
    1919   private:
    2020      GameGui* gui;
     21
     22      SDL_version sdlVersion;
    2123      SDL_Window* window;
    2224
Note: See TracChangeset for help on using the changeset viewer.