Changeset c324d6a in opengl-game for game-gui-sdl.cpp
- Timestamp:
- Jan 2, 2021, 4:07:45 PM (4 years ago)
- Branches:
- feature/imgui-sdl, master
- Children:
- 3b7d497, ca188cc
- Parents:
- a2f62d7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
game-gui-sdl.cpp
ra2f62d7 rc324d6a 3 3 #include <map> 4 4 #include <queue> 5 6 #include <SDL2/SDL_ttf.h> 5 7 6 8 #include "compiler.hpp" … … 9 11 using namespace std; 10 12 11 string GameGui_SDL::s_errorMessage;12 13 13 GameGui_SDL::GameGui_SDL() : keyState(SDL_GetKeyboardState(NULL)) { 14 window = nullptr; 14 15 } 15 16 16 17 string& GameGui_SDL::getError() { 17 GameGui_SDL::s_errorMessage = SDL_GetError();18 s_errorMessage = SDL_GetError(); 18 19 19 return GameGui_SDL::s_errorMessage;20 return s_errorMessage; 20 21 } 21 22 … … 24 25 // prevents SDL from setting up its own handlers for SIG_SEGV and stuff like that 25 26 26 GameGui_SDL::s_errorMessage = "No error";27 s_errorMessage = "No error"; 27 28 28 29 if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { … … 56 57 57 58 #ifdef WINDOWS 58 uint32_t flags = SDL_WINDOW_VULKAN | SDL_WINDOW_SHOWN | (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_RESIZABLE); 59 uint32_t flags = SDL_WINDOW_VULKAN | SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI | 60 (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_RESIZABLE); 59 61 #else 60 uint32_t flags = SDL_WINDOW_VULKAN | SDL_WINDOW_SHOWN | (fullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE); 62 uint32_t flags = SDL_WINDOW_VULKAN | SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI | 63 (fullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE); 61 64 #endif 62 65 63 window = SDL_CreateWindow(title.c_str(), 64 SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 65 width, height, flags); 66 window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, flags); 66 67 67 68 refreshWindowSize(); … … 148 149 149 150 void GameGui_SDL::refreshWindowSize() { 151 // TODO: Make sure this works on a mac (the analogous glfw function had issues on Mac retina displays) 150 152 SDL_GetWindowSize(window, &windowWidth, &windowHeight); 151 153 }
Note:
See TracChangeset
for help on using the changeset viewer.