From ea3662625a67ad484a222375bbf0d751307f7753 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Fri, 30 Jun 2017 12:23:42 +1100 Subject: [PATCH] Renamed drawing_buffer to drawing_queue Also renamed drawing_queue::drawing_layer to just 'layer'. --- projectfiles/CodeBlocks/wesnoth.cbp | 4 +- source_lists/libwesnoth | 2 +- src/arrow.cpp | 2 +- src/arrow.hpp | 2 +- src/display.cpp | 32 ++++++++-------- src/display.hpp | 14 +++---- src/{drawing_buffer.cpp => drawing_queue.cpp} | 8 ++-- src/{drawing_buffer.hpp => drawing_queue.hpp} | 14 +++---- src/editor/editor_display.cpp | 4 +- src/game_display.cpp | 38 +++++++++---------- src/units/animation.cpp | 24 ++++++------ src/units/drawer.cpp | 14 +++---- src/units/frame.cpp | 36 +++++++++--------- src/units/frame.hpp | 8 ++-- src/whiteboard/attack.cpp | 6 +-- src/whiteboard/manager.cpp | 2 +- src/whiteboard/move.cpp | 2 +- src/whiteboard/recall.cpp | 2 +- src/whiteboard/recruit.cpp | 2 +- src/whiteboard/suppose_dead.cpp | 4 +- 20 files changed, 110 insertions(+), 110 deletions(-) rename src/{drawing_buffer.cpp => drawing_queue.cpp} (94%) rename src/{drawing_buffer.hpp => drawing_queue.hpp} (95%) diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index 935caf487e0d..9b1133e596ee 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -269,8 +269,8 @@ - - + + diff --git a/source_lists/libwesnoth b/source_lists/libwesnoth index ea361f79b221..00c0ea03d6d6 100644 --- a/source_lists/libwesnoth +++ b/source_lists/libwesnoth @@ -4,7 +4,7 @@ desktop/clipboard.cpp deprecation.cpp display.cpp display_context.cpp -drawing_buffer.cpp +drawing_queue.cpp events.cpp floating_label.cpp font/font_config.cpp diff --git a/src/arrow.cpp b/src/arrow.cpp index 949035f21f73..9f464330109b 100644 --- a/src/arrow.cpp +++ b/src/arrow.cpp @@ -29,7 +29,7 @@ static lg::log_domain log_arrows("arrows"); #define DBG_ARR LOG_STREAM(debug, log_arrows) arrow::arrow(bool hidden) - : layer_(drawing_buffer::LAYER_ARROWS) + : layer_(drawing_queue::LAYER_ARROWS) , color_("red") , style_(STYLE_STANDARD) , path_() diff --git a/src/arrow.hpp b/src/arrow.hpp index add4da769e5f..6c94fcbb9f56 100644 --- a/src/arrow.hpp +++ b/src/arrow.hpp @@ -90,7 +90,7 @@ class arrow { */ virtual void update_symbols(); - drawing_buffer::drawing_layer layer_; + drawing_queue::layer layer_; std::string color_; /// represents the subdirectory that holds images for this arrow style diff --git a/src/display.cpp b/src/display.cpp index 5b1072cb44be..e333de61b16f 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -206,7 +206,7 @@ display::display(const display_context * dc, std::weak_ptr wb, repo , animate_water_(true) , flags_() , activeTeam_(0) - , drawing_buffer_() + , drawing_queue_() , map_screenshot_(false) , reach_map_() , reach_map_old_() @@ -1395,7 +1395,7 @@ static void draw_background(const SDL_Rect& area, const std::string& image) } void display::draw_text_in_hex(const map_location& loc, - const drawing_buffer::drawing_layer layer, const std::string& text, + const drawing_queue::layer layer, const std::string& text, size_t font_size, color_t color, double x_in_hex, double y_in_hex) { if (text.empty()) return; @@ -1411,12 +1411,12 @@ void display::draw_text_in_hex(const map_location& loc, for (int dy=-1; dy <= 1; ++dy) { for (int dx=-1; dx <= 1; ++dx) { if (dx!=0 || dy!=0) { - drawing_buffer_add(layer, loc, x + dx, y + dy, back_surf); + drawing_queue_add(layer, loc, x + dx, y + dy, back_surf); } } } - drawing_buffer_add(layer, loc, x, y, text_surf); + drawing_queue_add(layer, loc, x, y, text_surf); } void display::select_hex(map_location hex) @@ -2807,13 +2807,13 @@ void display::draw(bool update, bool force) * draw_invalidated() also invalidates the halos, so also needs to be * ran if invalidated_.empty() == true. */ - //drawing_buffer_.set_clip_rect(map_area()); + //drawing_queue_.set_clip_rect(map_area()); if(!invalidated_.empty() || preferences::show_haloes()) { draw_invalidated(); invalidated_.clear(); } - //drawing_buffer_.render_buffer(); + //drawing_queue_.render_buffer(); post_commit(); draw_sidebar(); @@ -3091,10 +3091,10 @@ void display::draw_hex(const map_location& loc) // tod may differ from tod if hex is illuminated. const std::string& tod_hex_mask = tod.image_mask; if(tod_hex_mask1 != nullptr || tod_hex_mask2 != nullptr) { - drawing_buffer_add(drawing_buffer::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask1); - drawing_buffer_add(drawing_buffer::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask2); + drawing_queue_add(drawing_queue::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask1); + drawing_queue_add(drawing_queue::LAYER_TERRAIN_FG, loc, xpos, ypos, tod_hex_mask2); } else if(!tod_hex_mask.empty()) { - drawing_buffer_add(drawing_buffer::LAYER_TERRAIN_FG, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_TERRAIN_FG, loc, xpos, ypos, image::get_image(tod_hex_mask,image::SCALED_TO_HEX)); } #endif @@ -3126,8 +3126,8 @@ void display::draw_hex(const map_location& loc) if (draw_num_of_bitmaps_) { off_y -= text->h / 2; } - drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, bg); - drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, text); + drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, bg); + drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, text); } if(draw_terrain_codes_ && (game_config::debug || !shrouded(loc))) { @@ -3144,8 +3144,8 @@ void display::draw_hex(const map_location& loc) } else if (draw_num_of_bitmaps_ && !draw_coordinates_) { off_y -= text->h / 2; } - drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, bg); - drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, text); + drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, bg); + drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, text); } if(draw_num_of_bitmaps_) { @@ -3163,13 +3163,13 @@ void display::draw_hex(const map_location& loc) if (draw_terrain_codes_) { off_y += text->h / 2; } - drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, bg); - drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, off_x, off_y, text); + drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, bg); + drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, off_x, off_y, text); } } if(debug_foreground) { - drawing_buffer_add(drawing_buffer::LAYER_UNIT_DEFAULT, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_UNIT_DEFAULT, loc, xpos, ypos, image::get_image("terrain/foreground.png", image_type)); } #endif diff --git a/src/display.hpp b/src/display.hpp index b44ba6424cd0..a2aca5bdce1a 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -50,7 +50,7 @@ namespace wb { #include "animated.hpp" #include "display_context.hpp" -#include "drawing_buffer.hpp" +#include "drawing_queue.hpp" #include "font/sdl_ttf.hpp" #include "font/standard_colors.hpp" #include "image.hpp" //only needed for enums (!) @@ -844,7 +844,7 @@ class display : public video2::draw_layering * The font size is adjusted to the zoom factor. */ void draw_text_in_hex(const map_location& loc, - const drawing_buffer::drawing_layer layer, const std::string& text, size_t font_size, + const drawing_queue::layer layer, const std::string& text, size_t font_size, color_t color, double x_in_hex=0.5, double y_in_hex=0.5); protected: @@ -852,12 +852,12 @@ class display : public video2::draw_layering //TODO sort size_t activeTeam_; - drawing_buffer drawing_buffer_; + drawing_queue drawing_queue_; public: - drawing_buffer& get_drawing_buffer() + drawing_queue& get_drawing_queue() { - return drawing_buffer_; + return drawing_queue_; } /** @@ -868,14 +868,14 @@ class display : public video2::draw_layering * drawing order. */ - void drawing_buffer_add(const drawing_buffer::drawing_layer, + void drawing_queue_add(const drawing_queue::layer, const map_location&, int, int, const surface&, const SDL_Rect &clip = SDL_Rect()) { UNUSED(clip); } - void drawing_buffer_add(const drawing_buffer::drawing_layer, + void drawing_queue_add(const drawing_queue::layer, const map_location&, int, int, const std::vector&, const SDL_Rect &clip = SDL_Rect()) diff --git a/src/drawing_buffer.cpp b/src/drawing_queue.cpp similarity index 94% rename from src/drawing_buffer.cpp rename to src/drawing_queue.cpp index db5d98e3d6db..ecc75777064f 100644 --- a/src/drawing_buffer.cpp +++ b/src/drawing_queue.cpp @@ -12,7 +12,7 @@ See the COPYING file for more details. */ -#include "drawing_buffer.hpp" +#include "drawing_queue.hpp" #include "display.hpp" #include "sdl/surface.hpp" @@ -45,7 +45,7 @@ enum { } // end anon namespace -drawing_buffer::buffer_key::layer_group_array drawing_buffer::buffer_key::layer_groups {{ +drawing_queue::buffer_key::layer_group_array drawing_queue::buffer_key::layer_groups {{ LAYER_TERRAIN_BG, LAYER_UNIT_FIRST, LAYER_UNIT_MOVE_DEFAULT, @@ -53,7 +53,7 @@ drawing_buffer::buffer_key::layer_group_array drawing_buffer::buffer_key::layer_ LAYER_REACHMAP }}; -drawing_buffer::buffer_key::buffer_key(const map_location &loc, drawing_layer layer) +drawing_queue::buffer_key::buffer_key(const map_location &loc, layer layer) : key_(0) { // Start with the index of last group entry... @@ -85,7 +85,7 @@ drawing_buffer::buffer_key::buffer_key(const map_location &loc, drawing_layer la key_ |= (static_cast(layer) << SHIFT_LAYER) | static_cast(loc.x + MAX_BORDER) / 2; } -void drawing_buffer::render_buffer() +void drawing_queue::render_buffer() { // std::list::sort() is a stable sort buffer_.sort(); diff --git a/src/drawing_buffer.hpp b/src/drawing_queue.hpp similarity index 95% rename from src/drawing_buffer.hpp rename to src/drawing_queue.hpp index b6f00333fd4a..835cdd4f41ea 100644 --- a/src/drawing_buffer.hpp +++ b/src/drawing_queue.hpp @@ -23,10 +23,10 @@ #include #include -class drawing_buffer +class drawing_queue { public: - drawing_buffer() + drawing_queue() : buffer_() { } @@ -44,7 +44,7 @@ class drawing_buffer /** * The various map rendering layers. This controls the internal rendering order. */ - enum drawing_layer { + enum layer { /** Layer for the terrain drawn behind units. */ LAYER_TERRAIN_BG, @@ -151,7 +151,7 @@ class drawing_buffer class buffer_key { public: - buffer_key(const map_location& loc, drawing_layer layer); + buffer_key(const map_location& loc, layer layer); bool operator<(const buffer_key& rhs) const { @@ -161,7 +161,7 @@ class drawing_buffer private: unsigned int key_; - using layer_group_array = const std::array; + using layer_group_array = const std::array; // The drawing is done per layer_group, with the range per group being [low, high]. // FIXME: better documentation. @@ -172,7 +172,7 @@ class drawing_buffer class blit_helper { public: - blit_helper(const drawing_layer layer, + blit_helper(const layer layer, const map_location& loc, const int x, const int y, @@ -186,7 +186,7 @@ class drawing_buffer { } - blit_helper(const drawing_layer layer, + blit_helper(const layer layer, const map_location& loc, const int x, const int y, diff --git a/src/editor/editor_display.cpp b/src/editor/editor_display.cpp index f460a0f7578d..d3dc97a25816 100644 --- a/src/editor/editor_display.cpp +++ b/src/editor/editor_display.cpp @@ -87,13 +87,13 @@ void editor_display::draw_hex(const map_location& loc) display::draw_hex(loc); if (map().on_board_with_border(loc)) { if (map().in_selection(loc)) { - //drawing_buffer_add(drawing_buffer::LAYER_FOG_SHROUD, loc, xpos, ypos, + //drawing_queue_add(drawing_queue::LAYER_FOG_SHROUD, loc, xpos, ypos, // image::get_texture("editor/selection-overlay.png")); } if (brush_locations_.find(loc) != brush_locations_.end()) { static const image::locator brush(game_config::images::editor_brush); - //drawing_buffer_add(drawing_buffer::LAYER_SELECTED_HEX, loc, xpos, ypos, + //drawing_queue_add(drawing_queue::LAYER_SELECTED_HEX, loc, xpos, ypos, // image::get_texture(brush)); } } diff --git a/src/game_display.cpp b/src/game_display.cpp index 5ce676b720df..4635c520de71 100644 --- a/src/game_display.cpp +++ b/src/game_display.cpp @@ -317,30 +317,30 @@ void game_display::draw_hex(const map_location& loc) #if 0 if(on_map && loc == mouseoverHex_) { - drawing_buffer::drawing_layer hex_top_layer = drawing_buffer::LAYER_MOUSEOVER_BOTTOM; + drawing_queue::layer hex_top_layer = drawing_queue::LAYER_MOUSEOVER_BOTTOM; const unit *u = resources::gameboard->get_visible_unit(loc, dc_->teams()[viewing_team()] ); if( u != nullptr ) { - hex_top_layer = drawing_buffer::LAYER_MOUSEOVER_TOP; + hex_top_layer = drawing_queue::LAYER_MOUSEOVER_TOP; } if(u == nullptr) { - drawing_buffer_add( hex_top_layer, loc, xpos, ypos, + drawing_queue_add( hex_top_layer, loc, xpos, ypos, image::get_image("misc/hover-hex-top.png~RC(magenta>gold)", image::SCALED_TO_HEX)); - drawing_buffer_add(drawing_buffer::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, image::get_image("misc/hover-hex-bottom.png~RC(magenta>gold)", image::SCALED_TO_HEX)); } else if(dc_->teams()[currentTeam_].is_enemy(u->side())) { - drawing_buffer_add( hex_top_layer, loc, xpos, ypos, + drawing_queue_add( hex_top_layer, loc, xpos, ypos, image::get_image("misc/hover-hex-enemy-top.png~RC(magenta>red)", image::SCALED_TO_HEX)); - drawing_buffer_add(drawing_buffer::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, image::get_image("misc/hover-hex-enemy-bottom.png~RC(magenta>red)", image::SCALED_TO_HEX)); } else if(dc_->teams()[currentTeam_].side() == u->side()) { - drawing_buffer_add( hex_top_layer, loc, xpos, ypos, + drawing_queue_add( hex_top_layer, loc, xpos, ypos, image::get_image("misc/hover-hex-top.png~RC(magenta>green)", image::SCALED_TO_HEX)); - drawing_buffer_add(drawing_buffer::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, image::get_image("misc/hover-hex-bottom.png~RC(magenta>green)", image::SCALED_TO_HEX)); } else { - drawing_buffer_add( hex_top_layer, loc, xpos, ypos, + drawing_queue_add( hex_top_layer, loc, xpos, ypos, image::get_image("misc/hover-hex-top.png~RC(magenta>lightblue)", image::SCALED_TO_HEX)); - drawing_buffer_add(drawing_buffer::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, image::get_image("misc/hover-hex-bottom.png~RC(magenta>lightblue)", image::SCALED_TO_HEX)); } } @@ -366,7 +366,7 @@ void game_display::draw_hex(const map_location& loc) { std::vector footstepImages = footsteps_images(loc, route_, dc_); if (!footstepImages.empty()) { - drawing_buffer_add(drawing_buffer::LAYER_FOOTSTEPS, loc, xpos, ypos, footsteps_images(loc, route_, dc_)); + drawing_queue_add(drawing_queue::LAYER_FOOTSTEPS, loc, xpos, ypos, footsteps_images(loc, route_, dc_)); } } } @@ -416,7 +416,7 @@ void game_display::draw_hex(const map_location& loc) int debugH = debugHighlights_[loc]; if (debugH) { std::string txt = std::to_string(debugH); - draw_text_in_hex(loc, drawing_buffer::LAYER_MOVE_INFO, txt, 18, font::BAD_COLOR); + draw_text_in_hex(loc, drawing_queue::LAYER_MOVE_INFO, txt, 18, font::BAD_COLOR); } } @@ -488,22 +488,22 @@ void game_display::draw_movement_info(const map_location& loc) // simple mark (no turn point) use smaller font int def_font = w->second.turns > 0 ? 18 : 16; - draw_text_in_hex(loc, drawing_buffer::LAYER_MOVE_INFO, def_text.str(), def_font, color); + draw_text_in_hex(loc, drawing_queue::LAYER_MOVE_INFO, def_text.str(), def_font, color); int xpos = get_location_x(loc); int ypos = get_location_y(loc); if (w->second.invisible) { - drawing_buffer_add(drawing_buffer::LAYER_MOVE_INFO, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_MOVE_INFO, loc, xpos, ypos, image::get_image("misc/hidden.png", image::SCALED_TO_HEX)); } if (w->second.zoc) { - drawing_buffer_add(drawing_buffer::LAYER_MOVE_INFO, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_MOVE_INFO, loc, xpos, ypos, image::get_image("misc/zoc.png", image::SCALED_TO_HEX)); } if (w->second.capture) { - drawing_buffer_add(drawing_buffer::LAYER_MOVE_INFO, loc, xpos, ypos, + drawing_queue_add(drawing_queue::LAYER_MOVE_INFO, loc, xpos, ypos, image::get_image("misc/capture.png", image::SCALED_TO_HEX)); } @@ -511,7 +511,7 @@ void game_display::draw_movement_info(const map_location& loc) if (w->second.turns > 1 || (w->second.turns == 1 && loc != route_.steps.back())) { std::stringstream turns_text; turns_text << w->second.turns; - draw_text_in_hex(loc, drawing_buffer::LAYER_MOVE_INFO, turns_text.str(), 17, font::NORMAL_COLOR, 0.5,0.8); + draw_text_in_hex(loc, drawing_queue::LAYER_MOVE_INFO, turns_text.str(), 17, font::NORMAL_COLOR, 0.5,0.8); } // The hex is full now, so skip the "show enemy moves" @@ -536,7 +536,7 @@ void game_display::draw_movement_info(const map_location& loc) // use small font int def_font = 16; - draw_text_in_hex(loc, drawing_buffer::LAYER_MOVE_INFO, def_text.str(), def_font, color); + draw_text_in_hex(loc, drawing_queue::LAYER_MOVE_INFO, def_text.str(), def_font, color); } } @@ -544,7 +544,7 @@ void game_display::draw_movement_info(const map_location& loc) reach_map::iterator reach = reach_map_.find(loc); if(reach != reach_map_.end() && reach->second > 1) { const std::string num = std::to_string(reach->second); - draw_text_in_hex(loc, drawing_buffer::LAYER_MOVE_INFO, num, 16, font::YELLOW_COLOR); + draw_text_in_hex(loc, drawing_queue::LAYER_MOVE_INFO, num, 16, font::YELLOW_COLOR); } } } diff --git a/src/units/animation.cpp b/src/units/animation.cpp index 00a0ecd42a9f..a09a3e8caff9 100644 --- a/src/units/animation.cpp +++ b/src/units/animation.cpp @@ -544,7 +544,7 @@ void unit_animation::fill_initial_animations(std::vector& animat animations.push_back(base); animations.back().event_ = { "movement" }; animations.back().unit_anim_.override(0, 200, - particle::NO_CYCLE, "", "", {0,0,0}, "0~1:200", std::to_string(drawing_buffer::LAYER_UNIT_MOVE_DEFAULT - drawing_buffer::LAYER_UNIT_FIRST)); + particle::NO_CYCLE, "", "", {0,0,0}, "0~1:200", std::to_string(drawing_queue::LAYER_UNIT_MOVE_DEFAULT - drawing_queue::LAYER_UNIT_FIRST)); animations.push_back(base); animations.back().event_ = { "defend" }; @@ -558,7 +558,7 @@ void unit_animation::fill_initial_animations(std::vector& animat animations.push_back(base); animations.back().event_ = { "attack" }; - animations.back().unit_anim_.override(-150, 300, particle::NO_CYCLE, "", "", {0,0,0}, "0~0.6:150,0.6~0:150", std::to_string(drawing_buffer::LAYER_UNIT_MOVE_DEFAULT-drawing_buffer::LAYER_UNIT_FIRST)); + animations.back().unit_anim_.override(-150, 300, particle::NO_CYCLE, "", "", {0,0,0}, "0~0.6:150,0.6~0:150", std::to_string(drawing_queue::LAYER_UNIT_MOVE_DEFAULT-drawing_queue::LAYER_UNIT_FIRST)); animations.back().primary_attack_filter_.push_back(config()); animations.back().primary_attack_filter_.back()["range"] = "melee"; @@ -607,7 +607,7 @@ void unit_animation::fill_initial_animations(std::vector& animat static void add_simple_anim(std::vector& animations, const config& cfg, char const* tag_name, char const* apply_to, - drawing_buffer::drawing_layer layer = drawing_buffer::LAYER_UNIT_DEFAULT, + drawing_queue::layer layer = drawing_queue::LAYER_UNIT_DEFAULT, bool offscreen = true) { for(const animation_branch& ab : prepare_animation(cfg, tag_name)) { @@ -620,7 +620,7 @@ static void add_simple_anim(std::vector& animations, } config::attribute_value& v = anim["layer"]; - if(v.empty()) v = layer - drawing_buffer::LAYER_UNIT_FIRST; + if(v.empty()) v = layer - drawing_queue::LAYER_UNIT_FIRST; animations.push_back(unit_animation(anim)); } @@ -632,15 +632,15 @@ void unit_animation::add_anims( std::vector & animations, const animations.push_back(unit_animation(ab.merge())); } - const int default_layer = drawing_buffer::LAYER_UNIT_DEFAULT - drawing_buffer::LAYER_UNIT_FIRST; - const int move_layer = drawing_buffer::LAYER_UNIT_MOVE_DEFAULT - drawing_buffer::LAYER_UNIT_FIRST; - const int missile_layer = drawing_buffer::LAYER_UNIT_MISSILE_DEFAULT - drawing_buffer::LAYER_UNIT_FIRST; + const int default_layer = drawing_queue::LAYER_UNIT_DEFAULT - drawing_queue::LAYER_UNIT_FIRST; + const int move_layer = drawing_queue::LAYER_UNIT_MOVE_DEFAULT - drawing_queue::LAYER_UNIT_FIRST; + const int missile_layer = drawing_queue::LAYER_UNIT_MISSILE_DEFAULT - drawing_queue::LAYER_UNIT_FIRST; add_simple_anim(animations, cfg, "resistance_anim", "resistance"); add_simple_anim(animations, cfg, "leading_anim", "leading"); add_simple_anim(animations, cfg, "recruit_anim", "recruited"); add_simple_anim(animations, cfg, "recruiting_anim", "recruiting"); - add_simple_anim(animations, cfg, "idle_anim", "idling", drawing_buffer::LAYER_UNIT_DEFAULT, false); + add_simple_anim(animations, cfg, "idle_anim", "idling", drawing_queue::LAYER_UNIT_DEFAULT, false); add_simple_anim(animations, cfg, "levelin_anim", "levelin"); add_simple_anim(animations, cfg, "levelout_anim", "levelout"); @@ -736,7 +736,7 @@ void unit_animation::add_anims( std::vector & animations, const animations.back().sub_anims_["_poison_sound"].add_frame(1,frame_builder().sound(game_config::sounds::status::poisoned),true); } - add_simple_anim(animations, cfg, "pre_movement_anim", "pre_movement", drawing_buffer::LAYER_UNIT_MOVE_DEFAULT); + add_simple_anim(animations, cfg, "pre_movement_anim", "pre_movement", drawing_queue::LAYER_UNIT_MOVE_DEFAULT); for(const animation_branch& ab : prepare_animation(cfg, "movement_anim")) { config anim = ab.merge(); @@ -753,7 +753,7 @@ void unit_animation::add_anims( std::vector & animations, const animations.push_back(unit_animation(anim)); } - add_simple_anim(animations, cfg, "post_movement_anim", "post_movement", drawing_buffer::LAYER_UNIT_MOVE_DEFAULT); + add_simple_anim(animations, cfg, "post_movement_anim", "post_movement", drawing_queue::LAYER_UNIT_MOVE_DEFAULT); for(const animation_branch& ab : prepare_animation(cfg, "defend")) { config anim = ab.merge(); @@ -799,8 +799,8 @@ void unit_animation::add_anims( std::vector & animations, const } } - add_simple_anim(animations, cfg, "draw_weapon_anim", "draw_weapon", drawing_buffer::LAYER_UNIT_MOVE_DEFAULT); - add_simple_anim(animations, cfg, "sheath_weapon_anim", "sheath_weapon", drawing_buffer::LAYER_UNIT_MOVE_DEFAULT); + add_simple_anim(animations, cfg, "draw_weapon_anim", "draw_weapon", drawing_queue::LAYER_UNIT_MOVE_DEFAULT); + add_simple_anim(animations, cfg, "sheath_weapon_anim", "sheath_weapon", drawing_queue::LAYER_UNIT_MOVE_DEFAULT); for(const animation_branch& ab : prepare_animation(cfg, "attack_anim")) { config anim = ab.merge(); diff --git a/src/units/drawer.cpp b/src/units/drawer.cpp index f98ef345cba5..e901a4c7acae 100644 --- a/src/units/drawer.cpp +++ b/src/units/drawer.cpp @@ -232,16 +232,16 @@ void unit_drawer::redraw_unit(const unit & u) const } if(ellipse_back != nullptr) { - //disp.drawing_buffer_add(drawing_buffer::LAYER_UNIT_BG, loc, - //disp.drawing_buffer_add(drawing_buffer::LAYER_UNIT_FIRST, loc, + //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BG, loc, + //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_FIRST, loc, // xsrc, ysrc +adjusted_params.y-ellipse_floating, ellipse_back); disp.render_scaled_to_zoom(ellipse_back, xsrc, ysrc + adjusted_params.y - ellipse_floating); } if(ellipse_front != nullptr) { - //disp.drawing_buffer_add(drawing_buffer::LAYER_UNIT_FG, loc, - //disp.drawing_buffer_add(drawing_buffer::LAYER_UNIT_FIRST, loc, + //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_FG, loc, + //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_FIRST, loc, // xsrc, ysrc +adjusted_params.y-ellipse_floating, ellipse_front); disp.render_scaled_to_zoom(ellipse_front, xsrc, ysrc + adjusted_params.y - ellipse_floating); @@ -318,7 +318,7 @@ void unit_drawer::redraw_unit(const unit & u) const if(orb_img != nullptr) { texture orb(image::get_texture(*orb_img)); - //disp.drawing_buffer_add(drawing_buffer::LAYER_UNIT_BAR, + //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BAR, // loc, xsrc + xoff, ysrc + yoff + adjusted_params.y, orb); disp.render_scaled_to_zoom(orb, xsrc + xoff, ysrc + yoff + adjusted_params.y); } @@ -359,7 +359,7 @@ void unit_drawer::redraw_unit(const unit & u) const //if(bar_alpha != ftofxp(1.0)) { // crown = adjust_surface_alpha(crown, bar_alpha); //} - //disp.drawing_buffer_add(drawing_buffer::LAYER_UNIT_BAR, + //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BAR, // loc, xsrc+xoff, ysrc+yoff+adjusted_params.y, crown); disp.render_scaled_to_zoom(crown, xsrc + xoff, ysrc + yoff + adjusted_params.y); } @@ -368,7 +368,7 @@ void unit_drawer::redraw_unit(const unit & u) const for(const std::string& ov : u.overlays()) { const texture ov_img(image::get_texture(ov)); if(ov_img != nullptr) { - //disp.drawing_buffer_add(drawing_buffer::LAYER_UNIT_BAR, + //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BAR, // loc, xsrc+xoff, ysrc+yoff+adjusted_params.y, ov_img); disp.render_scaled_to_zoom(ov_img, xsrc + xoff, ysrc + yoff + adjusted_params.y); } diff --git a/src/units/frame.cpp b/src/units/frame.cpp index 1d82e797ccc7..b1aec056192a 100644 --- a/src/units/frame.cpp +++ b/src/units/frame.cpp @@ -38,7 +38,7 @@ frame_parameters::frame_parameters() , auto_vflip(boost::logic::indeterminate) , auto_hflip(boost::logic::indeterminate) , primary_frame(boost::logic::indeterminate) - , drawing_layer(drawing_buffer::LAYER_UNIT_DEFAULT - drawing_buffer::LAYER_UNIT_FIRST) + , layer(drawing_queue::LAYER_UNIT_DEFAULT - drawing_queue::LAYER_UNIT_FIRST) {} frame_builder::frame_builder() @@ -46,7 +46,7 @@ frame_builder::frame_builder() , auto_vflip_(boost::logic::indeterminate) , auto_hflip_(boost::logic::indeterminate) , primary_frame_(boost::logic::indeterminate) - , drawing_layer_(std::to_string(drawing_buffer::LAYER_UNIT_DEFAULT - drawing_buffer::LAYER_UNIT_FIRST)) + , layer_(std::to_string(drawing_queue::LAYER_UNIT_DEFAULT - drawing_queue::LAYER_UNIT_FIRST)) {} frame_builder::frame_builder(const config& cfg,const std::string& frame_string) @@ -71,7 +71,7 @@ frame_builder::frame_builder(const config& cfg,const std::string& frame_string) , auto_vflip_(boost::logic::indeterminate) , auto_hflip_(boost::logic::indeterminate) , primary_frame_(boost::logic::indeterminate) - , drawing_layer_(cfg[frame_string + "layer"]) + , layer_(cfg[frame_string + "layer"]) { if(!cfg.has_attribute(frame_string + "auto_vflip")) { auto_vflip_ = boost::logic::indeterminate; @@ -231,9 +231,9 @@ frame_builder& frame_builder::primary_frame(const bool primary_frame) return *this; } -frame_builder& frame_builder::drawing_layer(const std::string& drawing_layer) +frame_builder& frame_builder::layer(const std::string& layer) { - drawing_layer_=drawing_layer; + layer_=layer; return *this; } @@ -261,7 +261,7 @@ frame_parsed_parameters::frame_parsed_parameters(const frame_builder& builder, i , auto_vflip_(builder.auto_vflip_) , auto_hflip_(builder.auto_hflip_) , primary_frame_(builder.primary_frame_) - , drawing_layer_(builder.drawing_layer_,duration_) + , layer_(builder.layer_,duration_) {} bool frame_parsed_parameters::does_not_change() const @@ -280,7 +280,7 @@ bool frame_parsed_parameters::does_not_change() const y_.does_not_change() && directional_x_.does_not_change() && directional_y_.does_not_change() && - drawing_layer_.does_not_change(); + layer_.does_not_change(); } bool frame_parsed_parameters::need_update() const @@ -314,7 +314,7 @@ const frame_parameters frame_parsed_parameters::parameters(int current_time) con result.auto_vflip = auto_vflip_; result.auto_hflip = auto_hflip_; result.primary_frame = primary_frame_; - result.drawing_layer = drawing_layer_.get_current_element(current_time,drawing_buffer::LAYER_UNIT_DEFAULT-drawing_buffer::LAYER_UNIT_FIRST); + result.layer = layer_.get_current_element(current_time,drawing_queue::LAYER_UNIT_DEFAULT-drawing_queue::LAYER_UNIT_FIRST); return result; } @@ -346,9 +346,9 @@ void frame_parsed_parameters::override(int duration, } if(!layer.empty()) { - drawing_layer_ = progressive_int(layer,duration); + layer_ = progressive_int(layer,duration); } else if(duration != duration_){ - drawing_layer_ = progressive_int(drawing_layer_.get_original(),duration); + layer_ = progressive_int(layer_.get_original(),duration); } if(!modifiers.empty()) { @@ -466,8 +466,8 @@ std::vector frame_parsed_parameters::debug_strings() const v.emplace_back("primary_frame=" + utils::bool_string(primary_frame_)); } - if(!drawing_layer_.get_original().empty()) { - v.emplace_back("drawing_layer=" + drawing_layer_.get_original()); + if(!layer_.get_original().empty()) { + v.emplace_back("layer=" + layer_.get_original()); } return v; @@ -597,7 +597,7 @@ void unit_frame::redraw(const int frame_time, bool on_start_time, bool in_scope_ SDL_Rect srcrect {0, 0, surf->w, submerge_height}; - //drawing_buffer_add(drawing_layer, loc, x, y, surf, srcrect); + //drawing_queue_add(layer, loc, x, y, surf, srcrect); if(submerge_height != surf->h) { //the lower part will be transparent @@ -610,7 +610,7 @@ void unit_frame::redraw(const int frame_time, bool on_start_time, bool in_scope_ srcrect.h = surf->h-submerge_height; y += submerge_height; - //drawing_buffer_add(drawing_layer, loc, x, y, surf, srcrect); + //drawing_queue_add(layer, loc, x, y, surf, srcrect); } } #endif @@ -926,10 +926,10 @@ const frame_parameters unit_frame::merge_parameters(int current_time, const fram assert(engine_val.directional_y == 0); result.directional_y = current_val.directional_y ? current_val.directional_y : animation_val.directional_y; - assert(engine_val.drawing_layer == drawing_buffer::LAYER_UNIT_DEFAULT - drawing_buffer::LAYER_UNIT_FIRST); - result.drawing_layer = current_val.drawing_layer != drawing_buffer::LAYER_UNIT_DEFAULT-drawing_buffer::LAYER_UNIT_FIRST - ? current_val.drawing_layer - : animation_val.drawing_layer; + assert(engine_val.layer == drawing_queue::LAYER_UNIT_DEFAULT - drawing_queue::LAYER_UNIT_FIRST); + result.layer = current_val.layer != drawing_queue::LAYER_UNIT_DEFAULT-drawing_queue::LAYER_UNIT_FIRST + ? current_val.layer + : animation_val.layer; /** The engine provides us with a default value to compare to. Update if different */ result.auto_hflip = engine_val.auto_hflip; diff --git a/src/units/frame.hpp b/src/units/frame.hpp index 471f9baab245..214541f4824d 100644 --- a/src/units/frame.hpp +++ b/src/units/frame.hpp @@ -66,7 +66,7 @@ struct frame_parameters boost::tribool auto_hflip; boost::tribool primary_frame; - int drawing_layer; + int layer; }; /** @@ -97,7 +97,7 @@ class frame_builder frame_builder& auto_vflip(const bool auto_vflip); frame_builder& auto_hflip(const bool auto_hflip); frame_builder& primary_frame(const bool primary_frame); - frame_builder& drawing_layer(const std::string& drawing_layer); + frame_builder& layer(const std::string& layer); private: friend class frame_parsed_parameters; @@ -130,7 +130,7 @@ class frame_builder boost::tribool auto_hflip_; boost::tribool primary_frame_; - std::string drawing_layer_; + std::string layer_; }; /** @@ -192,7 +192,7 @@ class frame_parsed_parameters boost::tribool auto_hflip_; boost::tribool primary_frame_; - progressive_int drawing_layer_; + progressive_int layer_; }; /** Describes a unit's animation sequence. */ diff --git a/src/whiteboard/attack.cpp b/src/whiteboard/attack.cpp index a0f0b618cf97..2bcbe3699041 100644 --- a/src/whiteboard/attack.cpp +++ b/src/whiteboard/attack.cpp @@ -192,7 +192,7 @@ void attack::draw_hex(const map_location& hex) { //@todo: replace this by either the use of transparency + LAYER_ATTACK_INDICATOR, //or a dedicated layer - const drawing_buffer::drawing_layer layer = drawing_buffer::LAYER_FOOTSTEPS; + const drawing_queue::layer layer = drawing_queue::LAYER_FOOTSTEPS; //calculate direction (valid for both hexes) std::string direction_text = map_location::write_direction( @@ -203,7 +203,7 @@ void attack::draw_hex(const map_location& hex) int xpos = display::get_singleton()->get_location_x(get_dest_hex()); int ypos = display::get_singleton()->get_location_y(get_dest_hex()); - display::get_singleton()->drawing_buffer_add(layer, get_dest_hex(), xpos, ypos, + display::get_singleton()->drawing_queue_add(layer, get_dest_hex(), xpos, ypos, image::get_image("whiteboard/attack-indicator-src-" + direction_text + ".png")); } else if (hex == target_hex_) //add symbol to defender hex @@ -211,7 +211,7 @@ void attack::draw_hex(const map_location& hex) //int xpos = display::get_singleton()->get_location_x(target_hex_); //int ypos = display::get_singleton()->get_location_y(target_hex_); - //display::get_singleton()->drawing_buffer_add(layer, target_hex_, xpos, ypos, + //display::get_singleton()->drawing_queue_add(layer, target_hex_, xpos, ypos, // image::get_texture("whiteboard/attack-indicator-dst-" + direction_text + ".png")); } } diff --git a/src/whiteboard/manager.cpp b/src/whiteboard/manager.cpp index 55f3bc593d68..0c98de8a8d3b 100644 --- a/src/whiteboard/manager.cpp +++ b/src/whiteboard/manager.cpp @@ -469,7 +469,7 @@ static void draw_numbers(const map_location& hex, side_actions::numbers_t number color_t color = team::get_side_color(static_cast(team_numbers[i]+1)); const double x_in_hex = x_origin + x_offset; const double y_in_hex = y_origin + y_offset; - display::get_singleton()->draw_text_in_hex(hex, drawing_buffer::LAYER_ACTIONS_NUMBERING, + display::get_singleton()->draw_text_in_hex(hex, drawing_queue::LAYER_ACTIONS_NUMBERING, number_text, font_size, color, x_in_hex, y_in_hex); x_offset += x_offset_base; y_offset += y_offset_base; diff --git a/src/whiteboard/move.cpp b/src/whiteboard/move.cpp index 0efb0d870f47..7d9be17182fd 100644 --- a/src/whiteboard/move.cpp +++ b/src/whiteboard/move.cpp @@ -391,7 +391,7 @@ void move::draw_hex(const map_location& hex) { std::stringstream turn_text; turn_text << turn_number_; - display::get_singleton()->draw_text_in_hex(hex, drawing_buffer::LAYER_MOVE_INFO, turn_text.str(), 17, font::NORMAL_COLOR, 0.5,0.8); + display::get_singleton()->draw_text_in_hex(hex, drawing_queue::LAYER_MOVE_INFO, turn_text.str(), 17, font::NORMAL_COLOR, 0.5,0.8); } } diff --git a/src/whiteboard/recall.cpp b/src/whiteboard/recall.cpp index bd91b6029c4e..2670dbf383cd 100644 --- a/src/whiteboard/recall.cpp +++ b/src/whiteboard/recall.cpp @@ -191,7 +191,7 @@ void recall::draw_hex(const map_location& hex) } size_t font_size = 16; color_t color {255, 0, 0}; //red - display::get_singleton()->draw_text_in_hex(hex, drawing_buffer::LAYER_ACTIONS_NUMBERING, + display::get_singleton()->draw_text_in_hex(hex, drawing_queue::LAYER_ACTIONS_NUMBERING, number_text.str(), font_size, color, x_offset, y_offset); } } diff --git a/src/whiteboard/recruit.cpp b/src/whiteboard/recruit.cpp index b0b2c43f42ef..fbf3e5c62444 100644 --- a/src/whiteboard/recruit.cpp +++ b/src/whiteboard/recruit.cpp @@ -155,7 +155,7 @@ void recruit::draw_hex(const map_location& hex) number_text << font::unicode_minus << cost_; size_t font_size = 16; color_t color {255, 0, 0}; //red - display::get_singleton()->draw_text_in_hex(hex, drawing_buffer::LAYER_ACTIONS_NUMBERING, + display::get_singleton()->draw_text_in_hex(hex, drawing_queue::LAYER_ACTIONS_NUMBERING, number_text.str(), font_size, color, x_offset, y_offset); } } diff --git a/src/whiteboard/suppose_dead.cpp b/src/whiteboard/suppose_dead.cpp index d76d857dfb05..f16303423d6b 100644 --- a/src/whiteboard/suppose_dead.cpp +++ b/src/whiteboard/suppose_dead.cpp @@ -138,11 +138,11 @@ void suppose_dead::draw_hex(const map_location& hex) if(hex == loc_) //add symbol to hex { //@todo: Possibly use a different layer - //const drawing_buffer::drawing_layer layer = drawing_buffer::LAYER_ARROWS; + //const drawing_queue::layer layer = drawing_queue::LAYER_ARROWS; //int xpos = display::get_singleton()->get_location_x(loc_); //int ypos = display::get_singleton()->get_location_y(loc_); - //display::get_singleton()->drawing_buffer_add(layer, loc_, xpos, ypos, + //display::get_singleton()->drawing_queue_add(layer, loc_, xpos, ypos, // image::get_texture("whiteboard/suppose_dead.png")); } }