diff --git a/src/video.cpp b/src/video.cpp index fe5bd92e487..9c0c4f3c495 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -346,17 +346,23 @@ sdl::window *CVideo::get_window() std::pair CVideo::get_dpi_scale_factor() const { - std::pair result; + std::pair result {1.0f, 1.0f}; if(!window) { return result; } +/* This check is here because Travis CI builds with SDL 2.0.2. + * The code isn't intended to be skipped: end users, distribution packagers etc. + * should build the game with SDL 2.0.4 or above. + * - Jyrki, 2017-06-03 */ +#if SDL_VERSION_ATLEAST(2, 0, 4) float hdpi, vdpi; SDL_GetDisplayDPI(window->get_display_index(), nullptr, &hdpi, &vdpi); result.first = hdpi / MAGIC_DPI_SCALE_NUMBER; result.second = vdpi / MAGIC_DPI_SCALE_NUMBER; +#endif return result; }