Skip to content

Commit

Permalink
Wrap old SDL code in a preproc directive.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Mar 14, 2014
1 parent 821b009 commit 2d54ec7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mouse_handler_base.cpp
Expand Up @@ -135,8 +135,10 @@ void mouse_handler_base::mouse_press(const SDL_MouseButtonEvent& event, const bo
show_menu_ = false;
map_location loc = gui().hex_clicked_on(event.x,event.y);
mouse_update(browse, loc);
#if !SDL_VERSION_ATLEAST(2,0,0)
int scrollx = 0;
int scrolly = 0;
#endif

if (is_left_click(event)) {
if (event.state == SDL_PRESSED) {
Expand Down Expand Up @@ -183,7 +185,9 @@ void mouse_handler_base::mouse_press(const SDL_MouseButtonEvent& event, const bo
simple_warp_ = false;
scroll_started_ = false;
}
} else if (allow_mouse_wheel_scroll(event.x, event.y)) {
}
#if !SDL_VERSION_ATLEAST(2,0,0)
else if (allow_mouse_wheel_scroll(event.x, event.y)) {
if (event.button == SDL_BUTTON_WHEELUP) {
scrolly = - preferences::scroll_speed();
mouse_wheel_up(event.x, event.y, browse);
Expand Down Expand Up @@ -213,6 +217,7 @@ void mouse_handler_base::mouse_press(const SDL_MouseButtonEvent& event, const bo
else
gui().scroll(scrollx,scrolly);
}
#endif
if (!dragging_left_ && !dragging_right_ && dragging_started_) {
dragging_started_ = false;
cursor::set_dragging(false);
Expand Down

0 comments on commit 2d54ec7

Please sign in to comment.