The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2017 by Tomasz Sniatowski <>
3  Part of the Battle for Wesnoth Project
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,
12  See the COPYING file for more details.
13 */
15 #pragma once
17 #include "map/editor_map.hpp"
18 #include "display.hpp"
20 namespace editor {
24 class editor_display : public display
25 {
26 public:
27  editor_display(editor_controller& controller, CVideo& video, reports& reports_object, const config& theme_cfg);
29  bool in_editor() const override { return true; }
31  void add_brush_loc(const map_location& hex);
32  void set_brush_locs(const std::set<map_location>& hexes);
33  void clear_brush_locs();
34  void remove_brush_loc(const map_location& hex);
35  const editor_map& map() const { return static_cast<const editor_map&>(get_map()); }
36  void rebuild_terrain(const map_location &loc);
38  /** Inherited from display. */
39  virtual const tod_manager& get_tod_man() const override;
41  /** Inherited from display. */
42  virtual const time_of_day& get_time_of_day(const map_location& loc = map_location::null_location()) const override;
45  {
46  return controller_;
47  }
49 protected:
50  void pre_draw() override;
51  /**
52  * The editor uses different rules for terrain highlighting (e.g. selections)
53  */
54  image::TYPE get_image_type(const map_location& loc) override;
56  void draw_hex(const map_location& loc) override;
58  const SDL_Rect& get_clip_rect() override;
59  void draw_sidebar() override;
61  std::set<map_location> brush_locations_;
63  /* The controller that owns this display. */
65 };
67 } //end namespace editor
UNSCALED : image will be drawn "as is" without changing size, even in case of redraw SCALED_TO_ZOOM :...
Definition: image.hpp:189
image::TYPE get_image_type(const map_location &loc) override
The editor uses different rules for terrain highlighting (e.g.
editor_display(editor_controller &controller, CVideo &video, reports &reports_object, const config &theme_cfg)
editor_controller & controller_
void set_brush_locs(const std::set< map_location > &hexes)
Definition: video.hpp:29
virtual const tod_manager & get_tod_man() const override
Inherited from display.
bool in_editor() const override
The editor_controller class contains the mouse and keyboard event handling routines for the editor...
Unit and team statistics.
Object which defines a time of day with associated bonuses, image, sounds etc.
Definition: time_of_day.hpp:57
void draw_sidebar() override
Called near the end of a draw operation, derived classes can use this to render a specific sidebar...
void remove_brush_loc(const map_location &hex)
void pre_draw() override
Called near the beginning of each draw() call.
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
static const map_location & null_location()
Definition: location.hpp:220
Encapsulates the map of the game.
Definition: location.hpp:40
This class adds extra editor-specific functionality to a normal gamemap.
Definition: editor_map.hpp:69
const display_context * get_dummy_display_context()
void rebuild_terrain(const map_location &loc)
const SDL_Rect & get_clip_rect() override
Get the clipping rectangle for drawing.
std::set< map_location > brush_locations_
const gamemap & get_map() const
Definition: display.hpp:92
editor_controller & get_controller()
void add_brush_loc(const map_location &hex)
CVideo & video()
Gets the underlying screen object.
Definition: display.hpp:195
void draw_hex(const map_location &loc) override
Redraws a single gamemap location.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
const editor_map & map() const