The Battle for Wesnoth  1.15.0-dev
editor_display.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by Tomasz Sniatowski <kailoran@gmail.com>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include "map/editor_map.hpp"
18 #include "display.hpp"
19 
20 namespace editor {
21 
22 class editor_display : public display
23 {
24 public:
26 
27  bool in_editor() const override { return true; }
28 
29  void add_brush_loc(const map_location& hex);
30  void set_brush_locs(const std::set<map_location>& hexes);
31  void clear_brush_locs();
32  void remove_brush_loc(const map_location& hex);
33  const editor_map& map() const { return static_cast<const editor_map&>(get_map()); }
34  void rebuild_terrain(const map_location &loc);
35 
36  /** Inherited from display. */
37  virtual const time_of_day& get_time_of_day(const map_location& loc = map_location::null_location()) const override;
38 
40  {
41  return controller_;
42  }
43 
44 protected:
45  void pre_draw() override;
46  /**
47  * The editor uses different rules for terrain highlighting (e.g. selections)
48  */
49  image::TYPE get_image_type(const map_location& loc) override;
50 
51  virtual void draw_hex_cursor(const map_location& loc) override;
52  virtual void draw_hex_overlays() override;
53 
54  /** Inherited from display. */
55  virtual overlay_map& get_overlays() override;
56 
57  const SDL_Rect get_clip_rect() override;
58 
59  std::set<map_location> brush_locations_;
60 
61  /* The controller that owns this display. */
63 };
64 
65 } //end namespace editor
TYPE
UNSCALED : image will be drawn "as is" without changing size, even in case of redraw SCALED_TO_ZOOM :...
Definition: picture.hpp:181
const editor_map & map() const
image::TYPE get_image_type(const map_location &loc) override
The editor uses different rules for terrain highlighting (e.g.
editor_controller & controller_
virtual overlay_map & get_overlays() override
Inherited from display.
void set_brush_locs(const std::set< map_location > &hexes)
bool in_editor() const override
The editor_controller class contains the mouse and keyboard event handling routines for the editor...
Object which defines a time of day with associated bonuses, image, sounds etc.
Definition: time_of_day.hpp:57
void remove_brush_loc(const map_location &hex)
void pre_draw() override
Called at the beginning of each draw cycle.
const SDL_Rect get_clip_rect() override
Get the clipping rectangle for drawing.
virtual const time_of_day & get_time_of_day(const map_location &loc=map_location::null_location()) const override
Inherited from display.
map_display and display: classes which take care of displaying the map and game-data on the screen...
Manage the empty-palette in the editor.
Definition: action.cpp:29
editor_display(editor_controller &controller, const config &theme_cfg)
Encapsulates the map of the game.
Definition: location.hpp:42
This class adds extra editor-specific functionality to a normal gamemap.
Definition: editor_map.hpp:69
void rebuild_terrain(const map_location &loc)
std::set< map_location > brush_locations_
virtual void draw_hex_overlays() override
Draws various map overlays such as game reachmap.
const gamemap & get_map() const
Definition: display.hpp:109
editor_controller & get_controller()
void add_brush_loc(const map_location &hex)
virtual void draw_hex_cursor(const map_location &loc) override
Draws the map&#39;s hex cursor.
static const map_location & null_location()
Definition: location.hpp:85
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68
std::multimap< map_location, overlay > overlay_map
Definition: display.hpp:904