added center-on-middle click
This commit is contained in:
parent
255ef692ae
commit
4bf155d250
2 changed files with 16 additions and 10 deletions
|
@ -166,6 +166,7 @@ bool turn_slice(game_data& gameinfo, game_state& state_of_game,
|
|||
{
|
||||
bool& left_button = turn_data.left_button;
|
||||
bool& right_button = turn_data.right_button;
|
||||
bool& middle_button = turn_data.middle_button;
|
||||
gamemap::location& next_unit = turn_data.next_unit;
|
||||
paths& current_paths = turn_data.current_paths;
|
||||
paths::route& current_route = turn_data.current_route;
|
||||
|
@ -181,6 +182,7 @@ bool turn_slice(game_data& gameinfo, game_state& state_of_game,
|
|||
const int mouse_flags = SDL_GetMouseState(&mousex,&mousey);
|
||||
const bool new_left_button = mouse_flags & SDL_BUTTON_LMASK;
|
||||
const bool new_right_button = mouse_flags & SDL_BUTTON_RMASK;
|
||||
const bool new_middle_button = mouse_flags & SDL_BUTTON_MMASK;
|
||||
|
||||
gamemap::location new_hex = gui.hex_clicked_on(mousex,mousey);
|
||||
|
||||
|
@ -607,6 +609,17 @@ bool turn_slice(game_data& gameinfo, game_state& state_of_game,
|
|||
if(key[KEY_RIGHT] || mousex == gui.x()-1)
|
||||
gui.scroll(preferences::scroll_speed(),0.0);
|
||||
|
||||
if(new_middle_button && !middle_button &&
|
||||
mousex < gui.mapx() && mousey < gui.y()) {
|
||||
const int centerx = gui.mapx()/2;
|
||||
const int centery = gui.y()/2;
|
||||
const double movex = double(mousex - centerx);
|
||||
const double movey = double(mousey - centery);
|
||||
gui.scroll(movex,movey);
|
||||
}
|
||||
|
||||
middle_button = new_middle_button;
|
||||
|
||||
// MOUSE WHEEL BOUNDARY CHECK
|
||||
|
||||
if(gui::scrollamount() && (mousex > 50 && mousex < gui.mapx()-50) &&
|
||||
|
@ -990,7 +1003,6 @@ bool turn_slice(game_data& gameinfo, game_state& state_of_game,
|
|||
std::vector<std::string> items;
|
||||
std::stringstream heading;
|
||||
heading << string_table["leader"] << ","
|
||||
<< string_table["gold"] << ","
|
||||
<< string_table["villages"] << ","
|
||||
<< string_table["units"] << ","
|
||||
<< string_table["upkeep"] << ","
|
||||
|
@ -1010,12 +1022,6 @@ bool turn_slice(game_data& gameinfo, game_state& state_of_game,
|
|||
|
||||
str << team_name(n+1,units) << ",";
|
||||
|
||||
//only show gold for player's team and allies
|
||||
if(on_side)
|
||||
str << (data.gold < 0 ? "#":"") << data.gold << ",";
|
||||
else
|
||||
str << "?,";
|
||||
|
||||
str << data.villages << ","
|
||||
<< data.units << ","
|
||||
<< data.upkeep << ","
|
||||
|
|
|
@ -44,11 +44,11 @@ private:
|
|||
};
|
||||
|
||||
struct turn_info {
|
||||
turn_info() : left_button(false), right_button(false), enemy_paths(false),
|
||||
path_turns(0)
|
||||
turn_info() : left_button(false), right_button(false), middle_button(false),
|
||||
enemy_paths(false), path_turns(0)
|
||||
{}
|
||||
|
||||
bool left_button, right_button;
|
||||
bool left_button, right_button, middle_button;
|
||||
gamemap::location next_unit;
|
||||
paths current_paths;
|
||||
paths::route current_route;
|
||||
|
|
Loading…
Add table
Reference in a new issue