Skip to content

Commit

Permalink
Fixed compilation on SDL1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Jan 1, 2016
1 parent bd3601b commit a18f86c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/preferences.cpp
Expand Up @@ -98,6 +98,7 @@ base_manager::~base_manager()
*/
void handle_event(const SDL_Event& event)
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
// Saftey check to make sure this is a window event
if (event.type != SDL_WINDOWEVENT) return;

Expand All @@ -114,6 +115,9 @@ void handle_event(const SDL_Event& event)

break;
}
#else
UNUSED(event);
#endif
}

void write_preferences()
Expand Down
7 changes: 4 additions & 3 deletions src/video.cpp
Expand Up @@ -43,7 +43,9 @@ static lg::log_domain log_display("display");

namespace {
bool is_fullscreen = false;
#if SDL_VERSION_ATLEAST(2, 0, 0)
bool is_maximized = false;
#endif
#if !SDL_VERSION_ATLEAST(2, 0, 0)
int disallow_resize = 0;
#endif
Expand Down Expand Up @@ -864,7 +866,7 @@ std::vector<std::pair<int, int> > CVideo::get_available_resolutions()
const std::pair<int,int> min_res = std::make_pair(preferences::min_allowed_width(),preferences::min_allowed_height());

if (getSurface() && getSurface()->w >= min_res.first && getSurface()->h >= min_res.second)
result.push_back(current_resolution);
result.push_back(current_resolution());

for(int i = 0; modes[i] != NULL; ++i) {
if (modes[i]->w >= min_res.first && modes[i]->h >= min_res.second)
Expand Down Expand Up @@ -1001,15 +1003,14 @@ void CVideo::set_fullscreen(bool ison)

if (display::get_singleton() && isFullScreen() != ison) {
const int flags = ison ? SDL_FULLSCREEN : 0;
const std::pair<int,int>& res = preferences::resolution();

#if SDL_VERSION_ATLEAST(2, 0, 0)
int bpp = DefaultBpp;
#else
int bpp = bppForMode(res.first, res.second, flags);
#endif

const std::pair<int,int>& res = preferences::resolution();

setMode(res.first, res.second, bpp, flags);

display::get_singleton()->redraw_everything();
Expand Down

0 comments on commit a18f86c

Please sign in to comment.