Skip to content

Commit

Permalink
Display: always draw the map in the full window
Browse files Browse the repository at this point in the history
This is a temporary measure that removes reliance on the theme map rect.
I need to ponder the best design to handle displaying the full map.
  • Loading branch information
Vultraz committed Mar 24, 2018
1 parent 5ece7ac commit 49d36e6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
12 changes: 11 additions & 1 deletion src/display.cpp
Expand Up @@ -497,6 +497,11 @@ const SDL_Rect& display::map_area() const
return res;
}

const SDL_Rect display::map_outside_area() const
{
return map_screenshot_ ? max_map_area() : video_.screen_area();
}

bool display::outside_area(const SDL_Rect& area, const int x, const int y)
{
const int x_thresh = hex_size();
Expand Down Expand Up @@ -616,6 +621,11 @@ const rect_of_hexes display::hexes_under_rect(const SDL_Rect& r) const
return res;
}

const rect_of_hexes display::get_visible_hexes() const
{
return hexes_under_rect(map_area());
}

bool display::team_valid() const
{
return currentTeam_ < dc_->teams().size();
Expand Down Expand Up @@ -1551,7 +1561,7 @@ const map_labels& display::labels() const
return *map_labels_;
}

const SDL_Rect& display::get_clip_rect()
const SDL_Rect display::get_clip_rect()
{
return map_area();
}
Expand Down
12 changes: 3 additions & 9 deletions src/display.hpp
Expand Up @@ -298,10 +298,7 @@ class display : public events::sdl_handler
* Returns the available area for a map, this may differ from the above.
* This area will get the background area applied to it.
*/
const SDL_Rect& map_outside_area() const
{
return map_screenshot_ ? max_map_area() : theme_.main_map_location(video_.screen_area());
}
const SDL_Rect map_outside_area() const;

/** Check if the bbox of the hex at x,y has pixels outside the area rectangle. */
static bool outside_area(const SDL_Rect& area, const int x, const int y);
Expand Down Expand Up @@ -383,10 +380,7 @@ class display : public events::sdl_handler
const rect_of_hexes hexes_under_rect(const SDL_Rect& r) const;

/** Returns the rectangular area of visible hexes */
const rect_of_hexes get_visible_hexes() const
{
return hexes_under_rect(map_area());
}
const rect_of_hexes get_visible_hexes() const;

/** Returns true if location (x,y) is covered in shroud. */
bool shrouded(const map_location& loc) const;
Expand Down Expand Up @@ -864,7 +858,7 @@ class display : public events::sdl_handler
* Get the clipping rectangle for drawing.
* Virtual since the editor might use a slightly different approach.
*/
virtual const SDL_Rect& get_clip_rect();
virtual const SDL_Rect get_clip_rect();

/** Draw the appropriate fog or shroud transition images for a specific hex. */
void draw_fog_shroud_transition_images(const map_location& loc, image::TYPE image_type);
Expand Down
2 changes: 1 addition & 1 deletion src/editor/editor_display.cpp
Expand Up @@ -99,7 +99,7 @@ void editor_display::draw_hex_overlays()
}
}

const SDL_Rect& editor_display::get_clip_rect()
const SDL_Rect editor_display::get_clip_rect()
{
return map_outside_area();
}
Expand Down
2 changes: 1 addition & 1 deletion src/editor/editor_display.hpp
Expand Up @@ -51,7 +51,7 @@ class editor_display : public display
virtual void draw_hex_cursor(const map_location& loc) override;
virtual void draw_hex_overlays() override;

const SDL_Rect& get_clip_rect() override;
const SDL_Rect get_clip_rect() override;

std::set<map_location> brush_locations_;

Expand Down

0 comments on commit 49d36e6

Please sign in to comment.