Attempt to fix build in Travis CI

This commit is contained in:
Jyrki Vesterinen 2017-06-03 18:57:09 +03:00
parent e188379cd2
commit bcc0992daa

View file

@ -346,17 +346,23 @@ sdl::window *CVideo::get_window()
std::pair<float, float> CVideo::get_dpi_scale_factor() const std::pair<float, float> CVideo::get_dpi_scale_factor() const
{ {
std::pair<float, float> result; std::pair<float, float> result {1.0f, 1.0f};
if(!window) { if(!window) {
return result; 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; float hdpi, vdpi;
SDL_GetDisplayDPI(window->get_display_index(), nullptr, &hdpi, &vdpi); SDL_GetDisplayDPI(window->get_display_index(), nullptr, &hdpi, &vdpi);
result.first = hdpi / MAGIC_DPI_SCALE_NUMBER; result.first = hdpi / MAGIC_DPI_SCALE_NUMBER;
result.second = vdpi / MAGIC_DPI_SCALE_NUMBER; result.second = vdpi / MAGIC_DPI_SCALE_NUMBER;
#endif
return result; return result;
} }