16 #define GETTEXT_DOMAIN "wesnoth-editor"
37 :
display(nullptr, std::shared_ptr<
wb::manager>(), reports_object,
"editor",
config())
40 , mouseover_hex_overlay_()
81 if(
get_map().in_selection(loc)) {
125 if (
context().teams().empty()) {
163 const color_t color{0, 0, 0, 0xbb};
168 std::string formatted_str;
170 formatted_str =
VGETTEXT(
"<span color='#66ff00'><span face='DejaVuSans'>✔</span> $msg</span>", {{
"msg", str}});
172 formatted_str =
VGETTEXT(
"<span color='red'><span face='DejaVuSans'>✘</span> $msg</span>", {{
"msg", str}});
175 using namespace std::chrono_literals;
218 const color_t color{0, 0, 0, 0xbb};
Definitions for the terrain builder.
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
config & add_child(config_key_type key)
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
bool map_screenshot_
Used to indicate to drawing functions that we are doing a map screenshot.
std::map< map_location, std::vector< overlay > > overlay_map
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
virtual void layout() override
Finalize screen layout.
map_location mouseoverHex_
const rect_of_hexes get_visible_hexes() const
Returns the rectangular area of visible hexes.
void drawing_buffer_add(const drawing_layer layer, const map_location &loc, decltype(draw_helper::do_draw) draw_func)
Add an item to the drawing buffer.
rect map_outside_area() const
Returns the available area for a map, this may differ from the above.
const display_context & context() const
const std::unique_ptr< terrain_builder > builder_
virtual void draw_hex(const map_location &loc)
Redraws a single gamemap location.
void refresh_report(const std::string &report_name, const config *new_cfg=nullptr)
Update the given report.
The brush class represents a single brush – a set of relative locations around a "hotspot",...
The editor_controller class contains the mouse and keyboard event handling routines for the editor.
map_context & get_current_map_context() const
std::string help_string_
Current help string, cached for easy visibility toggling.
virtual overlay_map & get_overlays() override
Inherited from display.
virtual void layout() override
TLD layout() override.
texture mouseover_hex_overlay_
virtual const time_of_day & get_time_of_day(const map_location &loc=map_location::null_location()) const override
Inherited from display.
void set_help_string(const std::string &str)
Sets and shows the tooltip-like text at the top or bottom of the map area.
void rebuild_terrain(const map_location &loc)
int help_handle_
ID of the floating label that's controlled by set_help_string() / clear_help_string().
rect get_clip_rect() const override
Get the clipping rectangle for drawing.
std::set< map_location > brush_locations_
bool help_string_at_top_
Ignored when help_handle_ == 0.
bool help_string_enabled_
Whether the help text is currently shown.
void remove_brush_loc(const map_location &hex)
editor_controller & controller_
void set_help_string_enabled(bool value)
Sets whether the help text should be shown.
editor_display(editor_controller &controller, reports &reports_object)
void add_brush_loc(const map_location &hex)
void draw_hex(const map_location &loc) override
Redraws a single gamemap location.
void set_brush_locs(const std::set< map_location > &hexes)
const editor_map & get_map() const
void set_status(const std::string &str, const bool is_success)
Set a status text at the bottom left of the map area.
void clear_help_string()
Removes the help string.
overlay_map & get_overlays()
const tod_manager * get_time_manager() const
void set_position(double xpos, double ypos)
void set_lifetime(const std::chrono::milliseconds &lifetime, const std::chrono::milliseconds &fadeout=std::chrono::milliseconds{100})
void set_border_size(int border)
void set_bg_color(const color_t &bg_color)
void set_font_size(int font_size)
std::string get_terrain_editor_string(const map_location &loc) const
Generic locator abstracting the location of an image.
void set_alpha_mod(uint8_t alpha)
Alpha modifier.
const time_of_day & get_time_of_day(int for_turn=0) const
Returns global time of day for the passed turn.
Drawing functions, for drawing things on the screen.
@ border
The border of the map.
@ mouseover_overlay
Mouseover overlay used by editor.
@ fog_shroud
Fog and shroud.
@ selected_hex
Image on the selected unit.
New lexcical_cast header.
void blit(const texture &tex, const SDL_Rect &dst)
Draws a texture, or part of a texture, at the given location.
Manage the empty-palette in the editor.
int pango_line_width(const std::string &line, int font_size, font::pango_text::FONT_STYLE font_style=font::pango_text::STYLE_NORMAL)
Determine the width of a line of text given a certain font size.
int add_floating_label(const floating_label &flabel)
add a label floating on the screen above everything else.
SDL_Rect get_floating_label_rect(int handle)
void remove_floating_label(int handle, const std::chrono::milliseconds &fadeout)
removes the floating label given by 'handle' from the screen
void move_floating_label(int handle, double xmove, double ymove)
moves the floating label given by 'handle' by (xmove,ymove)
@ HEXED
Standard hexagonal tile mask applied, removing portions that don't fit.
@ TOD_COLORED
Same as HEXED, but with Time of Day color tint applied.
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
Unit and team statistics.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
point game_canvas_size()
The size of the game canvas, in drawing coordinates / game pixels.
Transitional API for porting SDL_ttf-based code to Pango.
The basic class for representing 8-bit RGB or RGBA colour values.
Encapsulates the map of the game.
An abstract description of a rectangle with integer coordinates.
Object which defines a time of day with associated bonuses, image, sounds etc.