Merge lp:~widelands-dev/widelands/rendertarget_ints into lp:widelands
- rendertarget_ints
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 8356 |
Proposed branch: | lp:~widelands-dev/widelands/rendertarget_ints |
Merge into: | lp:widelands |
Diff against target: |
2403 lines (+403/-393) 62 files modified
src/base/vector.h (+4/-1) src/editor/editorinteractive.cc (+1/-1) src/editor/ui_menus/main_menu_load_or_save_map.cc (+1/-1) src/editor/ui_menus/main_menu_map_options.cc (+1/-1) src/editor/ui_menus/main_menu_random_map.cc (+1/-1) src/editor/ui_menus/tool_change_resources_options_menu.cc (+1/-1) src/editor/ui_menus/tool_place_critter_options_menu.cc (+1/-1) src/editor/ui_menus/tool_place_immovable_options_menu.cc (+1/-1) src/editor/ui_menus/tool_set_terrain_options_menu.cc (+1/-1) src/game_io/game_interactive_player_packet.cc (+1/-1) src/graphic/animation.cc (+1/-1) src/graphic/font_handler.cc (+6/-7) src/graphic/gl/fields_to_draw.h (+4/-4) src/graphic/minimap_renderer.cc (+4/-4) src/graphic/rendertarget.cc (+15/-24) src/graphic/rendertarget.h (+9/-11) src/graphic/richtext.cc (+4/-4) src/graphic/text_layout.cc (+2/-2) src/graphic/text_layout.h (+2/-2) src/graphic/wordwrap.cc (+3/-3) src/logic/map_objects/map_object.cc (+9/-9) src/logic/map_objects/tribes/soldier.cc (+19/-22) src/logic/map_objects/tribes/soldier.h (+1/-1) src/profile/profile.h (+1/-1) src/scripting/lua_ui.cc (+4/-4) src/ui_basic/button.cc (+24/-24) src/ui_basic/checkbox.cc (+7/-7) src/ui_basic/editbox.cc (+10/-10) src/ui_basic/fullscreen_window.cc (+3/-3) src/ui_basic/icon.cc (+1/-1) src/ui_basic/listselect.cc (+11/-11) src/ui_basic/multilineeditbox.cc (+8/-8) src/ui_basic/multilinetextarea.cc (+2/-2) src/ui_basic/panel.cc (+6/-6) src/ui_basic/progressbar.cc (+7/-6) src/ui_basic/progresswindow.cc (+6/-3) src/ui_basic/progresswindow.h (+2/-2) src/ui_basic/scrollbar.cc (+38/-38) src/ui_basic/scrollbar.h (+2/-2) src/ui_basic/slider.cc (+28/-27) src/ui_basic/table.cc (+8/-8) src/ui_basic/tabpanel.cc (+19/-19) src/ui_basic/textarea.cc (+3/-3) src/ui_basic/window.cc (+20/-19) src/ui_fsmenu/mapselect.cc (+2/-2) src/ui_fsmenu/options.cc (+13/-13) src/wlapplication.cc (+4/-4) src/wui/chatoverlay.cc (+2/-2) src/wui/field_overlay_manager.h (+2/-2) src/wui/game_tips.cc (+3/-3) src/wui/general_statistics_menu.cc (+14/-12) src/wui/inputqueuedisplay.cc (+2/-2) src/wui/interactive_base.cc (+6/-7) src/wui/interactive_gamebase.cc (+4/-2) src/wui/itemwaresdisplay.cc (+2/-2) src/wui/mapview.cc (+10/-9) src/wui/mapview.h (+10/-1) src/wui/minimap.cc (+1/-1) src/wui/plot_area.cc (+16/-13) src/wui/soldierlist.cc (+5/-5) src/wui/warehousewindow.cc (+1/-1) src/wui/waresdisplay.cc (+4/-4) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/rendertarget_ints |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | code | Approve | |
Review via email: mp+322996@code.launchpad.net |
Commit message
Use int values in RenderTarget and alignment functions where float precision is not needed.
- RenderTarget:
- UI::correct_
- Consistently use UI::correct_
- Replaced Vector2<T> default constructor with static function Vector2<T>::zero()
Description of the change
Use ints in RenderTarget everywhere except for scaled map elements and plot lines. This means no more hunting for fuzzy-looking GUI elements and text.
bunnybot (widelandsofficial) wrote : | # |
Notabilis (notabilis27) wrote : | # |
The diff looks okay to me and a short test game hasn't shown any optical glitches. But... ;-)
Three minor remarks code-wise:
- Is there a reason that Bob::calc_drawpos() (and derived methods) are still returning floats? Since it returns the pixel position on the screen I guess it is always an integer anyway.
- UI::correct_
- correct_
Another problem is a crash I encountered in my test game. It happened randomly and I couldn't reproduce it, so it might be also in trunk. But since it is graphic/blitting related I post the backtrace here for now.
Cmd_EnemyFlagAc
Cmd_EnemyFlagAc
Cmd_EnemyFlagAc
Forcing flag at (45, 31)
Thread 1 "widelands" received signal SIGSEGV, Segmentation fault.
0x0000555555de1828 in std::equal_
at /usr/include/
356 { return __x == __y; }
(gdb) bt
#0 0x0000555555de1828 in std::equal_
at /usr/include/
#1 0x00005555563b0eab in std::__
#2 0x00005555563b0b0a in std::__
this=
#3 0x00005555563b0687 in std::_Hashtable
at /usr/include/...
GunChleoc (gunchleoc) wrote : | # |
Thanks for the review :)
The crash looks unfamiliar, I'll have to look into this.
> Is there a reason that Bob::calc_drawpos() (and derived methods) are still returning floats?
Yes, these are there for the zoom function, map elements can now end up not being positioned pixel perfect.
> UI::correct_
Not really. center_vertically() is omitting the align parameter, because align is always centered here.
> correct_
I'll go over these again when we do the final RTL GUI switching code.
SirVer (sirver) wrote : | # |
Good change!
One suggestion to improve the code: how about we disallow Vector2i() (by making the default constructor deleted) and instead have a static function Vector2i::Zero() that returns Vector2i(0, 0). It would make the call sites slightly easier to read.
otherwise code lgtm. I did not test.
GunChleoc (gunchleoc) wrote : | # |
Since everything points to the crash already being in trunk, let's get this in.
@bunnybot merge
Preview Diff
1 | === modified file 'src/base/vector.h' | |||
2 | --- src/base/vector.h 2017-01-25 18:55:59 +0000 | |||
3 | +++ src/base/vector.h 2017-05-13 13:15:21 +0000 | |||
4 | @@ -28,7 +28,10 @@ | |||
5 | 28 | template <typename T> struct Vector2 { | 28 | template <typename T> struct Vector2 { |
6 | 29 | Vector2(const T& px, const T& py) : x(px), y(py) { | 29 | Vector2(const T& px, const T& py) : x(px), y(py) { |
7 | 30 | } | 30 | } |
9 | 31 | Vector2() : Vector2(T(0), T(0)) { | 31 | Vector2() = delete; |
10 | 32 | |||
11 | 33 | static Vector2 zero() { | ||
12 | 34 | return Vector2(T(0), T(0)); | ||
13 | 32 | } | 35 | } |
14 | 33 | 36 | ||
15 | 34 | // Returns an invalid point. | 37 | // Returns an invalid point. |
16 | 35 | 38 | ||
17 | === modified file 'src/editor/editorinteractive.cc' | |||
18 | --- src/editor/editorinteractive.cc 2017-01-25 18:55:59 +0000 | |||
19 | +++ src/editor/editorinteractive.cc 2017-05-13 13:15:21 +0000 | |||
20 | @@ -636,7 +636,7 @@ | |||
21 | 636 | } | 636 | } |
22 | 637 | 637 | ||
23 | 638 | // Make sure that we will start at coordinates (0,0). | 638 | // Make sure that we will start at coordinates (0,0). |
25 | 639 | set_view(MapView::View{Vector2f(0, 0), 1.f}, Transition::Jump); | 639 | set_view(MapView::View{Vector2f::zero(), 1.f}, Transition::Jump); |
26 | 640 | set_sel_pos(Widelands::NodeAndTriangle<>( | 640 | set_sel_pos(Widelands::NodeAndTriangle<>( |
27 | 641 | Widelands::Coords(0, 0), | 641 | Widelands::Coords(0, 0), |
28 | 642 | Widelands::TCoords<>(Widelands::Coords(0, 0), Widelands::TCoords<>::D))); | 642 | Widelands::TCoords<>(Widelands::Coords(0, 0), Widelands::TCoords<>::D))); |
29 | 643 | 643 | ||
30 | === modified file 'src/editor/ui_menus/main_menu_load_or_save_map.cc' | |||
31 | --- src/editor/ui_menus/main_menu_load_or_save_map.cc 2017-03-01 11:23:54 +0000 | |||
32 | +++ src/editor/ui_menus/main_menu_load_or_save_map.cc 2017-05-13 13:15:21 +0000 | |||
33 | @@ -89,7 +89,7 @@ | |||
34 | 89 | 89 | ||
35 | 90 | /** TRANSLATORS: Checkbox title. If this checkbox is enabled, map names aren't translated. */ | 90 | /** TRANSLATORS: Checkbox title. If this checkbox is enabled, map names aren't translated. */ |
36 | 91 | cb_dont_localize_mapnames_ = | 91 | cb_dont_localize_mapnames_ = |
38 | 92 | new UI::Checkbox(vbox, Vector2i(0, 0), _("Show original map names")); | 92 | new UI::Checkbox(vbox, Vector2i::zero(), _("Show original map names")); |
39 | 93 | cb_dont_localize_mapnames_->set_state(false); | 93 | cb_dont_localize_mapnames_->set_state(false); |
40 | 94 | vbox->add_space(2 * padding_); | 94 | vbox->add_space(2 * padding_); |
41 | 95 | vbox->add(cb_dont_localize_mapnames_, UI::Box::Resizing::kFullSize); | 95 | vbox->add(cb_dont_localize_mapnames_, UI::Box::Resizing::kFullSize); |
42 | 96 | 96 | ||
43 | === modified file 'src/editor/ui_menus/main_menu_map_options.cc' | |||
44 | --- src/editor/ui_menus/main_menu_map_options.cc 2017-02-26 11:00:07 +0000 | |||
45 | +++ src/editor/ui_menus/main_menu_map_options.cc 2017-05-13 13:15:21 +0000 | |||
46 | @@ -230,7 +230,7 @@ | |||
47 | 230 | std::string tag, | 230 | std::string tag, |
48 | 231 | std::string displ_name) { | 231 | std::string displ_name) { |
49 | 232 | UI::Box* box = new UI::Box(parent, 0, 0, UI::Box::Horizontal, max_w_, checkbox_space_, 0); | 232 | UI::Box* box = new UI::Box(parent, 0, 0, UI::Box::Horizontal, max_w_, checkbox_space_, 0); |
51 | 233 | UI::Checkbox* cb = new UI::Checkbox(box, Vector2i(0, 0), displ_name); | 233 | UI::Checkbox* cb = new UI::Checkbox(box, Vector2i::zero(), displ_name); |
52 | 234 | box->add(cb, UI::Box::Resizing::kFullSize); | 234 | box->add(cb, UI::Box::Resizing::kFullSize); |
53 | 235 | box->add_space(checkbox_space_); | 235 | box->add_space(checkbox_space_); |
54 | 236 | parent->add(box); | 236 | parent->add(box); |
55 | 237 | 237 | ||
56 | === modified file 'src/editor/ui_menus/main_menu_random_map.cc' | |||
57 | --- src/editor/ui_menus/main_menu_random_map.cc 2017-02-26 11:00:07 +0000 | |||
58 | +++ src/editor/ui_menus/main_menu_random_map.cc 2017-05-13 13:15:21 +0000 | |||
59 | @@ -188,7 +188,7 @@ | |||
60 | 188 | resources_label_.get_h(), | 188 | resources_label_.get_h(), |
61 | 189 | (boost::format(_("%i %%")) % mountainsval_).str(), | 189 | (boost::format(_("%i %%")) % mountainsval_).str(), |
62 | 190 | UI::Align::kCenter), | 190 | UI::Align::kCenter), |
64 | 191 | island_mode_(&box_, Vector2i(0, 0), _("Island mode")), | 191 | island_mode_(&box_, Vector2i::zero(), _("Island mode")), |
65 | 192 | // Geeky stuff | 192 | // Geeky stuff |
66 | 193 | map_number_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_), | 193 | map_number_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_), |
67 | 194 | map_number_label_(&map_number_box_, 0, 0, _("Random Number:")), | 194 | map_number_label_(&map_number_box_, 0, 0, _("Random Number:")), |
68 | 195 | 195 | ||
69 | === modified file 'src/editor/ui_menus/tool_change_resources_options_menu.cc' | |||
70 | --- src/editor/ui_menus/tool_change_resources_options_menu.cc 2017-02-25 13:27:40 +0000 | |||
71 | +++ src/editor/ui_menus/tool_change_resources_options_menu.cc 2017-05-13 13:15:21 +0000 | |||
72 | @@ -100,7 +100,7 @@ | |||
73 | 100 | 100 | ||
74 | 101 | for (Widelands::DescriptionIndex i = 0; i < nr_resources; ++i) { | 101 | for (Widelands::DescriptionIndex i = 0; i < nr_resources; ++i) { |
75 | 102 | const Widelands::ResourceDescription& resource = *world.get_resource(i); | 102 | const Widelands::ResourceDescription& resource = *world.get_resource(i); |
77 | 103 | radiogroup_.add_button(&resources_box_, Vector2i(0, 0), | 103 | radiogroup_.add_button(&resources_box_, Vector2i::zero(), |
78 | 104 | g_gr->images().get(resource.representative_image()), | 104 | g_gr->images().get(resource.representative_image()), |
79 | 105 | resource.descname()); | 105 | resource.descname()); |
80 | 106 | resources_box_.add(radiogroup_.get_first_button(), UI::Box::Resizing::kFillSpace); | 106 | resources_box_.add(radiogroup_.get_first_button(), UI::Box::Resizing::kFillSpace); |
81 | 107 | 107 | ||
82 | === modified file 'src/editor/ui_menus/tool_place_critter_options_menu.cc' | |||
83 | --- src/editor/ui_menus/tool_place_critter_options_menu.cc 2017-01-25 18:55:59 +0000 | |||
84 | +++ src/editor/ui_menus/tool_place_critter_options_menu.cc 2017-05-13 13:15:21 +0000 | |||
85 | @@ -38,7 +38,7 @@ | |||
86 | 38 | UI::Checkbox* create_critter_checkbox(UI::Panel* parent, | 38 | UI::Checkbox* create_critter_checkbox(UI::Panel* parent, |
87 | 39 | const Widelands::CritterDescr& critter_descr) { | 39 | const Widelands::CritterDescr& critter_descr) { |
88 | 40 | const Image* pic = critter_descr.representative_image(); | 40 | const Image* pic = critter_descr.representative_image(); |
90 | 41 | UI::Checkbox* cb = new UI::Checkbox(parent, Vector2i(0, 0), pic, critter_descr.descname()); | 41 | UI::Checkbox* cb = new UI::Checkbox(parent, Vector2i::zero(), pic, critter_descr.descname()); |
91 | 42 | const int kMinClickableArea = 24; | 42 | const int kMinClickableArea = 24; |
92 | 43 | cb->set_desired_size(std::max<int>(pic->width(), kMinClickableArea), | 43 | cb->set_desired_size(std::max<int>(pic->width(), kMinClickableArea), |
93 | 44 | std::max<int>(pic->height(), kMinClickableArea)); | 44 | std::max<int>(pic->height(), kMinClickableArea)); |
94 | 45 | 45 | ||
95 | === modified file 'src/editor/ui_menus/tool_place_immovable_options_menu.cc' | |||
96 | --- src/editor/ui_menus/tool_place_immovable_options_menu.cc 2017-01-25 18:55:59 +0000 | |||
97 | +++ src/editor/ui_menus/tool_place_immovable_options_menu.cc 2017-05-13 13:15:21 +0000 | |||
98 | @@ -39,7 +39,7 @@ | |||
99 | 39 | 39 | ||
100 | 40 | UI::Checkbox* create_immovable_checkbox(UI::Panel* parent, const ImmovableDescr& immovable_descr) { | 40 | UI::Checkbox* create_immovable_checkbox(UI::Panel* parent, const ImmovableDescr& immovable_descr) { |
101 | 41 | const Image* pic = immovable_descr.representative_image(); | 41 | const Image* pic = immovable_descr.representative_image(); |
103 | 42 | UI::Checkbox* cb = new UI::Checkbox(parent, Vector2i(0, 0), pic, immovable_descr.descname()); | 42 | UI::Checkbox* cb = new UI::Checkbox(parent, Vector2i::zero(), pic, immovable_descr.descname()); |
104 | 43 | const int kMinClickableArea = 24; | 43 | const int kMinClickableArea = 24; |
105 | 44 | cb->set_desired_size(std::max<int>(pic->width(), kMinClickableArea), | 44 | cb->set_desired_size(std::max<int>(pic->width(), kMinClickableArea), |
106 | 45 | std::max<int>(pic->height(), kMinClickableArea)); | 45 | std::max<int>(pic->height(), kMinClickableArea)); |
107 | 46 | 46 | ||
108 | === modified file 'src/editor/ui_menus/tool_set_terrain_options_menu.cc' | |||
109 | --- src/editor/ui_menus/tool_set_terrain_options_menu.cc 2017-01-25 18:55:59 +0000 | |||
110 | +++ src/editor/ui_menus/tool_set_terrain_options_menu.cc 2017-05-13 13:15:21 +0000 | |||
111 | @@ -79,7 +79,7 @@ | |||
112 | 79 | .str(); | 79 | .str(); |
113 | 80 | 80 | ||
114 | 81 | std::unique_ptr<const Image>& image = offscreen_images->back(); | 81 | std::unique_ptr<const Image>& image = offscreen_images->back(); |
116 | 82 | UI::Checkbox* cb = new UI::Checkbox(parent, Vector2i(0, 0), image.get(), tooltip); | 82 | UI::Checkbox* cb = new UI::Checkbox(parent, Vector2i::zero(), image.get(), tooltip); |
117 | 83 | cb->set_desired_size(image->width() + 1, image->height() + 1); | 83 | cb->set_desired_size(image->width() + 1, image->height() + 1); |
118 | 84 | return cb; | 84 | return cb; |
119 | 85 | } | 85 | } |
120 | 86 | 86 | ||
121 | === modified file 'src/game_io/game_interactive_player_packet.cc' | |||
122 | --- src/game_io/game_interactive_player_packet.cc 2017-01-25 18:55:59 +0000 | |||
123 | +++ src/game_io/game_interactive_player_packet.cc 2017-05-13 13:15:21 +0000 | |||
124 | @@ -70,7 +70,7 @@ | |||
125 | 70 | if (player_number > max) | 70 | if (player_number > max) |
126 | 71 | throw GameDataError("The game has no players!"); | 71 | throw GameDataError("The game has no players!"); |
127 | 72 | } | 72 | } |
129 | 73 | Vector2f center_map_pixel; | 73 | Vector2f center_map_pixel = Vector2f::zero(); |
130 | 74 | if (packet_version <= 3) { | 74 | if (packet_version <= 3) { |
131 | 75 | center_map_pixel.x = fr.unsigned_16(); | 75 | center_map_pixel.x = fr.unsigned_16(); |
132 | 76 | center_map_pixel.y = fr.unsigned_16(); | 76 | center_map_pixel.y = fr.unsigned_16(); |
133 | 77 | 77 | ||
134 | === modified file 'src/graphic/animation.cc' | |||
135 | --- src/graphic/animation.cc 2017-05-03 07:24:06 +0000 | |||
136 | +++ src/graphic/animation.cc 2017-05-13 13:15:21 +0000 | |||
137 | @@ -91,7 +91,7 @@ | |||
138 | 91 | uint32_t current_frame(uint32_t time) const; | 91 | uint32_t current_frame(uint32_t time) const; |
139 | 92 | 92 | ||
140 | 93 | uint32_t frametime_; | 93 | uint32_t frametime_; |
142 | 94 | Vector2i hotspot_; | 94 | Vector2i hotspot_ = Vector2i::zero(); |
143 | 95 | bool hasplrclrs_; | 95 | bool hasplrclrs_; |
144 | 96 | std::vector<std::string> image_files_; | 96 | std::vector<std::string> image_files_; |
145 | 97 | std::vector<std::string> pc_mask_image_files_; | 97 | std::vector<std::string> pc_mask_image_files_; |
146 | 98 | 98 | ||
147 | === modified file 'src/graphic/font_handler.cc' | |||
148 | --- src/graphic/font_handler.cc 2017-02-28 20:07:07 +0000 | |||
149 | +++ src/graphic/font_handler.cc 2017-05-13 13:15:21 +0000 | |||
150 | @@ -54,9 +54,9 @@ | |||
151 | 54 | int caret_x = style.calc_bare_width(text.substr(0, caret_offset)); | 54 | int caret_x = style.calc_bare_width(text.substr(0, caret_offset)); |
152 | 55 | 55 | ||
153 | 56 | const Image* caret_image = g_gr->images().get("images/ui_basic/caret.png"); | 56 | const Image* caret_image = g_gr->images().get("images/ui_basic/caret.png"); |
155 | 57 | Vector2f caretpt; | 57 | Vector2i caretpt = Vector2i::zero(); |
156 | 58 | caretpt.x = dstpoint.x + caret_x + LINE_MARGIN - caret_image->width(); | 58 | caretpt.x = dstpoint.x + caret_x + LINE_MARGIN - caret_image->width(); |
158 | 59 | caretpt.y = dstpoint.y + (style.font->height() - caret_image->height()) / 2.f; | 59 | caretpt.y = dstpoint.y + (style.font->height() - caret_image->height()) / 2; |
159 | 60 | dst.blit(caretpt, caret_image); | 60 | dst.blit(caretpt, caret_image); |
160 | 61 | } | 61 | } |
161 | 62 | 62 | ||
162 | @@ -203,7 +203,7 @@ | |||
163 | 203 | */ | 203 | */ |
164 | 204 | void FontHandler::draw_text(RenderTarget& dst, | 204 | void FontHandler::draw_text(RenderTarget& dst, |
165 | 205 | const TextStyle& style, | 205 | const TextStyle& style, |
167 | 206 | Vector2i dstpoint_i, | 206 | Vector2i dstpoint, |
168 | 207 | const std::string& text, | 207 | const std::string& text, |
169 | 208 | Align align, | 208 | Align align, |
170 | 209 | uint32_t caret) { | 209 | uint32_t caret) { |
171 | @@ -213,14 +213,13 @@ | |||
172 | 213 | copytext = i18n::make_ligatures(copytext.c_str()); | 213 | copytext = i18n::make_ligatures(copytext.c_str()); |
173 | 214 | const LineCacheEntry& lce = d->get_line(style, copytext); | 214 | const LineCacheEntry& lce = d->get_line(style, copytext); |
174 | 215 | 215 | ||
175 | 216 | Vector2f dstpoint = dstpoint_i.cast<float>(); | ||
176 | 217 | UI::correct_for_align(align, lce.width + 2 * LINE_MARGIN, &dstpoint); | 216 | UI::correct_for_align(align, lce.width + 2 * LINE_MARGIN, &dstpoint); |
177 | 218 | 217 | ||
178 | 219 | if (lce.image) | 218 | if (lce.image) |
180 | 220 | dst.blit(Vector2f(dstpoint.x + LINE_MARGIN, dstpoint.y), lce.image.get()); | 219 | dst.blit(Vector2i(dstpoint.x + LINE_MARGIN, dstpoint.y), lce.image.get()); |
181 | 221 | 220 | ||
182 | 222 | if (caret <= copytext.size()) | 221 | if (caret <= copytext.size()) |
184 | 223 | draw_caret(dst, style, dstpoint, copytext, caret); | 222 | draw_caret(dst, style, dstpoint.cast<float>(), copytext, caret); |
185 | 224 | } | 223 | } |
186 | 225 | 224 | ||
187 | 226 | /** | 225 | /** |
188 | @@ -233,7 +232,7 @@ | |||
189 | 233 | const LineCacheEntry& lce = d->get_line(style, text); | 232 | const LineCacheEntry& lce = d->get_line(style, text); |
190 | 234 | 233 | ||
191 | 235 | if (lce.image) { | 234 | if (lce.image) { |
193 | 236 | dst.blit(dstpoint.cast<float>(), lce.image.get()); | 235 | dst.blit(dstpoint, lce.image.get()); |
194 | 237 | } | 236 | } |
195 | 238 | 237 | ||
196 | 239 | return lce.width; | 238 | return lce.width; |
197 | 240 | 239 | ||
198 | === modified file 'src/graphic/gl/fields_to_draw.h' | |||
199 | --- src/graphic/gl/fields_to_draw.h 2017-01-25 18:55:59 +0000 | |||
200 | +++ src/graphic/gl/fields_to_draw.h 2017-05-13 13:15:21 +0000 | |||
201 | @@ -43,15 +43,15 @@ | |||
202 | 43 | Widelands::Coords geometric_coords; // geometric coordinates (i.e. map coordinates that can | 43 | Widelands::Coords geometric_coords; // geometric coordinates (i.e. map coordinates that can |
203 | 44 | // be out of bounds). | 44 | // be out of bounds). |
204 | 45 | Widelands::FCoords fcoords; // The normalized coords and the field this is refering to. | 45 | Widelands::FCoords fcoords; // The normalized coords and the field this is refering to. |
206 | 46 | Vector2f gl_position; // GL Position of this field. | 46 | Vector2f gl_position = Vector2f::zero(); // GL Position of this field. |
207 | 47 | 47 | ||
208 | 48 | // Surface pixel this will be plotted on. | 48 | // Surface pixel this will be plotted on. |
210 | 49 | Vector2f surface_pixel; | 49 | Vector2f surface_pixel = Vector2f::zero(); |
211 | 50 | 50 | ||
212 | 51 | // Rendertarget pixel this will be plotted on. This is only different by | 51 | // Rendertarget pixel this will be plotted on. This is only different by |
213 | 52 | // the Rendertarget::get_rect().origin() of the view window. | 52 | // the Rendertarget::get_rect().origin() of the view window. |
216 | 53 | Vector2f rendertarget_pixel; | 53 | Vector2f rendertarget_pixel = Vector2f::zero(); |
217 | 54 | Vector2f texture_coords; // Texture coordinates. | 54 | Vector2f texture_coords = Vector2f::zero(); // Texture coordinates. |
218 | 55 | float brightness; // brightness of the pixel | 55 | float brightness; // brightness of the pixel |
219 | 56 | 56 | ||
220 | 57 | // The next values are not necessarily the true data of this field, but | 57 | // The next values are not necessarily the true data of this field, but |
221 | 58 | 58 | ||
222 | === modified file 'src/graphic/minimap_renderer.cc' | |||
223 | --- src/graphic/minimap_renderer.cc 2017-01-25 18:55:59 +0000 | |||
224 | +++ src/graphic/minimap_renderer.cc 2017-05-13 13:15:21 +0000 | |||
225 | @@ -97,7 +97,7 @@ | |||
226 | 97 | const int half_height = | 97 | const int half_height = |
227 | 98 | round_up_to_nearest_even(std::ceil(view_area.h / kTriangleHeight / divider)); | 98 | round_up_to_nearest_even(std::ceil(view_area.h / kTriangleHeight / divider)); |
228 | 99 | 99 | ||
230 | 100 | Vector2i center_pixel; | 100 | Vector2i center_pixel = Vector2i::zero(); |
231 | 101 | switch (minimap_type) { | 101 | switch (minimap_type) { |
232 | 102 | case MiniMapType::kStaticViewWindow: | 102 | case MiniMapType::kStaticViewWindow: |
233 | 103 | center_pixel = Vector2i(texture->width() / 2, texture->height() / 2); | 103 | center_pixel = Vector2i(texture->width() / 2, texture->height() / 2); |
234 | @@ -203,7 +203,7 @@ | |||
235 | 203 | const Rectf& view_area, | 203 | const Rectf& view_area, |
236 | 204 | MiniMapType minimap_type, | 204 | MiniMapType minimap_type, |
237 | 205 | const bool zoom) { | 205 | const bool zoom) { |
239 | 206 | Vector2f top_left; | 206 | Vector2f top_left = Vector2f::zero(); |
240 | 207 | switch (minimap_type) { | 207 | switch (minimap_type) { |
241 | 208 | case MiniMapType::kStaticViewWindow: | 208 | case MiniMapType::kStaticViewWindow: |
242 | 209 | top_left = | 209 | top_left = |
243 | @@ -212,7 +212,7 @@ | |||
244 | 212 | break; | 212 | break; |
245 | 213 | 213 | ||
246 | 214 | case MiniMapType::kStaticMap: | 214 | case MiniMapType::kStaticMap: |
248 | 215 | top_left = Vector2f(0., 0.); | 215 | top_left = Vector2f::zero(); |
249 | 216 | break; | 216 | break; |
250 | 217 | } | 217 | } |
251 | 218 | 218 | ||
252 | @@ -242,7 +242,7 @@ | |||
253 | 242 | // Center the view on the middle of the 'view_area'. | 242 | // Center the view on the middle of the 'view_area'. |
254 | 243 | const bool zoom = layers & MiniMapLayer::Zoom2; | 243 | const bool zoom = layers & MiniMapLayer::Zoom2; |
255 | 244 | Vector2f top_left = | 244 | Vector2f top_left = |
257 | 245 | minimap_pixel_to_mappixel(map, Vector2i(0, 0), view_area, minimap_type, zoom); | 245 | minimap_pixel_to_mappixel(map, Vector2i::zero(), view_area, minimap_type, zoom); |
258 | 246 | const Coords node = | 246 | const Coords node = |
259 | 247 | MapviewPixelFunctions::calc_node_and_triangle(map, top_left.x, top_left.y).node; | 247 | MapviewPixelFunctions::calc_node_and_triangle(map, top_left.x, top_left.y).node; |
260 | 248 | 248 | ||
261 | 249 | 249 | ||
262 | === modified file 'src/graphic/rendertarget.cc' | |||
263 | --- src/graphic/rendertarget.cc 2017-02-28 20:07:07 +0000 | |||
264 | +++ src/graphic/rendertarget.cc 2017-05-13 13:15:21 +0000 | |||
265 | @@ -23,7 +23,6 @@ | |||
266 | 23 | #include "graphic/animation.h" | 23 | #include "graphic/animation.h" |
267 | 24 | #include "graphic/graphic.h" | 24 | #include "graphic/graphic.h" |
268 | 25 | #include "graphic/surface.h" | 25 | #include "graphic/surface.h" |
269 | 26 | #include "graphic/text_layout.h" | ||
270 | 27 | 26 | ||
271 | 28 | /** | 27 | /** |
272 | 29 | * Build a render target for the given surface. | 28 | * Build a render target for the given surface. |
273 | @@ -119,21 +118,21 @@ | |||
274 | 119 | /** | 118 | /** |
275 | 120 | * Clip against window and pass those primitives along to the bitmap. | 119 | * Clip against window and pass those primitives along to the bitmap. |
276 | 121 | */ | 120 | */ |
279 | 122 | void RenderTarget::draw_rect(const Rectf& rect, const RGBColor& clr) { | 121 | void RenderTarget::draw_rect(const Recti& rect, const RGBColor& clr) { |
280 | 123 | Rectf r(rect); | 122 | Rectf r(rect.cast<float>()); |
281 | 124 | if (clip(r)) { | 123 | if (clip(r)) { |
282 | 125 | ::draw_rect(r, clr, surface_); | 124 | ::draw_rect(r, clr, surface_); |
283 | 126 | } | 125 | } |
284 | 127 | } | 126 | } |
285 | 128 | 127 | ||
288 | 129 | void RenderTarget::fill_rect(const Rectf& rect, const RGBAColor& clr, BlendMode blend_mode) { | 128 | void RenderTarget::fill_rect(const Recti& rect, const RGBAColor& clr, BlendMode blend_mode) { |
289 | 130 | Rectf r(rect); | 129 | Rectf r(rect.cast<float>()); |
290 | 131 | if (clip(r)) | 130 | if (clip(r)) |
291 | 132 | surface_->fill_rect(r, clr, blend_mode); | 131 | surface_->fill_rect(r, clr, blend_mode); |
292 | 133 | } | 132 | } |
293 | 134 | 133 | ||
296 | 135 | void RenderTarget::brighten_rect(const Rectf& rect, int32_t factor) { | 134 | void RenderTarget::brighten_rect(const Recti& rect, int32_t factor) { |
297 | 136 | Rectf r(rect); | 135 | Rectf r(rect.cast<float>()); |
298 | 137 | if (clip(r)) | 136 | if (clip(r)) |
299 | 138 | surface_->brighten_rect(r, factor); | 137 | surface_->brighten_rect(r, factor); |
300 | 139 | } | 138 | } |
301 | @@ -143,15 +142,11 @@ | |||
302 | 143 | * | 142 | * |
303 | 144 | * This blit function copies the pixels to the destination surface. | 143 | * This blit function copies the pixels to the destination surface. |
304 | 145 | */ | 144 | */ |
306 | 146 | void RenderTarget::blit(const Vector2f& dst, | 145 | void RenderTarget::blit(const Vector2i& dst, |
307 | 147 | const Image* image, | 146 | const Image* image, |
315 | 148 | BlendMode blend_mode, | 147 | BlendMode blend_mode) { |
316 | 149 | UI::Align align) { | 148 | Rectf source_rect(Vector2i::zero(), image->width(), image->height()); |
317 | 150 | Vector2f destination_point(dst); | 149 | Rectf destination_rect(dst.x, dst.y, source_rect.w, source_rect.h); |
311 | 151 | UI::correct_for_align(align, image->width(), &destination_point); | ||
312 | 152 | |||
313 | 153 | Rectf source_rect(Vector2i(0, 0), image->width(), image->height()); | ||
314 | 154 | Rectf destination_rect(destination_point.x, destination_point.y, source_rect.w, source_rect.h); | ||
318 | 155 | 150 | ||
319 | 156 | if (to_surface_geometry(&destination_rect, &source_rect)) { | 151 | if (to_surface_geometry(&destination_rect, &source_rect)) { |
320 | 157 | // I seem to remember seeing 1. a lot in blitting calls. | 152 | // I seem to remember seeing 1. a lot in blitting calls. |
321 | @@ -160,15 +155,11 @@ | |||
322 | 160 | } | 155 | } |
323 | 161 | } | 156 | } |
324 | 162 | 157 | ||
326 | 163 | void RenderTarget::blit_monochrome(const Vector2f& dst, | 158 | void RenderTarget::blit_monochrome(const Vector2i& dst, |
327 | 164 | const Image* image, | 159 | const Image* image, |
335 | 165 | const RGBAColor& blend_mode, | 160 | const RGBAColor& blend_mode) { |
336 | 166 | UI::Align align) { | 161 | Rectf source_rect(Vector2i::zero(), image->width(), image->height()); |
337 | 167 | Vector2f destination_point(dst); | 162 | Rectf destination_rect(dst.x, dst.y, source_rect.w, source_rect.h); |
331 | 168 | UI::correct_for_align(align, image->width(), &destination_point); | ||
332 | 169 | |||
333 | 170 | Rectf source_rect(Vector2i(0, 0), image->width(), image->height()); | ||
334 | 171 | Rectf destination_rect(destination_point.x, destination_point.y, source_rect.w, source_rect.h); | ||
338 | 172 | 163 | ||
339 | 173 | if (to_surface_geometry(&destination_rect, &source_rect)) { | 164 | if (to_surface_geometry(&destination_rect, &source_rect)) { |
340 | 174 | surface_->blit_monochrome(destination_rect, *image, source_rect, blend_mode); | 165 | surface_->blit_monochrome(destination_rect, *image, source_rect, blend_mode); |
341 | @@ -178,7 +169,7 @@ | |||
342 | 178 | /** | 169 | /** |
343 | 179 | * Like \ref blit, but use only a sub-rectangle of the source image. | 170 | * Like \ref blit, but use only a sub-rectangle of the source image. |
344 | 180 | */ | 171 | */ |
346 | 181 | void RenderTarget::blitrect(const Vector2f& dst, | 172 | void RenderTarget::blitrect(const Vector2i& dst, |
347 | 182 | const Image* image, | 173 | const Image* image, |
348 | 183 | const Recti& gsrcrc, | 174 | const Recti& gsrcrc, |
349 | 184 | BlendMode blend_mode) { | 175 | BlendMode blend_mode) { |
350 | 185 | 176 | ||
351 | === modified file 'src/graphic/rendertarget.h' | |||
352 | --- src/graphic/rendertarget.h 2017-02-23 19:38:51 +0000 | |||
353 | +++ src/graphic/rendertarget.h 2017-05-13 13:15:21 +0000 | |||
354 | @@ -58,22 +58,20 @@ | |||
355 | 58 | int32_t height() const; | 58 | int32_t height() const; |
356 | 59 | 59 | ||
357 | 60 | void draw_line_strip(const std::vector<Vector2f>& points, const RGBColor& color, float width); | 60 | void draw_line_strip(const std::vector<Vector2f>& points, const RGBColor& color, float width); |
361 | 61 | void draw_rect(const Rectf&, const RGBColor&); | 61 | void draw_rect(const Recti&, const RGBColor&); |
362 | 62 | void fill_rect(const Rectf&, const RGBAColor&, BlendMode blend_mode = BlendMode::Copy); | 62 | void fill_rect(const Recti&, const RGBAColor&, BlendMode blend_mode = BlendMode::Copy); |
363 | 63 | void brighten_rect(const Rectf&, int32_t factor); | 63 | void brighten_rect(const Recti&, int32_t factor); |
364 | 64 | 64 | ||
366 | 65 | void blit(const Vector2f& dst, | 65 | void blit(const Vector2i& dst, |
367 | 66 | const Image* image, | 66 | const Image* image, |
370 | 67 | BlendMode blend_mode = BlendMode::UseAlpha, | 67 | BlendMode blend_mode = BlendMode::UseAlpha); |
369 | 68 | UI::Align = UI::Align::kLeft); | ||
371 | 69 | 68 | ||
372 | 70 | // Like blit. See MonochromeBlitProgram for details. | 69 | // Like blit. See MonochromeBlitProgram for details. |
374 | 71 | void blit_monochrome(const Vector2f& dst, | 70 | void blit_monochrome(const Vector2i& dst, |
375 | 72 | const Image* image, | 71 | const Image* image, |
378 | 73 | const RGBAColor& blend_mode, | 72 | const RGBAColor& blend_mode); |
377 | 74 | UI::Align = UI::Align::kLeft); | ||
379 | 75 | 73 | ||
381 | 76 | void blitrect(const Vector2f& dst, | 74 | void blitrect(const Vector2i& dst, |
382 | 77 | const Image* image, | 75 | const Image* image, |
383 | 78 | const Recti& src, | 76 | const Recti& src, |
384 | 79 | BlendMode blend_mode = BlendMode::UseAlpha); | 77 | BlendMode blend_mode = BlendMode::UseAlpha); |
385 | @@ -147,7 +145,7 @@ | |||
386 | 147 | /// The current clip rectangle | 145 | /// The current clip rectangle |
387 | 148 | Recti rect_; | 146 | Recti rect_; |
388 | 149 | /// Drawing offset | 147 | /// Drawing offset |
390 | 150 | Vector2i offset_; | 148 | Vector2i offset_ = Vector2i::zero(); |
391 | 151 | }; | 149 | }; |
392 | 152 | 150 | ||
393 | 153 | #endif // end of include guard: WL_GRAPHIC_RENDERTARGET_H | 151 | #endif // end of include guard: WL_GRAPHIC_RENDERTARGET_H |
394 | 154 | 152 | ||
395 | === modified file 'src/graphic/richtext.cc' | |||
396 | --- src/graphic/richtext.cc 2017-02-23 19:38:51 +0000 | |||
397 | +++ src/graphic/richtext.cc 2017-05-13 13:15:21 +0000 | |||
398 | @@ -61,7 +61,7 @@ | |||
399 | 61 | } | 61 | } |
400 | 62 | 62 | ||
401 | 63 | void draw(RenderTarget& dst) override { | 63 | void draw(RenderTarget& dst) override { |
403 | 64 | dst.blit(Vector2f(0, 0), image); | 64 | dst.blit(Vector2i::zero(), image); |
404 | 65 | } | 65 | } |
405 | 66 | 66 | ||
406 | 67 | const Image* image; | 67 | const Image* image; |
407 | @@ -107,7 +107,7 @@ | |||
408 | 107 | } | 107 | } |
409 | 108 | } | 108 | } |
410 | 109 | // Now render | 109 | // Now render |
412 | 110 | uint32_t x = g_fh->draw_text_raw(dst, style, Vector2i(0, 0), result_words[0]); | 110 | uint32_t x = g_fh->draw_text_raw(dst, style, Vector2i::zero(), result_words[0]); |
413 | 111 | 111 | ||
414 | 112 | it = result_words.begin() + 1; | 112 | it = result_words.begin() + 1; |
415 | 113 | if (it != result_words.end()) { | 113 | if (it != result_words.end()) { |
416 | @@ -493,12 +493,12 @@ | |||
417 | 493 | for (std::vector<Element*>::const_iterator elt = m->elements.begin(); elt != m->elements.end(); | 493 | for (std::vector<Element*>::const_iterator elt = m->elements.begin(); elt != m->elements.end(); |
418 | 494 | ++elt) { | 494 | ++elt) { |
419 | 495 | Recti oldbox; | 495 | Recti oldbox; |
421 | 496 | Vector2i oldofs; | 496 | Vector2i oldofs = Vector2i::zero(); |
422 | 497 | Recti bbox((*elt)->bbox.origin() + offset, (*elt)->bbox.w, (*elt)->bbox.h); | 497 | Recti bbox((*elt)->bbox.origin() + offset, (*elt)->bbox.w, (*elt)->bbox.h); |
423 | 498 | 498 | ||
424 | 499 | if (dst.enter_window(bbox, &oldbox, &oldofs)) { | 499 | if (dst.enter_window(bbox, &oldbox, &oldofs)) { |
425 | 500 | if (background) | 500 | if (background) |
427 | 501 | dst.fill_rect(Rectf(0.f, 0.f, bbox.w, bbox.h), m->background_color); | 501 | dst.fill_rect(Recti(0, 0, bbox.w, bbox.h), m->background_color); |
428 | 502 | (*elt)->draw(dst); | 502 | (*elt)->draw(dst); |
429 | 503 | dst.set_window(oldbox, oldofs); | 503 | dst.set_window(oldbox, oldofs); |
430 | 504 | } | 504 | } |
431 | 505 | 505 | ||
432 | === modified file 'src/graphic/text_layout.cc' | |||
433 | --- src/graphic/text_layout.cc 2017-05-03 07:24:06 +0000 | |||
434 | +++ src/graphic/text_layout.cc 2017-05-13 13:15:21 +0000 | |||
435 | @@ -204,7 +204,7 @@ | |||
436 | 204 | * subsampled rendering - this can lead to blurry texts. That is why we | 204 | * subsampled rendering - this can lead to blurry texts. That is why we |
437 | 205 | * never do float divisions in this function. | 205 | * never do float divisions in this function. |
438 | 206 | */ | 206 | */ |
440 | 207 | void correct_for_align(Align align, uint32_t w, Vector2f* pt) { | 207 | void correct_for_align(Align align, uint32_t w, Vector2i* pt) { |
441 | 208 | 208 | ||
442 | 209 | if (align == Align::kCenter) | 209 | if (align == Align::kCenter) |
443 | 210 | pt->x -= w / 2; | 210 | pt->x -= w / 2; |
444 | @@ -215,7 +215,7 @@ | |||
445 | 215 | /** | 215 | /** |
446 | 216 | * Adjust the y coordinate in 'point 'pt' to vertically center an element with height 'h'. | 216 | * Adjust the y coordinate in 'point 'pt' to vertically center an element with height 'h'. |
447 | 217 | */ | 217 | */ |
449 | 218 | void center_vertically(uint32_t h, Vector2f* pt) { | 218 | void center_vertically(uint32_t h, Vector2i* pt) { |
450 | 219 | pt->y -= h / 2; | 219 | pt->y -= h / 2; |
451 | 220 | } | 220 | } |
452 | 221 | } // namespace UI | 221 | } // namespace UI |
453 | 222 | 222 | ||
454 | === modified file 'src/graphic/text_layout.h' | |||
455 | --- src/graphic/text_layout.h 2017-03-29 12:36:20 +0000 | |||
456 | +++ src/graphic/text_layout.h 2017-05-13 13:15:21 +0000 | |||
457 | @@ -104,8 +104,8 @@ | |||
458 | 104 | 104 | ||
459 | 105 | Align mirror_alignment(Align alignment); | 105 | Align mirror_alignment(Align alignment); |
460 | 106 | 106 | ||
463 | 107 | void center_vertically(uint32_t h, Vector2f* pt); | 107 | void center_vertically(uint32_t h, Vector2i* pt); |
464 | 108 | void correct_for_align(Align, uint32_t w, Vector2f* pt); | 108 | void correct_for_align(Align, uint32_t w, Vector2i* pt); |
465 | 109 | 109 | ||
466 | 110 | } // namespace UI | 110 | } // namespace UI |
467 | 111 | 111 | ||
468 | 112 | 112 | ||
469 | === modified file 'src/graphic/wordwrap.cc' | |||
470 | --- src/graphic/wordwrap.cc 2017-04-30 07:44:27 +0000 | |||
471 | +++ src/graphic/wordwrap.cc 2017-05-13 13:15:21 +0000 | |||
472 | @@ -310,7 +310,7 @@ | |||
473 | 310 | if (where.y >= dst.height() || int32_t(where.y + fontheight) <= 0) | 310 | if (where.y >= dst.height() || int32_t(where.y + fontheight) <= 0) |
474 | 311 | continue; | 311 | continue; |
475 | 312 | 312 | ||
477 | 313 | Vector2f point(where.x, where.y); | 313 | Vector2i point(where.x, where.y); |
478 | 314 | 314 | ||
479 | 315 | if (alignment == UI::Align::kRight) { | 315 | if (alignment == UI::Align::kRight) { |
480 | 316 | point.x += wrapwidth_ - kLineMargin; | 316 | point.x += wrapwidth_ - kLineMargin; |
481 | @@ -327,9 +327,9 @@ | |||
482 | 327 | int caret_x = text_width(line_to_caret, fontsize_); | 327 | int caret_x = text_width(line_to_caret, fontsize_); |
483 | 328 | 328 | ||
484 | 329 | const Image* caret_image = g_gr->images().get("images/ui_basic/caret.png"); | 329 | const Image* caret_image = g_gr->images().get("images/ui_basic/caret.png"); |
486 | 330 | Vector2f caretpt; | 330 | Vector2i caretpt = Vector2i::zero(); |
487 | 331 | caretpt.x = point.x + caret_x - caret_image->width() + kLineMargin; | 331 | caretpt.x = point.x + caret_x - caret_image->width() + kLineMargin; |
489 | 332 | caretpt.y = point.y + (fontheight - caret_image->height()) / 2.f; | 332 | caretpt.y = point.y + (fontheight - caret_image->height()) / 2; |
490 | 333 | dst.blit(caretpt, caret_image); | 333 | dst.blit(caretpt, caret_image); |
491 | 334 | } | 334 | } |
492 | 335 | } | 335 | } |
493 | 336 | 336 | ||
494 | === modified file 'src/logic/map_objects/map_object.cc' | |||
495 | --- src/logic/map_objects/map_object.cc 2017-04-30 08:27:40 +0000 | |||
496 | +++ src/logic/map_objects/map_object.cc 2017-05-13 13:15:21 +0000 | |||
497 | @@ -473,19 +473,19 @@ | |||
498 | 473 | const Image* rendered_census_info = | 473 | const Image* rendered_census_info = |
499 | 474 | UI::g_fh1->render(as_condensed(census, UI::Align::kCenter, font_size), 120); | 474 | UI::g_fh1->render(as_condensed(census, UI::Align::kCenter, font_size), 120); |
500 | 475 | 475 | ||
503 | 476 | // Rounding guarantees that text aligns with pixels to avoid subsampling. | 476 | const Vector2i base_pos = field_on_dst.cast<int>() - Vector2i(0, 48) * scale; |
504 | 477 | const Vector2f census_pos = round(field_on_dst - Vector2f(0, 48) * scale).cast<float>(); | 477 | Vector2i census_pos(base_pos); |
505 | 478 | UI::correct_for_align(UI::Align::kCenter, rendered_census_info->width(), &census_pos); | ||
506 | 478 | if (draw_text & TextToDraw::kCensus) { | 479 | if (draw_text & TextToDraw::kCensus) { |
508 | 479 | dst->blit(census_pos, rendered_census_info, BlendMode::UseAlpha, UI::Align::kCenter); | 480 | dst->blit(census_pos, rendered_census_info, BlendMode::UseAlpha); |
509 | 480 | } | 481 | } |
510 | 481 | 482 | ||
511 | 482 | if (draw_text & TextToDraw::kStatistics && !statictics.empty()) { | 483 | if (draw_text & TextToDraw::kStatistics && !statictics.empty()) { |
518 | 483 | const Vector2f statistics_pos = | 484 | Vector2i statistics_pos = |
519 | 484 | round(census_pos + Vector2f(0, rendered_census_info->height() / 2.f + 10 * scale)) | 485 | base_pos + Vector2i(0, rendered_census_info->height() / 2 + 10 * scale); |
520 | 485 | .cast<float>(); | 486 | const Image* rendered_statictics = UI::g_fh1->render(as_condensed(statictics, UI::Align::kCenter, font_size)); |
521 | 486 | dst->blit(statistics_pos, | 487 | UI::correct_for_align(UI::Align::kCenter, rendered_statictics->width(), &statistics_pos); |
522 | 487 | UI::g_fh1->render(as_condensed(statictics, UI::Align::kCenter, font_size)), | 488 | dst->blit(statistics_pos, rendered_statictics, BlendMode::UseAlpha); |
517 | 488 | BlendMode::UseAlpha, UI::Align::kCenter); | ||
523 | 489 | } | 489 | } |
524 | 490 | } | 490 | } |
525 | 491 | 491 | ||
526 | 492 | 492 | ||
527 | === modified file 'src/logic/map_objects/tribes/soldier.cc' | |||
528 | --- src/logic/map_objects/tribes/soldier.cc 2017-05-03 07:24:06 +0000 | |||
529 | +++ src/logic/map_objects/tribes/soldier.cc 2017-05-13 13:15:21 +0000 | |||
530 | @@ -451,8 +451,8 @@ | |||
531 | 451 | 451 | ||
532 | 452 | const Vector2f point_on_dst = calc_drawpos(game, field_on_dst, scale); | 452 | const Vector2f point_on_dst = calc_drawpos(game, field_on_dst, scale); |
533 | 453 | draw_info_icon( | 453 | draw_info_icon( |
536 | 454 | point_on_dst - | 454 | point_on_dst.cast<int>() - |
537 | 455 | Vector2f(0.f, (g_gr->animations().get_animation(get_current_anim()).height() - 7) * scale), | 455 | Vector2i(0, (g_gr->animations().get_animation(get_current_anim()).height() - 7) * scale), |
538 | 456 | scale, true, dst); | 456 | scale, true, dst); |
539 | 457 | draw_inner(game, point_on_dst, scale, dst); | 457 | draw_inner(game, point_on_dst, scale, dst); |
540 | 458 | } | 458 | } |
541 | @@ -460,7 +460,7 @@ | |||
542 | 460 | /** | 460 | /** |
543 | 461 | * Draw the info icon (level indicators + health bar) for this soldier. | 461 | * Draw the info icon (level indicators + health bar) for this soldier. |
544 | 462 | */ | 462 | */ |
546 | 463 | void Soldier::draw_info_icon(Vector2f draw_position, | 463 | void Soldier::draw_info_icon(Vector2i draw_position, |
547 | 464 | float scale, | 464 | float scale, |
548 | 465 | const bool anchor_below, | 465 | const bool anchor_below, |
549 | 466 | RenderTarget* dst) const { | 466 | RenderTarget* dst) const { |
550 | @@ -492,29 +492,26 @@ | |||
551 | 492 | assert(kSoldierHealthBarWidth > dimension); | 492 | assert(kSoldierHealthBarWidth > dimension); |
552 | 493 | #endif | 493 | #endif |
553 | 494 | 494 | ||
556 | 495 | const float icon_size = healthpic->width(); | 495 | const int icon_size = healthpic->width(); |
555 | 496 | const float half_width = kSoldierHealthBarWidth; | ||
557 | 497 | 496 | ||
558 | 498 | if (!anchor_below) { | 497 | if (!anchor_below) { |
563 | 499 | float totalwidth = 2 * half_width; | 498 | draw_position.x += kSoldierHealthBarWidth * scale; |
564 | 500 | float totalheight = 5.f + 2 * icon_size; | 499 | draw_position.y += 2 * icon_size * scale; |
561 | 501 | draw_position.x += (totalwidth / 2.f) * scale; | ||
562 | 502 | draw_position.y += (totalheight - 5.f) * scale; | ||
565 | 503 | } else { | 500 | } else { |
567 | 504 | draw_position.y -= 5.f * scale; | 501 | draw_position.y -= 5 * scale; |
568 | 505 | } | 502 | } |
569 | 506 | 503 | ||
570 | 507 | // Draw energy bar | 504 | // Draw energy bar |
571 | 508 | assert(get_max_health()); | 505 | assert(get_max_health()); |
574 | 509 | const Rectf energy_outer( | 506 | const Recti energy_outer( |
575 | 510 | draw_position - Vector2f(half_width, 0.f) * scale, half_width * 2.f * scale, 5.f * scale); | 507 | draw_position - Vector2i(kSoldierHealthBarWidth, 0) * scale, kSoldierHealthBarWidth * 2 * scale, 5 * scale); |
576 | 511 | dst->fill_rect(energy_outer, RGBColor(255, 255, 255)); | 508 | dst->fill_rect(energy_outer, RGBColor(255, 255, 255)); |
577 | 512 | 509 | ||
583 | 513 | float health_width = 2.f * (half_width - 1.f) * current_health_ / get_max_health(); | 510 | int health_width = 2 * (kSoldierHealthBarWidth - 1) * current_health_ / get_max_health(); |
584 | 514 | Rectf energy_inner( | 511 | Recti energy_inner( |
585 | 515 | draw_position + Vector2f(-half_width + 1.f, 1.f) * scale, health_width * scale, 3 * scale); | 512 | draw_position + Vector2i(-kSoldierHealthBarWidth + 1, 1) * scale, health_width * scale, 3 * scale); |
586 | 516 | Rectf energy_complement(energy_inner.origin() + Vector2f(health_width, 0.f) * scale, | 513 | Recti energy_complement(energy_inner.origin() + Vector2i(health_width, 0) * scale, |
587 | 517 | (2 * (half_width - 1) - health_width) * scale, 3 * scale); | 514 | (2 * (kSoldierHealthBarWidth - 1) - health_width) * scale, 3 * scale); |
588 | 518 | 515 | ||
589 | 519 | const RGBColor& color = owner().get_playercolor(); | 516 | const RGBColor& color = owner().get_playercolor(); |
590 | 520 | RGBColor complement_color; | 517 | RGBColor complement_color; |
591 | @@ -528,15 +525,15 @@ | |||
592 | 528 | dst->fill_rect(energy_complement, complement_color); | 525 | dst->fill_rect(energy_complement, complement_color); |
593 | 529 | 526 | ||
594 | 530 | const auto draw_level_image = [icon_size, scale, &draw_position, dst]( | 527 | const auto draw_level_image = [icon_size, scale, &draw_position, dst]( |
596 | 531 | const Vector2f& offset, const Image* image) { | 528 | const Vector2i& offset, const Image* image) { |
597 | 532 | dst->blitrect_scale( | 529 | dst->blitrect_scale( |
598 | 533 | Rectf(draw_position + offset * icon_size * scale, icon_size * scale, icon_size * scale), | 530 | Rectf(draw_position + offset * icon_size * scale, icon_size * scale, icon_size * scale), |
599 | 534 | image, Recti(0, 0, icon_size, icon_size), 1.f, BlendMode::UseAlpha); | 531 | image, Recti(0, 0, icon_size, icon_size), 1.f, BlendMode::UseAlpha); |
600 | 535 | }; | 532 | }; |
605 | 536 | draw_level_image(Vector2f(-1.f, -2.f), attackpic); | 533 | draw_level_image(Vector2i(-1, -2), attackpic); |
606 | 537 | draw_level_image(Vector2f(0.f, -2.f), defensepic); | 534 | draw_level_image(Vector2i(0, -2), defensepic); |
607 | 538 | draw_level_image(Vector2f(-1.f, -1.f), healthpic); | 535 | draw_level_image(Vector2i(-1, -1), healthpic); |
608 | 539 | draw_level_image(Vector2f(0.f, -1.f), evadepic); | 536 | draw_level_image(Vector2i(0, -1), evadepic); |
609 | 540 | } | 537 | } |
610 | 541 | 538 | ||
611 | 542 | /** | 539 | /** |
612 | 543 | 540 | ||
613 | === modified file 'src/logic/map_objects/tribes/soldier.h' | |||
614 | --- src/logic/map_objects/tribes/soldier.h 2017-04-23 12:11:19 +0000 | |||
615 | +++ src/logic/map_objects/tribes/soldier.h 2017-05-13 13:15:21 +0000 | |||
616 | @@ -219,7 +219,7 @@ | |||
617 | 219 | // Draw the info icon containing health bar and levels. If 'anchor_below' is | 219 | // Draw the info icon containing health bar and levels. If 'anchor_below' is |
618 | 220 | // true, the icon is drawn horizontally centered above Otherwise, the icon | 220 | // true, the icon is drawn horizontally centered above Otherwise, the icon |
619 | 221 | // is drawn below and right of 'draw_position'. | 221 | // is drawn below and right of 'draw_position'. |
621 | 222 | void draw_info_icon(Vector2f draw_position, | 222 | void draw_info_icon(Vector2i draw_position, |
622 | 223 | const float scale, | 223 | const float scale, |
623 | 224 | const bool anchor_below, | 224 | const bool anchor_below, |
624 | 225 | RenderTarget*) const; | 225 | RenderTarget*) const; |
625 | 226 | 226 | ||
626 | === modified file 'src/profile/profile.h' | |||
627 | --- src/profile/profile.h 2017-01-25 18:55:59 +0000 | |||
628 | +++ src/profile/profile.h 2017-05-13 13:15:21 +0000 | |||
629 | @@ -126,7 +126,7 @@ | |||
630 | 126 | uint32_t get_positive(char const* name, uint32_t def = 1); | 126 | uint32_t get_positive(char const* name, uint32_t def = 1); |
631 | 127 | bool get_bool(char const* name, bool def = false); | 127 | bool get_bool(char const* name, bool def = false); |
632 | 128 | const char* get_string(char const* name, char const* def = nullptr); | 128 | const char* get_string(char const* name, char const* def = nullptr); |
634 | 129 | Vector2i get_point(char const* name, Vector2i def = Vector2i(0, 0)); | 129 | Vector2i get_point(char const* name, Vector2i def = Vector2i::zero()); |
635 | 130 | 130 | ||
636 | 131 | int32_t get_safe_int(const char* name); | 131 | int32_t get_safe_int(const char* name); |
637 | 132 | uint32_t get_safe_natural(char const* name); | 132 | uint32_t get_safe_natural(char const* name); |
638 | 133 | 133 | ||
639 | === modified file 'src/scripting/lua_ui.cc' | |||
640 | --- src/scripting/lua_ui.cc 2017-01-25 18:55:59 +0000 | |||
641 | +++ src/scripting/lua_ui.cc 2017-05-13 13:15:21 +0000 | |||
642 | @@ -212,7 +212,7 @@ | |||
643 | 212 | */ | 212 | */ |
644 | 213 | int LuaPanel::get_position_x(lua_State* L) { | 213 | int LuaPanel::get_position_x(lua_State* L) { |
645 | 214 | assert(panel_); | 214 | assert(panel_); |
647 | 215 | Vector2i p = panel_->to_parent(Vector2i(0, 0)); | 215 | Vector2i p = panel_->to_parent(Vector2i::zero()); |
648 | 216 | 216 | ||
649 | 217 | lua_pushint32(L, p.x); | 217 | lua_pushint32(L, p.x); |
650 | 218 | return 1; | 218 | return 1; |
651 | @@ -225,7 +225,7 @@ | |||
652 | 225 | } | 225 | } |
653 | 226 | int LuaPanel::get_position_y(lua_State* L) { | 226 | int LuaPanel::get_position_y(lua_State* L) { |
654 | 227 | assert(panel_); | 227 | assert(panel_); |
656 | 228 | Vector2i p = panel_->to_parent(Vector2i(0, 0)); | 228 | Vector2i p = panel_->to_parent(Vector2i::zero()); |
657 | 229 | 229 | ||
658 | 230 | lua_pushint32(L, p.y); | 230 | lua_pushint32(L, p.y); |
659 | 231 | return 1; | 231 | return 1; |
660 | @@ -257,9 +257,9 @@ | |||
661 | 257 | 257 | ||
662 | 258 | UI::Panel* cur = (*get_base_user_class<LuaPanel>(L, 2))->panel_; | 258 | UI::Panel* cur = (*get_base_user_class<LuaPanel>(L, 2))->panel_; |
663 | 259 | 259 | ||
665 | 260 | Vector2i cp = Vector2i(0, 0); | 260 | Vector2i cp = Vector2i::zero(); |
666 | 261 | while (cur && cur != panel_) { | 261 | while (cur && cur != panel_) { |
668 | 262 | cp += cur->to_parent(Vector2i(0, 0)); | 262 | cp += cur->to_parent(Vector2i::zero()); |
669 | 263 | cur = cur->get_parent(); | 263 | cur = cur->get_parent(); |
670 | 264 | } | 264 | } |
671 | 265 | 265 | ||
672 | 266 | 266 | ||
673 | === modified file 'src/ui_basic/button.cc' | |||
674 | --- src/ui_basic/button.cc 2017-02-27 22:09:57 +0000 | |||
675 | +++ src/ui_basic/button.cc 2017-05-13 13:15:21 +0000 | |||
676 | @@ -161,25 +161,25 @@ | |||
677 | 161 | 161 | ||
678 | 162 | // Draw the background | 162 | // Draw the background |
679 | 163 | if (pic_background_) { | 163 | if (pic_background_) { |
681 | 164 | dst.fill_rect(Rectf(0.f, 0.f, get_w(), get_h()), RGBAColor(0, 0, 0, 255)); | 164 | dst.fill_rect(Recti(0, 0, get_w(), get_h()), RGBAColor(0, 0, 0, 255)); |
682 | 165 | dst.tile( | 165 | dst.tile( |
684 | 166 | Recti(Vector2i(0, 0), get_w(), get_h()), pic_background_, Vector2i(get_x(), get_y())); | 166 | Recti(Vector2i::zero(), get_w(), get_h()), pic_background_, Vector2i(get_x(), get_y())); |
685 | 167 | } | 167 | } |
686 | 168 | 168 | ||
687 | 169 | if (is_flat && highlighted_) | 169 | if (is_flat && highlighted_) |
689 | 170 | dst.brighten_rect(Rectf(0.f, 0.f, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR); | 170 | dst.brighten_rect(Recti(0, 0, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR); |
690 | 171 | 171 | ||
691 | 172 | // If we've got a picture, draw it centered | 172 | // If we've got a picture, draw it centered |
692 | 173 | if (pic_custom_) { | 173 | if (pic_custom_) { |
693 | 174 | if (image_mode_ == UI::Button::ImageMode::kUnscaled) { | 174 | if (image_mode_ == UI::Button::ImageMode::kUnscaled) { |
694 | 175 | if (!is_monochrome) { | 175 | if (!is_monochrome) { |
697 | 176 | dst.blit(Vector2f((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2.f, | 176 | dst.blit(Vector2i((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2, |
698 | 177 | (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2.f), | 177 | (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2), |
699 | 178 | pic_custom_); | 178 | pic_custom_); |
700 | 179 | } else { | 179 | } else { |
701 | 180 | dst.blit_monochrome( | 180 | dst.blit_monochrome( |
704 | 181 | Vector2f((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2.f, | 181 | Vector2i((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2, |
705 | 182 | (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2.f), | 182 | (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2), |
706 | 183 | pic_custom_, RGBAColor(255, 255, 255, 127)); | 183 | pic_custom_, RGBAColor(255, 255, 255, 127)); |
707 | 184 | } | 184 | } |
708 | 185 | } else { | 185 | } else { |
709 | @@ -213,7 +213,7 @@ | |||
710 | 213 | is_monochrome ? UI_FONT_CLR_DISABLED : UI_FONT_CLR_FG); | 213 | is_monochrome ? UI_FONT_CLR_DISABLED : UI_FONT_CLR_FG); |
711 | 214 | // Blit on pixel boundary (not float), so that the text is blitted pixel perfect. | 214 | // Blit on pixel boundary (not float), so that the text is blitted pixel perfect. |
712 | 215 | dst.blit( | 215 | dst.blit( |
714 | 216 | Vector2f((get_w() - entry_text_im->width()) / 2, (get_h() - entry_text_im->height()) / 2), | 216 | Vector2i((get_w() - entry_text_im->width()) / 2, (get_h() - entry_text_im->height()) / 2), |
715 | 217 | entry_text_im); | 217 | entry_text_im); |
716 | 218 | } | 218 | } |
717 | 219 | 219 | ||
718 | @@ -229,36 +229,36 @@ | |||
719 | 229 | // Button is a normal one, not flat. We invert the behaviour for kPermpressed. | 229 | // Button is a normal one, not flat. We invert the behaviour for kPermpressed. |
720 | 230 | if (is_permpressed == (pressed_ && highlighted_)) { | 230 | if (is_permpressed == (pressed_ && highlighted_)) { |
721 | 231 | // top edge | 231 | // top edge |
723 | 232 | dst.brighten_rect(Rectf(0.f, 0.f, get_w(), 2.f), BUTTON_EDGE_BRIGHT_FACTOR); | 232 | dst.brighten_rect(Recti(0, 0, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); |
724 | 233 | // left edge | 233 | // left edge |
726 | 234 | dst.brighten_rect(Rectf(0, 2, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 234 | dst.brighten_rect(Recti(0, 2, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
727 | 235 | // bottom edge | 235 | // bottom edge |
730 | 236 | dst.fill_rect(Rectf(2, get_h() - 2, get_w() - 2, 1), black); | 236 | dst.fill_rect(Recti(2, get_h() - 2, get_w() - 2, 1), black); |
731 | 237 | dst.fill_rect(Rectf(1, get_h() - 1, get_w() - 1, 1), black); | 237 | dst.fill_rect(Recti(1, get_h() - 1, get_w() - 1, 1), black); |
732 | 238 | // right edge | 238 | // right edge |
735 | 239 | dst.fill_rect(Rectf(get_w() - 2, 2, 1, get_h() - 2), black); | 239 | dst.fill_rect(Recti(get_w() - 2, 2, 1, get_h() - 2), black); |
736 | 240 | dst.fill_rect(Rectf(get_w() - 1, 1, 1, get_h() - 1), black); | 240 | dst.fill_rect(Recti(get_w() - 1, 1, 1, get_h() - 1), black); |
737 | 241 | } else { | 241 | } else { |
738 | 242 | // bottom edge | 242 | // bottom edge |
740 | 243 | dst.brighten_rect(Rectf(0, get_h() - 2, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); | 243 | dst.brighten_rect(Recti(0, get_h() - 2, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); |
741 | 244 | // right edge | 244 | // right edge |
743 | 245 | dst.brighten_rect(Rectf(get_w() - 2, 0, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 245 | dst.brighten_rect(Recti(get_w() - 2, 0, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
744 | 246 | // top edge | 246 | // top edge |
747 | 247 | dst.fill_rect(Rectf(0, 0, get_w() - 1, 1), black); | 247 | dst.fill_rect(Recti(0, 0, get_w() - 1, 1), black); |
748 | 248 | dst.fill_rect(Rectf(0, 1, get_w() - 2, 1), black); | 248 | dst.fill_rect(Recti(0, 1, get_w() - 2, 1), black); |
749 | 249 | // left edge | 249 | // left edge |
752 | 250 | dst.fill_rect(Rectf(0, 0, 1, get_h() - 1), black); | 250 | dst.fill_rect(Recti(0, 0, 1, get_h() - 1), black); |
753 | 251 | dst.fill_rect(Rectf(1, 0, 1, get_h() - 2), black); | 251 | dst.fill_rect(Recti(1, 0, 1, get_h() - 2), black); |
754 | 252 | } | 252 | } |
755 | 253 | } else { | 253 | } else { |
756 | 254 | // Button is flat, do not draw borders, instead, if it is pressed, draw | 254 | // Button is flat, do not draw borders, instead, if it is pressed, draw |
757 | 255 | // a box around it. | 255 | // a box around it. |
758 | 256 | if (enabled_ && highlighted_) { | 256 | if (enabled_ && highlighted_) { |
759 | 257 | RGBAColor shade(100, 100, 100, 80); | 257 | RGBAColor shade(100, 100, 100, 80); |
764 | 258 | dst.fill_rect(Rectf(0, 0, get_w(), 2), shade); | 258 | dst.fill_rect(Recti(0, 0, get_w(), 2), shade); |
765 | 259 | dst.fill_rect(Rectf(0, 2, 2, get_h() - 2), shade); | 259 | dst.fill_rect(Recti(0, 2, 2, get_h() - 2), shade); |
766 | 260 | dst.fill_rect(Rectf(0, get_h() - 2, get_w(), get_h()), shade); | 260 | dst.fill_rect(Recti(0, get_h() - 2, get_w(), get_h()), shade); |
767 | 261 | dst.fill_rect(Rectf(get_w() - 2, 0, get_w(), get_h()), shade); | 261 | dst.fill_rect(Recti(get_w() - 2, 0, get_w(), get_h()), shade); |
768 | 262 | } | 262 | } |
769 | 263 | } | 263 | } |
770 | 264 | } | 264 | } |
771 | 265 | 265 | ||
772 | === modified file 'src/ui_basic/checkbox.cc' | |||
773 | --- src/ui_basic/checkbox.cc 2017-02-23 17:58:25 +0000 | |||
774 | +++ src/ui_basic/checkbox.cc 2017-05-13 13:15:21 +0000 | |||
775 | @@ -134,18 +134,18 @@ | |||
776 | 134 | const uint16_t w = pic_graphics_->width(); | 134 | const uint16_t w = pic_graphics_->width(); |
777 | 135 | const uint16_t h = pic_graphics_->height(); | 135 | const uint16_t h = pic_graphics_->height(); |
778 | 136 | 136 | ||
780 | 137 | dst.blit(Vector2f((get_inner_w() - w) / 2, (get_inner_h() - h) / 2), pic_graphics_); | 137 | dst.blit(Vector2i((get_inner_w() - w) / 2, (get_inner_h() - h) / 2), pic_graphics_); |
781 | 138 | 138 | ||
782 | 139 | if (flags_ & Is_Checked) { | 139 | if (flags_ & Is_Checked) { |
784 | 140 | dst.draw_rect(Rectf(0.f, 0.f, get_w(), get_h()), RGBColor(229, 116, 2)); | 140 | dst.draw_rect(Recti(0, 0, get_w(), get_h()), RGBColor(229, 116, 2)); |
785 | 141 | } else if (flags_ & Is_Highlighted) { | 141 | } else if (flags_ & Is_Highlighted) { |
787 | 142 | dst.draw_rect(Rectf(0.f, 0.f, get_w(), get_h()), RGBColor(100, 100, 80)); | 142 | dst.draw_rect(Recti(0, 0, get_w(), get_h()), RGBColor(100, 100, 80)); |
788 | 143 | } | 143 | } |
789 | 144 | } else { | 144 | } else { |
790 | 145 | static_assert(0 <= kStateboxSize, "assert(0 <= STATEBOX_WIDTH) failed."); | 145 | static_assert(0 <= kStateboxSize, "assert(0 <= STATEBOX_WIDTH) failed."); |
791 | 146 | static_assert(0 <= kStateboxSize, "assert(0 <= STATEBOX_HEIGHT) failed."); | 146 | static_assert(0 <= kStateboxSize, "assert(0 <= STATEBOX_HEIGHT) failed."); |
794 | 147 | Vector2f image_anchor(0.f, 0.f); | 147 | Vector2i image_anchor(0, 0); |
795 | 148 | Vector2f text_anchor(kStateboxSize + kPadding, 0); | 148 | Vector2i text_anchor(kStateboxSize + kPadding, 0); |
796 | 149 | 149 | ||
797 | 150 | if (rendered_text_) { | 150 | if (rendered_text_) { |
798 | 151 | if (UI::g_fh1->fontset()->is_rtl()) { | 151 | if (UI::g_fh1->fontset()->is_rtl()) { |
799 | @@ -153,7 +153,7 @@ | |||
800 | 153 | image_anchor.x = rendered_text_->width() + kPadding; | 153 | image_anchor.x = rendered_text_->width() + kPadding; |
801 | 154 | image_anchor.y = (get_h() - kStateboxSize) / 2; | 154 | image_anchor.y = (get_h() - kStateboxSize) / 2; |
802 | 155 | } | 155 | } |
804 | 156 | dst.blit(text_anchor, rendered_text_, BlendMode::UseAlpha, UI::Align::kLeft); | 156 | dst.blit(text_anchor, rendered_text_, BlendMode::UseAlpha); |
805 | 157 | } | 157 | } |
806 | 158 | 158 | ||
807 | 159 | dst.blitrect( | 159 | dst.blitrect( |
808 | @@ -162,7 +162,7 @@ | |||
809 | 162 | 162 | ||
810 | 163 | if (flags_ & Is_Highlighted) | 163 | if (flags_ & Is_Highlighted) |
811 | 164 | dst.draw_rect( | 164 | dst.draw_rect( |
813 | 165 | Rectf(image_anchor, kStateboxSize + 1, kStateboxSize + 1), RGBColor(100, 100, 80)); | 165 | Recti(image_anchor, kStateboxSize + 1, kStateboxSize + 1), RGBColor(100, 100, 80)); |
814 | 166 | } | 166 | } |
815 | 167 | } | 167 | } |
816 | 168 | 168 | ||
817 | 169 | 169 | ||
818 | === modified file 'src/ui_basic/editbox.cc' | |||
819 | --- src/ui_basic/editbox.cc 2017-02-28 20:07:07 +0000 | |||
820 | +++ src/ui_basic/editbox.cc 2017-05-13 13:15:21 +0000 | |||
821 | @@ -363,19 +363,19 @@ | |||
822 | 363 | static const RGBColor black(0, 0, 0); | 363 | static const RGBColor black(0, 0, 0); |
823 | 364 | 364 | ||
824 | 365 | // bottom edge | 365 | // bottom edge |
826 | 366 | dst.brighten_rect(Rectf(0, get_h() - 2, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); | 366 | dst.brighten_rect(Recti(0, get_h() - 2, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); |
827 | 367 | // right edge | 367 | // right edge |
829 | 368 | dst.brighten_rect(Rectf(get_w() - 2, 0, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 368 | dst.brighten_rect(Recti(get_w() - 2, 0, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
830 | 369 | // top edge | 369 | // top edge |
833 | 370 | dst.fill_rect(Rectf(0.f, 0.f, get_w() - 1, 1), black); | 370 | dst.fill_rect(Recti(0, 0, get_w() - 1, 1), black); |
834 | 371 | dst.fill_rect(Rectf(0.f, 1.f, get_w() - 2, 1), black); | 371 | dst.fill_rect(Recti(0, 1, get_w() - 2, 1), black); |
835 | 372 | // left edge | 372 | // left edge |
838 | 373 | dst.fill_rect(Rectf(0.f, 0.f, 1, get_h() - 1), black); | 373 | dst.fill_rect(Recti(0, 0, 1, get_h() - 1), black); |
839 | 374 | dst.fill_rect(Rectf(1.f, 0.f, 1, get_h() - 2), black); | 374 | dst.fill_rect(Recti(1, 0, 1, get_h() - 2), black); |
840 | 375 | } | 375 | } |
841 | 376 | 376 | ||
842 | 377 | if (has_focus()) { | 377 | if (has_focus()) { |
844 | 378 | dst.brighten_rect(Rectf(0.f, 0.f, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR); | 378 | dst.brighten_rect(Recti(0, 0, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR); |
845 | 379 | } | 379 | } |
846 | 380 | 380 | ||
847 | 381 | const int max_width = get_w() - 2 * kMarginX; | 381 | const int max_width = get_w() - 2 * kMarginX; |
848 | @@ -390,7 +390,7 @@ | |||
849 | 390 | ->height() : | 390 | ->height() : |
850 | 391 | entry_text_im->height(); | 391 | entry_text_im->height(); |
851 | 392 | 392 | ||
853 | 393 | Vector2f point(kMarginX, get_h() / 2); | 393 | Vector2i point(kMarginX, get_h() / 2); |
854 | 394 | if (m_->align == UI::Align::kRight) { | 394 | if (m_->align == UI::Align::kRight) { |
855 | 395 | point.x += max_width - linewidth; | 395 | point.x += max_width - linewidth; |
856 | 396 | } | 396 | } |
857 | @@ -428,9 +428,9 @@ | |||
858 | 428 | const uint16_t fontheight = text_height(m_->text, m_->fontsize); | 428 | const uint16_t fontheight = text_height(m_->text, m_->fontsize); |
859 | 429 | 429 | ||
860 | 430 | const Image* caret_image = g_gr->images().get("images/ui_basic/caret.png"); | 430 | const Image* caret_image = g_gr->images().get("images/ui_basic/caret.png"); |
862 | 431 | Vector2f caretpt; | 431 | Vector2i caretpt = Vector2i::zero(); |
863 | 432 | caretpt.x = point.x + m_->scrolloffset + caret_x - caret_image->width() + kLineMargin; | 432 | caretpt.x = point.x + m_->scrolloffset + caret_x - caret_image->width() + kLineMargin; |
865 | 433 | caretpt.y = point.y + (fontheight - caret_image->height()) / 2.f; | 433 | caretpt.y = point.y + (fontheight - caret_image->height()) / 2; |
866 | 434 | dst.blit(caretpt, caret_image); | 434 | dst.blit(caretpt, caret_image); |
867 | 435 | } | 435 | } |
868 | 436 | } | 436 | } |
869 | 437 | 437 | ||
870 | === modified file 'src/ui_basic/fullscreen_window.cc' | |||
871 | --- src/ui_basic/fullscreen_window.cc 2017-02-23 19:38:51 +0000 | |||
872 | +++ src/ui_basic/fullscreen_window.cc 2017-05-13 13:15:21 +0000 | |||
873 | @@ -86,7 +86,7 @@ | |||
874 | 86 | */ | 86 | */ |
875 | 87 | void FullscreenWindow::draw(RenderTarget& dst) { | 87 | void FullscreenWindow::draw(RenderTarget& dst) { |
876 | 88 | // Overall background | 88 | // Overall background |
878 | 89 | dst.tile(Recti(0, 0, get_w(), get_h()), g_gr->images().get(background_image_), Vector2i(0, 0)); | 89 | dst.tile(Recti(0, 0, get_w(), get_h()), g_gr->images().get(background_image_), Vector2i::zero()); |
879 | 90 | 90 | ||
880 | 91 | // Optional overlays | 91 | // Optional overlays |
881 | 92 | for (const auto& overlay : overlays_) { | 92 | for (const auto& overlay : overlays_) { |
882 | @@ -148,9 +148,9 @@ | |||
883 | 148 | if (tiling != kNone) { | 148 | if (tiling != kNone) { |
884 | 149 | const int w = (tiling == kVertical) ? image->width() : get_w(); | 149 | const int w = (tiling == kVertical) ? image->width() : get_w(); |
885 | 150 | const int h = (tiling == kHorizontal) ? image->height() : get_h(); | 150 | const int h = (tiling == kHorizontal) ? image->height() : get_h(); |
887 | 151 | dst.tile(Recti(x, y, w, h), image, Vector2i(0, 0)); | 151 | dst.tile(Recti(x, y, w, h), image, Vector2i::zero()); |
888 | 152 | } else { | 152 | } else { |
890 | 153 | dst.blit(Vector2f(x, y), image); | 153 | dst.blit(Vector2i(x, y), image); |
891 | 154 | } | 154 | } |
892 | 155 | } | 155 | } |
893 | 156 | } | 156 | } |
894 | 157 | 157 | ||
895 | === modified file 'src/ui_basic/icon.cc' | |||
896 | --- src/ui_basic/icon.cc 2017-01-25 18:55:59 +0000 | |||
897 | +++ src/ui_basic/icon.cc 2017-05-13 13:15:21 +0000 | |||
898 | @@ -63,7 +63,7 @@ | |||
899 | 63 | Recti(0, 0, pic_->width(), pic_->height()), 1., BlendMode::UseAlpha); | 63 | Recti(0, 0, pic_->width(), pic_->height()), 1., BlendMode::UseAlpha); |
900 | 64 | } | 64 | } |
901 | 65 | if (draw_frame_) { | 65 | if (draw_frame_) { |
903 | 66 | dst.draw_rect(Rectf(0.f, 0.f, get_w(), get_h()), framecolor_); | 66 | dst.draw_rect(Recti(0, 0, get_w(), get_h()), framecolor_); |
904 | 67 | } | 67 | } |
905 | 68 | } | 68 | } |
906 | 69 | } | 69 | } |
907 | 70 | 70 | ||
908 | === modified file 'src/ui_basic/listselect.cc' | |||
909 | --- src/ui_basic/listselect.cc 2017-03-06 06:57:47 +0000 | |||
910 | +++ src/ui_basic/listselect.cc 2017-05-13 13:15:21 +0000 | |||
911 | @@ -356,23 +356,23 @@ | |||
912 | 356 | int y = 1 + idx * get_lineheight() - scrollpos_; | 356 | int y = 1 + idx * get_lineheight() - scrollpos_; |
913 | 357 | 357 | ||
914 | 358 | if (background_ != nullptr) { | 358 | if (background_ != nullptr) { |
916 | 359 | dst.tile(Recti(Vector2i(0, 0), get_w(), get_h()), background_, Vector2i(0, 0)); | 359 | dst.tile(Recti(Vector2i::zero(), get_w(), get_h()), background_, Vector2i::zero()); |
917 | 360 | } | 360 | } |
918 | 361 | 361 | ||
919 | 362 | if (selection_mode_ == ListselectLayout::kDropdown) { | 362 | if (selection_mode_ == ListselectLayout::kDropdown) { |
920 | 363 | RGBAColor black(0, 0, 0, 255); | 363 | RGBAColor black(0, 0, 0, 255); |
921 | 364 | // top edge | 364 | // top edge |
923 | 365 | dst.brighten_rect(Rectf(0.f, 0.f, get_w(), 2.f), BUTTON_EDGE_BRIGHT_FACTOR / 4); | 365 | dst.brighten_rect(Recti(0, 0, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR / 4); |
924 | 366 | // left edge | 366 | // left edge |
926 | 367 | dst.brighten_rect(Rectf(0.f, 0.f, 2.f, get_h()), BUTTON_EDGE_BRIGHT_FACTOR); | 367 | dst.brighten_rect(Recti(0, 0, 2, get_h()), BUTTON_EDGE_BRIGHT_FACTOR); |
927 | 368 | // bottom edge | 368 | // bottom edge |
930 | 369 | dst.fill_rect(Rectf(2.f, get_h() - 2.f, get_eff_w() - 2.f, 1.f), black); | 369 | dst.fill_rect(Recti(2, get_h() - 2, get_eff_w() - 2, 1), black); |
931 | 370 | dst.fill_rect(Rectf(1.f, get_h() - 1.f, get_eff_w() - 1.f, 1.f), black); | 370 | dst.fill_rect(Recti(1, get_h() - 1, get_eff_w() - 1, 1), black); |
932 | 371 | // right edge | 371 | // right edge |
935 | 372 | dst.fill_rect(Rectf(get_w() - 2.f, 1.f, 1.f, get_h() - 1.f), black); | 372 | dst.fill_rect(Recti(get_w() - 2, 1, 1, get_h() - 1), black); |
936 | 373 | dst.fill_rect(Rectf(get_w() - 1.f, 0.f, 1.f, get_h()), black); | 373 | dst.fill_rect(Recti(get_w() - 1, 0, 1, get_h()), black); |
937 | 374 | } else { | 374 | } else { |
939 | 375 | dst.brighten_rect(Rectf(0.f, 0.f, get_eff_w(), get_h()), ms_darken_value); | 375 | dst.brighten_rect(Recti(0, 0, get_eff_w(), get_h()), ms_darken_value); |
940 | 376 | } | 376 | } |
941 | 377 | 377 | ||
942 | 378 | while (idx < entry_records_.size()) { | 378 | while (idx < entry_records_.size()) { |
943 | @@ -390,14 +390,14 @@ | |||
944 | 390 | break; | 390 | break; |
945 | 391 | } | 391 | } |
946 | 392 | 392 | ||
948 | 393 | Vector2f point(selection_mode_ == ListselectLayout::kDropdown ? 3.f : 1.f, y); | 393 | Vector2i point(selection_mode_ == ListselectLayout::kDropdown ? 3 : 1, y); |
949 | 394 | uint32_t maxw = | 394 | uint32_t maxw = |
950 | 395 | get_eff_w() - | 395 | get_eff_w() - |
951 | 396 | (selection_mode_ == ListselectLayout::kDropdown ? scrollbar_.is_enabled() ? 4 : 5 : 2); | 396 | (selection_mode_ == ListselectLayout::kDropdown ? scrollbar_.is_enabled() ? 4 : 5 : 2); |
952 | 397 | 397 | ||
953 | 398 | // Highlight the current selected entry | 398 | // Highlight the current selected entry |
954 | 399 | if (idx == selection_) { | 399 | if (idx == selection_) { |
956 | 400 | Rectf r(point, maxw, lineheight_); | 400 | Recti r(point, maxw, lineheight_); |
957 | 401 | if (r.x < 0) { | 401 | if (r.x < 0) { |
958 | 402 | r.w += r.x; | 402 | r.w += r.x; |
959 | 403 | r.x = 0; | 403 | r.x = 0; |
960 | @@ -417,7 +417,7 @@ | |||
961 | 417 | 417 | ||
962 | 418 | // Now draw pictures | 418 | // Now draw pictures |
963 | 419 | if (er.pic) { | 419 | if (er.pic) { |
965 | 420 | dst.blit(Vector2f(UI::g_fh1->fontset()->is_rtl() ? get_eff_w() - er.pic->width() - 1 : 1, | 420 | dst.blit(Vector2i(UI::g_fh1->fontset()->is_rtl() ? get_eff_w() - er.pic->width() - 1 : 1, |
966 | 421 | y + (get_lineheight() - er.pic->height()) / 2), | 421 | y + (get_lineheight() - er.pic->height()) / 2), |
967 | 422 | er.pic); | 422 | er.pic); |
968 | 423 | } | 423 | } |
969 | 424 | 424 | ||
970 | === modified file 'src/ui_basic/multilineeditbox.cc' | |||
971 | --- src/ui_basic/multilineeditbox.cc 2017-03-04 18:02:23 +0000 | |||
972 | +++ src/ui_basic/multilineeditbox.cc 2017-05-13 13:15:21 +0000 | |||
973 | @@ -426,26 +426,26 @@ | |||
974 | 426 | */ | 426 | */ |
975 | 427 | void MultilineEditbox::draw(RenderTarget& dst) { | 427 | void MultilineEditbox::draw(RenderTarget& dst) { |
976 | 428 | // Draw the background | 428 | // Draw the background |
978 | 429 | dst.tile(Recti(Vector2i(0, 0), get_w(), get_h()), d_->background, Vector2i(get_x(), get_y())); | 429 | dst.tile(Recti(Vector2i::zero(), get_w(), get_h()), d_->background, Vector2i(get_x(), get_y())); |
979 | 430 | 430 | ||
980 | 431 | // Draw border. | 431 | // Draw border. |
981 | 432 | if (get_w() >= 4 && get_h() >= 4) { | 432 | if (get_w() >= 4 && get_h() >= 4) { |
982 | 433 | static const RGBColor black(0, 0, 0); | 433 | static const RGBColor black(0, 0, 0); |
983 | 434 | 434 | ||
984 | 435 | // bottom edge | 435 | // bottom edge |
986 | 436 | dst.brighten_rect(Rectf(0.f, get_h() - 2, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); | 436 | dst.brighten_rect(Recti(0, get_h() - 2, get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR); |
987 | 437 | // right edge | 437 | // right edge |
989 | 438 | dst.brighten_rect(Rectf(get_w() - 2, 0, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 438 | dst.brighten_rect(Recti(get_w() - 2, 0, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
990 | 439 | // top edge | 439 | // top edge |
993 | 440 | dst.fill_rect(Rectf(0, 0, get_w() - 1, 1), black); | 440 | dst.fill_rect(Recti(0, 0, get_w() - 1, 1), black); |
994 | 441 | dst.fill_rect(Rectf(0, 1, get_w() - 2, 1), black); | 441 | dst.fill_rect(Recti(0, 1, get_w() - 2, 1), black); |
995 | 442 | // left edge | 442 | // left edge |
998 | 443 | dst.fill_rect(Rectf(0, 0, 1, get_h() - 1), black); | 443 | dst.fill_rect(Recti(0, 0, 1, get_h() - 1), black); |
999 | 444 | dst.fill_rect(Rectf(1, 0, 1, get_h() - 2), black); | 444 | dst.fill_rect(Recti(1, 0, 1, get_h() - 2), black); |
1000 | 445 | } | 445 | } |
1001 | 446 | 446 | ||
1002 | 447 | if (has_focus()) | 447 | if (has_focus()) |
1004 | 448 | dst.brighten_rect(Rectf(0, 0, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR); | 448 | dst.brighten_rect(Recti(0, 0, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR); |
1005 | 449 | 449 | ||
1006 | 450 | d_->refresh_ww(); | 450 | d_->refresh_ww(); |
1007 | 451 | 451 | ||
1008 | 452 | 452 | ||
1009 | === modified file 'src/ui_basic/multilinetextarea.cc' | |||
1010 | --- src/ui_basic/multilinetextarea.cc 2017-03-04 18:02:23 +0000 | |||
1011 | +++ src/ui_basic/multilinetextarea.cc 2017-05-13 13:15:21 +0000 | |||
1012 | @@ -145,7 +145,7 @@ | |||
1013 | 145 | */ | 145 | */ |
1014 | 146 | void MultilineTextarea::draw(RenderTarget& dst) { | 146 | void MultilineTextarea::draw(RenderTarget& dst) { |
1015 | 147 | if (pic_background_) { | 147 | if (pic_background_) { |
1017 | 148 | dst.tile(Recti(0, 0, get_inner_w(), get_inner_h()), pic_background_, Vector2i(0, 0)); | 148 | dst.tile(Recti(0, 0, get_inner_w(), get_inner_h()), pic_background_, Vector2i::zero()); |
1018 | 149 | } | 149 | } |
1019 | 150 | if (use_old_renderer_) { | 150 | if (use_old_renderer_) { |
1020 | 151 | rt.draw(dst, Vector2i(RICHTEXT_MARGIN, RICHTEXT_MARGIN - scrollbar_.get_scrollpos())); | 151 | rt.draw(dst, Vector2i(RICHTEXT_MARGIN, RICHTEXT_MARGIN - scrollbar_.get_scrollpos())); |
1021 | @@ -174,7 +174,7 @@ | |||
1022 | 174 | anchor = RICHTEXT_MARGIN; | 174 | anchor = RICHTEXT_MARGIN; |
1023 | 175 | } | 175 | } |
1024 | 176 | 176 | ||
1026 | 177 | dst.blitrect(Vector2f(anchor, 0), text_im, | 177 | dst.blitrect(Vector2i(anchor, 0), text_im, |
1027 | 178 | Recti(0, scrollbar_.get_scrollpos(), blit_width, blit_height), | 178 | Recti(0, scrollbar_.get_scrollpos(), blit_width, blit_height), |
1028 | 179 | BlendMode::UseAlpha); | 179 | BlendMode::UseAlpha); |
1029 | 180 | } | 180 | } |
1030 | 181 | 181 | ||
1031 | === modified file 'src/ui_basic/panel.cc' | |||
1032 | --- src/ui_basic/panel.cc 2017-02-27 13:53:04 +0000 | |||
1033 | +++ src/ui_basic/panel.cc 2017-05-13 13:15:21 +0000 | |||
1034 | @@ -191,7 +191,7 @@ | |||
1035 | 191 | RenderTarget& rt = *g_gr->get_render_target(); | 191 | RenderTarget& rt = *g_gr->get_render_target(); |
1036 | 192 | forefather->do_draw(rt); | 192 | forefather->do_draw(rt); |
1037 | 193 | rt.blit( | 193 | rt.blit( |
1039 | 194 | (app->get_mouse_position() - Vector2i(3, 7)).cast<float>(), | 194 | (app->get_mouse_position() - Vector2i(3, 7)), |
1040 | 195 | WLApplication::get()->is_mouse_pressed() ? default_cursor_click_ : default_cursor_); | 195 | WLApplication::get()->is_mouse_pressed() ? default_cursor_click_ : default_cursor_); |
1041 | 196 | forefather->do_tooltip(); | 196 | forefather->do_tooltip(); |
1042 | 197 | g_gr->refresh(); | 197 | g_gr->refresh(); |
1043 | @@ -746,7 +746,7 @@ | |||
1044 | 746 | return; | 746 | return; |
1045 | 747 | 747 | ||
1046 | 748 | Recti outerrc; | 748 | Recti outerrc; |
1048 | 749 | Vector2i outerofs; | 749 | Vector2i outerofs = Vector2i::zero(); |
1049 | 750 | 750 | ||
1050 | 751 | if (!dst.enter_window(Recti(Vector2i(x_, y_), w_, h_), &outerrc, &outerofs)) | 751 | if (!dst.enter_window(Recti(Vector2i(x_, y_), w_, h_), &outerrc, &outerofs)) |
1051 | 752 | return; | 752 | return; |
1052 | @@ -1068,9 +1068,9 @@ | |||
1053 | 1068 | uint16_t tip_width = rendered_text->width() + 4; | 1068 | uint16_t tip_width = rendered_text->width() + 4; |
1054 | 1069 | uint16_t tip_height = rendered_text->height() + 4; | 1069 | uint16_t tip_height = rendered_text->height() + 4; |
1055 | 1070 | 1070 | ||
1059 | 1071 | Rectf r(WLApplication::get()->get_mouse_position() + Vector2i(2, 32), tip_width, tip_height); | 1071 | Recti r(WLApplication::get()->get_mouse_position() + Vector2i(2, 32), tip_width, tip_height); |
1060 | 1072 | const Vector2f tooltip_bottom_right = r.opposite_of_origin(); | 1072 | const Vector2i tooltip_bottom_right = r.opposite_of_origin(); |
1061 | 1073 | const Vector2f screen_bottom_right(g_gr->get_xres(), g_gr->get_yres()); | 1073 | const Vector2i screen_bottom_right(g_gr->get_xres(), g_gr->get_yres()); |
1062 | 1074 | if (screen_bottom_right.x < tooltip_bottom_right.x) | 1074 | if (screen_bottom_right.x < tooltip_bottom_right.x) |
1063 | 1075 | r.x -= 4 + r.w; | 1075 | r.x -= 4 + r.w; |
1064 | 1076 | if (screen_bottom_right.y < tooltip_bottom_right.y) | 1076 | if (screen_bottom_right.y < tooltip_bottom_right.y) |
1065 | @@ -1078,7 +1078,7 @@ | |||
1066 | 1078 | 1078 | ||
1067 | 1079 | dst.fill_rect(r, RGBColor(63, 52, 34)); | 1079 | dst.fill_rect(r, RGBColor(63, 52, 34)); |
1068 | 1080 | dst.draw_rect(r, RGBColor(0, 0, 0)); | 1080 | dst.draw_rect(r, RGBColor(0, 0, 0)); |
1070 | 1081 | dst.blit(r.origin() + Vector2f(2.f, 2.f), rendered_text); | 1081 | dst.blit(r.origin() + Vector2i(2, 2), rendered_text); |
1071 | 1082 | return true; | 1082 | return true; |
1072 | 1083 | } | 1083 | } |
1073 | 1084 | } | 1084 | } |
1074 | 1085 | 1085 | ||
1075 | === modified file 'src/ui_basic/progressbar.cc' | |||
1076 | --- src/ui_basic/progressbar.cc 2017-02-26 11:00:07 +0000 | |||
1077 | +++ src/ui_basic/progressbar.cc 2017-05-13 13:15:21 +0000 | |||
1078 | @@ -75,13 +75,13 @@ | |||
1079 | 75 | const float w = get_w() * fraction; | 75 | const float w = get_w() * fraction; |
1080 | 76 | assert(w <= get_w()); | 76 | assert(w <= get_w()); |
1081 | 77 | 77 | ||
1084 | 78 | dst.fill_rect(Rectf(0.f, 0.f, w, get_h()), color); | 78 | dst.fill_rect(Recti(0, 0, w, get_h()), color); |
1085 | 79 | dst.fill_rect(Rectf(w, 0.f, get_w() - w, get_h()), RGBColor(0, 0, 0)); | 79 | dst.fill_rect(Recti(w, 0, get_w() - w, get_h()), RGBColor(0, 0, 0)); |
1086 | 80 | } else { | 80 | } else { |
1087 | 81 | const uint32_t h = static_cast<uint32_t>(get_h() * (1.0f - fraction)); | 81 | const uint32_t h = static_cast<uint32_t>(get_h() * (1.0f - fraction)); |
1088 | 82 | 82 | ||
1091 | 83 | dst.fill_rect(Rectf(0.f, 0.f, get_w(), h), RGBColor(0, 0, 0)); | 83 | dst.fill_rect(Recti(0, 0, get_w(), h), RGBColor(0, 0, 0)); |
1092 | 84 | dst.fill_rect(Rectf(0.f, h, get_w(), get_h() - h), color); | 84 | dst.fill_rect(Recti(0, h, get_w(), get_h() - h), color); |
1093 | 85 | } | 85 | } |
1094 | 86 | 86 | ||
1095 | 87 | // Print the state in percent without decimal points. | 87 | // Print the state in percent without decimal points. |
1096 | @@ -89,8 +89,9 @@ | |||
1097 | 89 | UI_FONT_CLR_BRIGHT.hex_value() % floor(fraction * 100.f)) | 89 | UI_FONT_CLR_BRIGHT.hex_value() % floor(fraction * 100.f)) |
1098 | 90 | .str(); | 90 | .str(); |
1099 | 91 | const Image* rendered_text = UI::g_fh1->render(as_uifont(progress_text)); | 91 | const Image* rendered_text = UI::g_fh1->render(as_uifont(progress_text)); |
1101 | 92 | Vector2f pos(get_w() / 2, get_h() / 2); | 92 | Vector2i pos(get_w() / 2, get_h() / 2); |
1102 | 93 | UI::correct_for_align(UI::Align::kCenter, rendered_text->width(), &pos); | ||
1103 | 93 | UI::center_vertically(rendered_text->height(), &pos); | 94 | UI::center_vertically(rendered_text->height(), &pos); |
1105 | 94 | dst.blit(pos, rendered_text, BlendMode::UseAlpha, UI::Align::kCenter); | 95 | dst.blit(pos, rendered_text, BlendMode::UseAlpha); |
1106 | 95 | } | 96 | } |
1107 | 96 | } | 97 | } |
1108 | 97 | 98 | ||
1109 | === modified file 'src/ui_basic/progresswindow.cc' | |||
1110 | --- src/ui_basic/progresswindow.cc 2017-02-24 10:21:37 +0000 | |||
1111 | +++ src/ui_basic/progresswindow.cc 2017-05-13 13:15:21 +0000 | |||
1112 | @@ -45,7 +45,9 @@ | |||
1113 | 45 | 45 | ||
1114 | 46 | namespace UI { | 46 | namespace UI { |
1115 | 47 | 47 | ||
1117 | 48 | ProgressWindow::ProgressWindow(const std::string& background) : UI::FullscreenWindow() { | 48 | ProgressWindow::ProgressWindow(const std::string& background) : |
1118 | 49 | UI::FullscreenWindow(), | ||
1119 | 50 | label_center_(Vector2i::zero()) { | ||
1120 | 49 | set_background(background); | 51 | set_background(background); |
1121 | 50 | step(_("Loading…")); | 52 | step(_("Loading…")); |
1122 | 51 | } | 53 | } |
1123 | @@ -70,7 +72,7 @@ | |||
1124 | 70 | label_rectangle_.y = label_center_.y - h / 2 - PROGRESS_STATUS_RECT_PADDING; | 72 | label_rectangle_.y = label_center_.y - h / 2 - PROGRESS_STATUS_RECT_PADDING; |
1125 | 71 | label_rectangle_.h = h + 2 * PROGRESS_STATUS_RECT_PADDING; | 73 | label_rectangle_.h = h + 2 * PROGRESS_STATUS_RECT_PADDING; |
1126 | 72 | 74 | ||
1128 | 73 | Rectf border_rect = label_rectangle_; | 75 | Recti border_rect = label_rectangle_; |
1129 | 74 | border_rect.x -= PROGRESS_STATUS_BORDER_X; | 76 | border_rect.x -= PROGRESS_STATUS_BORDER_X; |
1130 | 75 | border_rect.y -= PROGRESS_STATUS_BORDER_Y; | 77 | border_rect.y -= PROGRESS_STATUS_BORDER_Y; |
1131 | 76 | border_rect.w += 2 * PROGRESS_STATUS_BORDER_X; | 78 | border_rect.w += 2 * PROGRESS_STATUS_BORDER_X; |
1132 | @@ -100,8 +102,9 @@ | |||
1133 | 100 | rt.fill_rect(label_rectangle_, PROGRESS_FONT_COLOR_BG); | 102 | rt.fill_rect(label_rectangle_, PROGRESS_FONT_COLOR_BG); |
1134 | 101 | const Image* rendered_text = | 103 | const Image* rendered_text = |
1135 | 102 | UI::g_fh1->render(as_uifont(description, UI_FONT_SIZE_SMALL, PROGRESS_FONT_COLOR_FG)); | 104 | UI::g_fh1->render(as_uifont(description, UI_FONT_SIZE_SMALL, PROGRESS_FONT_COLOR_FG)); |
1136 | 105 | UI::correct_for_align(UI::Align::kCenter, rendered_text->width(), &label_center_); | ||
1137 | 103 | UI::center_vertically(rendered_text->height(), &label_center_); | 106 | UI::center_vertically(rendered_text->height(), &label_center_); |
1139 | 104 | rt.blit(label_center_, rendered_text, BlendMode::UseAlpha, UI::Align::kCenter); | 107 | rt.blit(label_center_, rendered_text, BlendMode::UseAlpha); |
1140 | 105 | 108 | ||
1141 | 106 | #ifdef _WIN32 | 109 | #ifdef _WIN32 |
1142 | 107 | // Pump events to prevent "not responding" on windows | 110 | // Pump events to prevent "not responding" on windows |
1143 | 108 | 111 | ||
1144 | === modified file 'src/ui_basic/progresswindow.h' | |||
1145 | --- src/ui_basic/progresswindow.h 2017-02-24 10:21:37 +0000 | |||
1146 | +++ src/ui_basic/progresswindow.h 2017-05-13 13:15:21 +0000 | |||
1147 | @@ -63,8 +63,8 @@ | |||
1148 | 63 | private: | 63 | private: |
1149 | 64 | using VisualizationArray = std::vector<IProgressVisualization*>; | 64 | using VisualizationArray = std::vector<IProgressVisualization*>; |
1150 | 65 | 65 | ||
1153 | 66 | Vector2f label_center_; | 66 | Vector2i label_center_; |
1154 | 67 | Rectf label_rectangle_; | 67 | Recti label_rectangle_; |
1155 | 68 | VisualizationArray visualizations_; | 68 | VisualizationArray visualizations_; |
1156 | 69 | std::string background_; | 69 | std::string background_; |
1157 | 70 | 70 | ||
1158 | 71 | 71 | ||
1159 | === modified file 'src/ui_basic/scrollbar.cc' | |||
1160 | --- src/ui_basic/scrollbar.cc 2017-02-27 13:48:29 +0000 | |||
1161 | +++ src/ui_basic/scrollbar.cc 2017-05-13 13:15:21 +0000 | |||
1162 | @@ -233,7 +233,7 @@ | |||
1163 | 233 | set_scrollpos(pos); | 233 | set_scrollpos(pos); |
1164 | 234 | } | 234 | } |
1165 | 235 | 235 | ||
1167 | 236 | void Scrollbar::draw_button(RenderTarget& dst, Area area, const Rectf& r) { | 236 | void Scrollbar::draw_button(RenderTarget& dst, Area area, const Recti& r) { |
1168 | 237 | dst.tile(r.cast<int>(), pic_buttons_, Vector2i(get_x(), get_y())); | 237 | dst.tile(r.cast<int>(), pic_buttons_, Vector2i(get_x(), get_y())); |
1169 | 238 | 238 | ||
1170 | 239 | // Draw the picture | 239 | // Draw the picture |
1171 | @@ -250,7 +250,7 @@ | |||
1172 | 250 | int blit_height = image_scale * pic->height(); | 250 | int blit_height = image_scale * pic->height(); |
1173 | 251 | 251 | ||
1174 | 252 | dst.blitrect_scale( | 252 | dst.blitrect_scale( |
1176 | 253 | Rectf(r.origin() + Vector2f((r.w - blit_width) / 2.f, (r.h - blit_height) / 2.f), | 253 | Rectf(r.origin() + Vector2i((r.w - blit_width) / 2, (r.h - blit_height) / 2), |
1177 | 254 | blit_width, blit_height), | 254 | blit_width, blit_height), |
1178 | 255 | pic, Recti(0, 0, pic->width(), pic->height()), 1., BlendMode::UseAlpha); | 255 | pic, Recti(0, 0, pic->width(), pic->height()), 1., BlendMode::UseAlpha); |
1179 | 256 | } | 256 | } |
1180 | @@ -260,46 +260,46 @@ | |||
1181 | 260 | 260 | ||
1182 | 261 | if (area != pressed_) { | 261 | if (area != pressed_) { |
1183 | 262 | // top edge | 262 | // top edge |
1185 | 263 | dst.brighten_rect(Rectf(r.origin(), r.w, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 263 | dst.brighten_rect(Recti(r.origin(), r.w, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1186 | 264 | // left edge | 264 | // left edge |
1188 | 265 | dst.brighten_rect(Rectf(r.origin() + Vector2f(0, 2), 2, r.h - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 265 | dst.brighten_rect(Recti(r.origin() + Vector2i(0, 2), 2, r.h - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1189 | 266 | // bottom edge | 266 | // bottom edge |
1192 | 267 | dst.fill_rect(Rectf(r.origin() + Vector2f(2, r.h - 2), r.w - 2, 1), black); | 267 | dst.fill_rect(Recti(r.origin() + Vector2i(2, r.h - 2), r.w - 2, 1), black); |
1193 | 268 | dst.fill_rect(Rectf(r.origin() + Vector2f(1, r.h - 1), r.w - 1, 1), black); | 268 | dst.fill_rect(Recti(r.origin() + Vector2i(1, r.h - 1), r.w - 1, 1), black); |
1194 | 269 | // right edge | 269 | // right edge |
1197 | 270 | dst.fill_rect(Rectf(r.origin() + Vector2f(r.w - 2, 2), 1, r.h - 2), black); | 270 | dst.fill_rect(Recti(r.origin() + Vector2i(r.w - 2, 2), 1, r.h - 2), black); |
1198 | 271 | dst.fill_rect(Rectf(r.origin() + Vector2f(r.w - 1, 1), 1, r.h - 1), black); | 271 | dst.fill_rect(Recti(r.origin() + Vector2i(r.w - 1, 1), 1, r.h - 1), black); |
1199 | 272 | } else { | 272 | } else { |
1200 | 273 | // bottom edge | 273 | // bottom edge |
1201 | 274 | dst.brighten_rect( | 274 | dst.brighten_rect( |
1203 | 275 | Rectf(r.origin() + Vector2f(0, r.h - 2), r.w, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 275 | Recti(r.origin() + Vector2i(0, r.h - 2), r.w, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1204 | 276 | // right edge | 276 | // right edge |
1205 | 277 | dst.brighten_rect( | 277 | dst.brighten_rect( |
1207 | 278 | Rectf(r.origin() + Vector2f(r.w - 2, 0), 2, r.h - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 278 | Recti(r.origin() + Vector2i(r.w - 2, 0), 2, r.h - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1208 | 279 | // top edge | 279 | // top edge |
1211 | 280 | dst.fill_rect(Rectf(r.origin(), r.w - 1, 1), black); | 280 | dst.fill_rect(Recti(r.origin(), r.w - 1, 1), black); |
1212 | 281 | dst.fill_rect(Rectf(r.origin() + Vector2f(0, 1), r.w - 2, 1), black); | 281 | dst.fill_rect(Recti(r.origin() + Vector2i(0, 1), r.w - 2, 1), black); |
1213 | 282 | // left edge | 282 | // left edge |
1216 | 283 | dst.fill_rect(Rectf(r.origin(), 1, r.h - 1), black); | 283 | dst.fill_rect(Recti(r.origin(), 1, r.h - 1), black); |
1217 | 284 | dst.fill_rect(Rectf(r.origin() + Vector2f(1, 0), 1, r.h - 2), black); | 284 | dst.fill_rect(Recti(r.origin() + Vector2i(1, 0), 1, r.h - 2), black); |
1218 | 285 | } | 285 | } |
1219 | 286 | } | 286 | } |
1220 | 287 | 287 | ||
1222 | 288 | void Scrollbar::draw_area(RenderTarget& dst, Area area, const Rectf& r) { | 288 | void Scrollbar::draw_area(RenderTarget& dst, Area area, const Recti& r) { |
1223 | 289 | // background | 289 | // background |
1224 | 290 | dst.brighten_rect(r, area == pressed_ ? 2 * MOUSE_OVER_BRIGHT_FACTOR : MOUSE_OVER_BRIGHT_FACTOR); | 290 | dst.brighten_rect(r, area == pressed_ ? 2 * MOUSE_OVER_BRIGHT_FACTOR : MOUSE_OVER_BRIGHT_FACTOR); |
1225 | 291 | if (horizontal_) { | 291 | if (horizontal_) { |
1226 | 292 | // top edge | 292 | // top edge |
1229 | 293 | dst.brighten_rect(Rectf(r.x, r.y, r.w - 1.f, 1.f), -BUTTON_EDGE_BRIGHT_FACTOR); | 293 | dst.brighten_rect(Recti(r.x, r.y, r.w - 1, 1), -BUTTON_EDGE_BRIGHT_FACTOR); |
1230 | 294 | dst.brighten_rect(Rectf(r.x, r.y + 1.f, r.w - 2.f, 1.f), -BUTTON_EDGE_BRIGHT_FACTOR); | 294 | dst.brighten_rect(Recti(r.x, r.y + 1, r.w - 2, 1), -BUTTON_EDGE_BRIGHT_FACTOR); |
1231 | 295 | // bottom edge | 295 | // bottom edge |
1233 | 296 | dst.brighten_rect(Rectf(r.x, r.h - 2.f, r.w, 2.f), BUTTON_EDGE_BRIGHT_FACTOR); | 296 | dst.brighten_rect(Recti(r.x, r.h - 2, r.w, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1234 | 297 | } else { | 297 | } else { |
1235 | 298 | // right edge | 298 | // right edge |
1237 | 299 | dst.brighten_rect(Rectf(r.w - 2.f, r.y, 2.f, r.h), BUTTON_EDGE_BRIGHT_FACTOR); | 299 | dst.brighten_rect(Recti(r.w - 2, r.y, 2, r.h), BUTTON_EDGE_BRIGHT_FACTOR); |
1238 | 300 | // left edge | 300 | // left edge |
1241 | 301 | dst.brighten_rect(Rectf(r.x, r.y, 1.f, r.h - 1.f), -BUTTON_EDGE_BRIGHT_FACTOR); | 301 | dst.brighten_rect(Recti(r.x, r.y, 1, r.h - 1), -BUTTON_EDGE_BRIGHT_FACTOR); |
1242 | 302 | dst.brighten_rect(Rectf(r.x + 1.f, r.y, 1.f, r.h - 2.f), -BUTTON_EDGE_BRIGHT_FACTOR); | 302 | dst.brighten_rect(Recti(r.x + 1, r.y, 1, r.h - 2), -BUTTON_EDGE_BRIGHT_FACTOR); |
1243 | 303 | } | 303 | } |
1244 | 304 | } | 304 | } |
1245 | 305 | 305 | ||
1246 | @@ -317,46 +317,46 @@ | |||
1247 | 317 | if ((2 * buttonsize_ + knobsize) > static_cast<uint32_t>(get_w())) { | 317 | if ((2 * buttonsize_ + knobsize) > static_cast<uint32_t>(get_w())) { |
1248 | 318 | // Our owner allocated too little space | 318 | // Our owner allocated too little space |
1249 | 319 | if (static_cast<uint32_t>(get_w()) >= 2 * buttonsize_) { | 319 | if (static_cast<uint32_t>(get_w()) >= 2 * buttonsize_) { |
1252 | 320 | draw_button(dst, Minus, Rectf(0, 0, get_w() / 2, get_h())); | 320 | draw_button(dst, Minus, Recti(0, 0, get_w() / 2, get_h())); |
1253 | 321 | draw_button(dst, Plus, Rectf(get_w() - buttonsize_, 0, get_w() / 2, get_h())); | 321 | draw_button(dst, Plus, Recti(get_w() - buttonsize_, 0, get_w() / 2, get_h())); |
1254 | 322 | } else { | 322 | } else { |
1256 | 323 | draw_button(dst, Minus, Rectf(0.f, 0.f, get_w(), get_h())); | 323 | draw_button(dst, Minus, Recti(0, 0, get_w(), get_h())); |
1257 | 324 | } | 324 | } |
1258 | 325 | return; | 325 | return; |
1259 | 326 | } | 326 | } |
1260 | 327 | 327 | ||
1264 | 328 | draw_button(dst, Minus, Rectf(0, 0, buttonsize_, get_h())); | 328 | draw_button(dst, Minus, Recti(0, 0, buttonsize_, get_h())); |
1265 | 329 | draw_button(dst, Plus, Rectf(get_w() - buttonsize_, 0, buttonsize_, get_h())); | 329 | draw_button(dst, Plus, Recti(get_w() - buttonsize_, 0, buttonsize_, get_h())); |
1266 | 330 | draw_button(dst, Knob, Rectf(knobpos - knobsize / 2.f, 0, knobsize, get_h())); | 330 | draw_button(dst, Knob, Recti(knobpos - knobsize / 2, 0, knobsize, get_h())); |
1267 | 331 | 331 | ||
1268 | 332 | assert(buttonsize_ + knobsize / 2 <= knobpos); | 332 | assert(buttonsize_ + knobsize / 2 <= knobpos); |
1269 | 333 | draw_area( | 333 | draw_area( |
1271 | 334 | dst, MinusPage, Rectf(buttonsize_, 0, knobpos - buttonsize_ - knobsize / 2, get_h())); | 334 | dst, MinusPage, Recti(buttonsize_, 0, knobpos - buttonsize_ - knobsize / 2, get_h())); |
1272 | 335 | assert(knobpos + knobsize / 2 + buttonsize_ <= static_cast<uint32_t>(get_w())); | 335 | assert(knobpos + knobsize / 2 + buttonsize_ <= static_cast<uint32_t>(get_w())); |
1274 | 336 | draw_area(dst, PlusPage, Rectf(knobpos + knobsize / 2.f, 0.f, | 336 | draw_area(dst, PlusPage, Recti(knobpos + knobsize / 2, 0, |
1275 | 337 | get_w() - knobpos - knobsize / 2 - buttonsize_, get_h())); | 337 | get_w() - knobpos - knobsize / 2 - buttonsize_, get_h())); |
1276 | 338 | } else { | 338 | } else { |
1277 | 339 | if ((2 * buttonsize_ + knobsize) > static_cast<uint32_t>(get_h())) { | 339 | if ((2 * buttonsize_ + knobsize) > static_cast<uint32_t>(get_h())) { |
1278 | 340 | // Our owner allocated too little space | 340 | // Our owner allocated too little space |
1279 | 341 | if (static_cast<uint32_t>(get_h()) >= 2 * buttonsize_) { | 341 | if (static_cast<uint32_t>(get_h()) >= 2 * buttonsize_) { |
1282 | 342 | draw_button(dst, Minus, Rectf(0.f, 0.f, get_w(), get_h() / 2.f)); | 342 | draw_button(dst, Minus, Recti(0, 0, get_w(), get_h() / 2)); |
1283 | 343 | draw_button(dst, Plus, Rectf(0.f, get_h() - buttonsize_, get_w(), get_h() / 2)); | 343 | draw_button(dst, Plus, Recti(0, get_h() - buttonsize_, get_w(), get_h() / 2)); |
1284 | 344 | } else { | 344 | } else { |
1286 | 345 | draw_button(dst, Minus, Rectf(0.f, 0.f, get_w(), get_h())); | 345 | draw_button(dst, Minus, Recti(0, 0, get_w(), get_h())); |
1287 | 346 | } | 346 | } |
1288 | 347 | return; | 347 | return; |
1289 | 348 | } | 348 | } |
1290 | 349 | 349 | ||
1294 | 350 | draw_button(dst, Minus, Rectf(0, 0, get_w(), buttonsize_)); | 350 | draw_button(dst, Minus, Recti(0, 0, get_w(), buttonsize_)); |
1295 | 351 | draw_button(dst, Plus, Rectf(0, get_h() - buttonsize_, get_w(), buttonsize_)); | 351 | draw_button(dst, Plus, Recti(0, get_h() - buttonsize_, get_w(), buttonsize_)); |
1296 | 352 | draw_button(dst, Knob, Rectf(0, knobpos - knobsize / 2.f, get_w(), knobsize)); | 352 | draw_button(dst, Knob, Recti(0, knobpos - knobsize / 2, get_w(), knobsize)); |
1297 | 353 | 353 | ||
1298 | 354 | assert(buttonsize_ + knobsize / 2 <= knobpos); | 354 | assert(buttonsize_ + knobsize / 2 <= knobpos); |
1299 | 355 | draw_area( | 355 | draw_area( |
1301 | 356 | dst, MinusPage, Rectf(0.f, buttonsize_, get_w(), knobpos - buttonsize_ - knobsize / 2)); | 356 | dst, MinusPage, Recti(0, buttonsize_, get_w(), knobpos - buttonsize_ - knobsize / 2)); |
1302 | 357 | assert(knobpos + knobsize / 2 + buttonsize_ <= static_cast<uint32_t>(get_h())); | 357 | assert(knobpos + knobsize / 2 + buttonsize_ <= static_cast<uint32_t>(get_h())); |
1305 | 358 | draw_area(dst, PlusPage, Rectf(0.f, knobpos + knobsize / 2.f, get_w(), | 358 | draw_area(dst, PlusPage, Recti(0, knobpos + knobsize / 2, get_w(), |
1306 | 359 | get_h() - knobpos - knobsize / 2.f - buttonsize_)); | 359 | get_h() - knobpos - knobsize / 2 - buttonsize_)); |
1307 | 360 | } | 360 | } |
1308 | 361 | } | 361 | } |
1309 | 362 | 362 | ||
1310 | 363 | 363 | ||
1311 | === modified file 'src/ui_basic/scrollbar.h' | |||
1312 | --- src/ui_basic/scrollbar.h 2017-01-25 18:55:59 +0000 | |||
1313 | +++ src/ui_basic/scrollbar.h 2017-05-13 13:15:21 +0000 | |||
1314 | @@ -82,8 +82,8 @@ | |||
1315 | 82 | 82 | ||
1316 | 83 | void action(Area area); | 83 | void action(Area area); |
1317 | 84 | 84 | ||
1320 | 85 | void draw_button(RenderTarget&, Area, const Rectf&); | 85 | void draw_button(RenderTarget&, Area, const Recti&); |
1321 | 86 | void draw_area(RenderTarget& dst, Area area, const Rectf& r); | 86 | void draw_area(RenderTarget& dst, Area area, const Recti& r); |
1322 | 87 | void draw(RenderTarget&) override; | 87 | void draw(RenderTarget&) override; |
1323 | 88 | void think() override; | 88 | void think() override; |
1324 | 89 | 89 | ||
1325 | 90 | 90 | ||
1326 | === modified file 'src/ui_basic/slider.cc' | |||
1327 | --- src/ui_basic/slider.cc 2017-02-24 19:22:36 +0000 | |||
1328 | +++ src/ui_basic/slider.cc 2017-05-13 13:15:21 +0000 | |||
1329 | @@ -152,34 +152,34 @@ | |||
1330 | 152 | (Recti(Vector2i(x, y), w, h), pic_background_, Vector2i(get_x(), get_y())); | 152 | (Recti(Vector2i(x, y), w, h), pic_background_, Vector2i(get_x(), get_y())); |
1331 | 153 | 153 | ||
1332 | 154 | if (highlighted_) | 154 | if (highlighted_) |
1334 | 155 | dst.brighten_rect(Rectf(x, y, w, h), MOUSE_OVER_BRIGHT_FACTOR); | 155 | dst.brighten_rect(Recti(x, y, w, h), MOUSE_OVER_BRIGHT_FACTOR); |
1335 | 156 | 156 | ||
1336 | 157 | if (pressed_) { // draw border | 157 | if (pressed_) { // draw border |
1337 | 158 | dst.brighten_rect // bottom edge | 158 | dst.brighten_rect // bottom edge |
1339 | 159 | (Rectf(x, y + h - 2, w, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 159 | (Recti(x, y + h - 2, w, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1340 | 160 | dst.brighten_rect // right edge | 160 | dst.brighten_rect // right edge |
1342 | 161 | (Rectf(x + w - 2, y, 2, h - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 161 | (Recti(x + w - 2, y, 2, h - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1343 | 162 | 162 | ||
1344 | 163 | // top edge | 163 | // top edge |
1347 | 164 | dst.fill_rect(Rectf(x, y, w - 1, 1), black); | 164 | dst.fill_rect(Recti(x, y, w - 1, 1), black); |
1348 | 165 | dst.fill_rect(Rectf(x, y + 1, w - 2, 1), black); | 165 | dst.fill_rect(Recti(x, y + 1, w - 2, 1), black); |
1349 | 166 | 166 | ||
1350 | 167 | // left edge | 167 | // left edge |
1353 | 168 | dst.fill_rect(Rectf(x, y, 1, h - 1), black); | 168 | dst.fill_rect(Recti(x, y, 1, h - 1), black); |
1354 | 169 | dst.fill_rect(Rectf(x + 1, y, 1, h - 2), black); | 169 | dst.fill_rect(Recti(x + 1, y, 1, h - 2), black); |
1355 | 170 | } else { | 170 | } else { |
1356 | 171 | dst.brighten_rect // top edge | 171 | dst.brighten_rect // top edge |
1358 | 172 | (Rectf(x, y, w, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 172 | (Recti(x, y, w, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1359 | 173 | dst.brighten_rect // left edge | 173 | dst.brighten_rect // left edge |
1361 | 174 | (Rectf(x, y + 2, 2, h - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 174 | (Recti(x, y + 2, 2, h - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1362 | 175 | 175 | ||
1363 | 176 | // bottom edge | 176 | // bottom edge |
1366 | 177 | dst.fill_rect(Rectf(x + 2, y + h - 2, w - 2, 1), black); | 177 | dst.fill_rect(Recti(x + 2, y + h - 2, w - 2, 1), black); |
1367 | 178 | dst.fill_rect(Rectf(x + 1, y + h - 1, w - 1, 1), black); | 178 | dst.fill_rect(Recti(x + 1, y + h - 1, w - 1, 1), black); |
1368 | 179 | 179 | ||
1369 | 180 | // right edge | 180 | // right edge |
1372 | 181 | dst.fill_rect(Rectf(x + w - 2, y + 2, 1, h - 2), black); | 181 | dst.fill_rect(Recti(x + w - 2, y + 2, 1, h - 2), black); |
1373 | 182 | dst.fill_rect(Rectf(x + w - 1, y + 1, 1, h - 1), black); | 182 | dst.fill_rect(Recti(x + w - 1, y + 1, 1, h - 1), black); |
1374 | 183 | } | 183 | } |
1375 | 184 | } | 184 | } |
1376 | 185 | 185 | ||
1377 | @@ -362,18 +362,18 @@ | |||
1378 | 362 | 362 | ||
1379 | 363 | if (get_bar_size() > 0) { | 363 | if (get_bar_size() > 0) { |
1380 | 364 | dst.brighten_rect // bottom edge | 364 | dst.brighten_rect // bottom edge |
1382 | 365 | (Rectf(get_x_gap(), get_h() / 2.f, get_bar_size(), 2), BUTTON_EDGE_BRIGHT_FACTOR); | 365 | (Recti(get_x_gap(), get_h() / 2, get_bar_size(), 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1383 | 366 | dst.brighten_rect // right edge | 366 | dst.brighten_rect // right edge |
1385 | 367 | (Rectf(get_x_gap() + get_bar_size() - 2, get_y_gap(), 2, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 367 | (Recti(get_x_gap() + get_bar_size() - 2, get_y_gap(), 2, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1386 | 368 | 368 | ||
1387 | 369 | // top edge | 369 | // top edge |
1390 | 370 | dst.fill_rect(Rectf(get_x_gap(), get_y_gap(), get_bar_size() - 1, 1), black); | 370 | dst.fill_rect(Recti(get_x_gap(), get_y_gap(), get_bar_size() - 1, 1), black); |
1391 | 371 | dst.fill_rect(Rectf(get_x_gap(), get_y_gap() + 1, get_bar_size() - 2, 1), black); | 371 | dst.fill_rect(Recti(get_x_gap(), get_y_gap() + 1, get_bar_size() - 2, 1), black); |
1392 | 372 | } | 372 | } |
1393 | 373 | 373 | ||
1394 | 374 | // left edge | 374 | // left edge |
1397 | 375 | dst.fill_rect(Rectf(get_x_gap(), get_y_gap(), 1, 4), black); | 375 | dst.fill_rect(Recti(get_x_gap(), get_y_gap(), 1, 4), black); |
1398 | 376 | dst.fill_rect(Rectf(get_x_gap() + 1, get_y_gap(), 1, 3), black); | 376 | dst.fill_rect(Recti(get_x_gap() + 1, get_y_gap(), 1, 3), black); |
1399 | 377 | 377 | ||
1400 | 378 | draw_cursor(dst, cursor_pos_, 0, cursor_size_, get_h()); | 378 | draw_cursor(dst, cursor_pos_, 0, cursor_size_, get_h()); |
1401 | 379 | } | 379 | } |
1402 | @@ -435,17 +435,17 @@ | |||
1403 | 435 | RGBAColor black(0, 0, 0, 255); | 435 | RGBAColor black(0, 0, 0, 255); |
1404 | 436 | 436 | ||
1405 | 437 | dst.brighten_rect // right edge | 437 | dst.brighten_rect // right edge |
1407 | 438 | (Rectf(get_w() / 2.f, get_y_gap(), 2, get_bar_size()), BUTTON_EDGE_BRIGHT_FACTOR); | 438 | (Recti(get_w() / 2, get_y_gap(), 2, get_bar_size()), BUTTON_EDGE_BRIGHT_FACTOR); |
1408 | 439 | dst.brighten_rect // bottom edge | 439 | dst.brighten_rect // bottom edge |
1410 | 440 | (Rectf(get_x_gap(), get_y_gap() + get_bar_size() - 2, 2, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 440 | (Recti(get_x_gap(), get_y_gap() + get_bar_size() - 2, 2, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1411 | 441 | 441 | ||
1412 | 442 | // left edge | 442 | // left edge |
1415 | 443 | dst.fill_rect(Rectf(get_x_gap(), get_y_gap(), 1, get_bar_size() - 1), black); | 443 | dst.fill_rect(Recti(get_x_gap(), get_y_gap(), 1, get_bar_size() - 1), black); |
1416 | 444 | dst.fill_rect(Rectf(get_x_gap() + 1, get_y_gap(), 1, get_bar_size() - 2), black); | 444 | dst.fill_rect(Recti(get_x_gap() + 1, get_y_gap(), 1, get_bar_size() - 2), black); |
1417 | 445 | 445 | ||
1418 | 446 | // top edge | 446 | // top edge |
1421 | 447 | dst.fill_rect(Rectf(get_x_gap(), get_y_gap(), 4, 1), black); | 447 | dst.fill_rect(Recti(get_x_gap(), get_y_gap(), 4, 1), black); |
1422 | 448 | dst.fill_rect(Rectf(get_x_gap(), get_y_gap() + 1, 3, 1), black); | 448 | dst.fill_rect(Recti(get_x_gap(), get_y_gap() + 1, 3, 1), black); |
1423 | 449 | 449 | ||
1424 | 450 | draw_cursor(dst, 0, cursor_pos_, get_w(), cursor_size_); | 450 | draw_cursor(dst, 0, cursor_pos_, get_w(), cursor_size_); |
1425 | 451 | } | 451 | } |
1426 | @@ -540,8 +540,9 @@ | |||
1427 | 540 | for (uint32_t i = 0; i < labels.size(); i++) { | 540 | for (uint32_t i = 0; i < labels.size(); i++) { |
1428 | 541 | const Image* rendered_text = | 541 | const Image* rendered_text = |
1429 | 542 | UI::g_fh1->render(as_condensed(labels[i], UI::Align::kCenter, UI_FONT_SIZE_SMALL - 2)); | 542 | UI::g_fh1->render(as_condensed(labels[i], UI::Align::kCenter, UI_FONT_SIZE_SMALL - 2)); |
1432 | 543 | dst.blit(Vector2f(gap_1 + i * gap_n, get_h() - rendered_text->height()), rendered_text, | 543 | Vector2i point(gap_1 + i * gap_n, get_h() - rendered_text->height()); |
1433 | 544 | BlendMode::UseAlpha, UI::Align::kCenter); | 544 | UI::correct_for_align(UI::Align::kCenter, rendered_text->width(), &point); |
1434 | 545 | dst.blit(point, rendered_text, BlendMode::UseAlpha); | ||
1435 | 545 | } | 546 | } |
1436 | 546 | } | 547 | } |
1437 | 547 | 548 | ||
1438 | 548 | 549 | ||
1439 | === modified file 'src/ui_basic/table.cc' | |||
1440 | --- src/ui_basic/table.cc 2017-04-25 08:10:11 +0000 | |||
1441 | +++ src/ui_basic/table.cc 2017-05-13 13:15:21 +0000 | |||
1442 | @@ -220,7 +220,7 @@ | |||
1443 | 220 | uint32_t idx = scrollpos_ / lineheight; | 220 | uint32_t idx = scrollpos_ / lineheight; |
1444 | 221 | int32_t y = 1 + idx * lineheight - scrollpos_ + headerheight_; | 221 | int32_t y = 1 + idx * lineheight - scrollpos_ + headerheight_; |
1445 | 222 | 222 | ||
1447 | 223 | dst.brighten_rect(Rectf(0.f, 0.f, get_eff_w(), get_h()), ms_darken_value); | 223 | dst.brighten_rect(Recti(0, 0, get_eff_w(), get_h()), ms_darken_value); |
1448 | 224 | 224 | ||
1449 | 225 | while (idx < entry_records_.size()) { | 225 | while (idx < entry_records_.size()) { |
1450 | 226 | if (y >= static_cast<int32_t>(get_h())) | 226 | if (y >= static_cast<int32_t>(get_h())) |
1451 | @@ -230,7 +230,7 @@ | |||
1452 | 230 | 230 | ||
1453 | 231 | if (idx == selection_ || multiselect_.count(idx)) { | 231 | if (idx == selection_ || multiselect_.count(idx)) { |
1454 | 232 | assert(2 <= get_eff_w()); | 232 | assert(2 <= get_eff_w()); |
1456 | 233 | dst.brighten_rect(Rectf(1.f, y, get_eff_w() - 2, lineheight_), -ms_darken_value); | 233 | dst.brighten_rect(Recti(1, y, get_eff_w() - 2, lineheight_), -ms_darken_value); |
1457 | 234 | } | 234 | } |
1458 | 235 | 235 | ||
1459 | 236 | Columns::size_type const nr_columns = columns_.size(); | 236 | Columns::size_type const nr_columns = columns_.size(); |
1460 | @@ -242,14 +242,14 @@ | |||
1461 | 242 | const Image* entry_picture = er.get_picture(i); | 242 | const Image* entry_picture = er.get_picture(i); |
1462 | 243 | const std::string& entry_string = er.get_string(i); | 243 | const std::string& entry_string = er.get_string(i); |
1463 | 244 | 244 | ||
1465 | 245 | Vector2f point(curx, y); | 245 | Vector2i point(curx, y); |
1466 | 246 | int picw = 0; | 246 | int picw = 0; |
1467 | 247 | 247 | ||
1468 | 248 | if (entry_picture != nullptr) { | 248 | if (entry_picture != nullptr) { |
1469 | 249 | picw = entry_picture->width(); | 249 | picw = entry_picture->width(); |
1470 | 250 | const int pich = entry_picture->height(); | 250 | const int pich = entry_picture->height(); |
1471 | 251 | 251 | ||
1473 | 252 | float draw_x = point.x; | 252 | int draw_x = point.x; |
1474 | 253 | 253 | ||
1475 | 254 | // We want a bit of margin | 254 | // We want a bit of margin |
1476 | 255 | int max_pic_height = lineheight - 3; | 255 | int max_pic_height = lineheight - 3; |
1477 | @@ -263,7 +263,7 @@ | |||
1478 | 263 | if (i == nr_columns - 1 && scrollbar_->is_enabled()) { | 263 | if (i == nr_columns - 1 && scrollbar_->is_enabled()) { |
1479 | 264 | draw_x = point.x + (curw - blit_width - scrollbar_->get_w()) / 2.f; | 264 | draw_x = point.x + (curw - blit_width - scrollbar_->get_w()) / 2.f; |
1480 | 265 | } else { | 265 | } else { |
1482 | 266 | draw_x = point.x + (curw - blit_width) / 2.f; | 266 | draw_x = point.x + (curw - blit_width) / 2; |
1483 | 267 | } | 267 | } |
1484 | 268 | } | 268 | } |
1485 | 269 | 269 | ||
1486 | @@ -272,7 +272,7 @@ | |||
1487 | 272 | } | 272 | } |
1488 | 273 | 273 | ||
1489 | 274 | // Create the scaled image | 274 | // Create the scaled image |
1491 | 275 | dst.blitrect_scale(Rectf(draw_x, point.y + 1.f, blit_width, max_pic_height), | 275 | dst.blitrect_scale(Rectf(draw_x, point.y + 1, blit_width, max_pic_height), |
1492 | 276 | entry_picture, Recti(0, 0, picw, pich), 1., BlendMode::UseAlpha); | 276 | entry_picture, Recti(0, 0, picw, pich), 1., BlendMode::UseAlpha); |
1493 | 277 | 277 | ||
1494 | 278 | // For text alignment below | 278 | // For text alignment below |
1495 | @@ -282,12 +282,12 @@ | |||
1496 | 282 | if (i == nr_columns - 1 && scrollbar_->is_enabled()) { | 282 | if (i == nr_columns - 1 && scrollbar_->is_enabled()) { |
1497 | 283 | draw_x = point.x + (curw - picw - scrollbar_->get_w()) / 2.f; | 283 | draw_x = point.x + (curw - picw - scrollbar_->get_w()) / 2.f; |
1498 | 284 | } else { | 284 | } else { |
1500 | 285 | draw_x = point.x + (curw - picw) / 2.f; | 285 | draw_x = point.x + (curw - picw) / 2; |
1501 | 286 | } | 286 | } |
1502 | 287 | } else if (alignment == UI::Align::kRight) { | 287 | } else if (alignment == UI::Align::kRight) { |
1503 | 288 | draw_x += curw - picw; | 288 | draw_x += curw - picw; |
1504 | 289 | } | 289 | } |
1506 | 290 | dst.blit(Vector2f(draw_x, point.y + (lineheight - pich) / 2.f), entry_picture); | 290 | dst.blit(Vector2i(draw_x, point.y + (lineheight - pich) / 2), entry_picture); |
1507 | 291 | } | 291 | } |
1508 | 292 | point.x += picw; | 292 | point.x += picw; |
1509 | 293 | } | 293 | } |
1510 | 294 | 294 | ||
1511 | === modified file 'src/ui_basic/tabpanel.cc' | |||
1512 | --- src/ui_basic/tabpanel.cc 2017-03-04 09:14:37 +0000 | |||
1513 | +++ src/ui_basic/tabpanel.cc 2017-05-13 13:15:21 +0000 | |||
1514 | @@ -259,7 +259,7 @@ | |||
1515 | 259 | 259 | ||
1516 | 260 | if (pic_background_) { | 260 | if (pic_background_) { |
1517 | 261 | if (!tabs_.empty()) { | 261 | if (!tabs_.empty()) { |
1519 | 262 | dst.tile(Recti(Vector2i(0, 0), tabs_.back()->get_x() + tabs_.back()->get_w(), | 262 | dst.tile(Recti(Vector2i::zero(), tabs_.back()->get_x() + tabs_.back()->get_w(), |
1520 | 263 | kTabPanelButtonHeight - 2), | 263 | kTabPanelButtonHeight - 2), |
1521 | 264 | pic_background_, Vector2i(get_x(), get_y())); | 264 | pic_background_, Vector2i(get_x(), get_y())); |
1522 | 265 | } | 265 | } |
1523 | @@ -279,7 +279,7 @@ | |||
1524 | 279 | tab_width = tabs_[idx]->get_w(); | 279 | tab_width = tabs_[idx]->get_w(); |
1525 | 280 | 280 | ||
1526 | 281 | if (highlight_ == idx) { | 281 | if (highlight_ == idx) { |
1528 | 282 | dst.brighten_rect(Rectf(x, 0, tab_width, kTabPanelButtonHeight), MOUSE_OVER_BRIGHT_FACTOR); | 282 | dst.brighten_rect(Recti(x, 0, tab_width, kTabPanelButtonHeight), MOUSE_OVER_BRIGHT_FACTOR); |
1529 | 283 | } | 283 | } |
1530 | 284 | 284 | ||
1531 | 285 | assert(tabs_[idx]->pic); | 285 | assert(tabs_[idx]->pic); |
1532 | @@ -300,46 +300,46 @@ | |||
1533 | 300 | tabs_[idx]->pic, Recti(0, 0, tabs_[idx]->pic->width(), tabs_[idx]->pic->height()), 1, | 300 | tabs_[idx]->pic, Recti(0, 0, tabs_[idx]->pic->width(), tabs_[idx]->pic->height()), 1, |
1534 | 301 | BlendMode::UseAlpha); | 301 | BlendMode::UseAlpha); |
1535 | 302 | } else { | 302 | } else { |
1537 | 303 | dst.blit(Vector2f(x + kTabPanelTextMargin, | 303 | dst.blit(Vector2i(x + kTabPanelTextMargin, |
1538 | 304 | (kTabPanelButtonHeight - tabs_[idx]->pic->height()) / 2), | 304 | (kTabPanelButtonHeight - tabs_[idx]->pic->height()) / 2), |
1540 | 305 | tabs_[idx]->pic, BlendMode::UseAlpha, UI::Align::kLeft); | 305 | tabs_[idx]->pic, BlendMode::UseAlpha); |
1541 | 306 | } | 306 | } |
1542 | 307 | 307 | ||
1543 | 308 | // Draw top part of border | 308 | // Draw top part of border |
1548 | 309 | dst.brighten_rect(Rectf(x, 0, tab_width, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 309 | dst.brighten_rect(Recti(x, 0, tab_width, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1549 | 310 | dst.brighten_rect(Rectf(x, 2, 2, kTabPanelButtonHeight - 4), BUTTON_EDGE_BRIGHT_FACTOR); | 310 | dst.brighten_rect(Recti(x, 2, 2, kTabPanelButtonHeight - 4), BUTTON_EDGE_BRIGHT_FACTOR); |
1550 | 311 | dst.fill_rect(Rectf(x + tab_width - 2, 2, 1, kTabPanelButtonHeight - 4), black); | 311 | dst.fill_rect(Recti(x + tab_width - 2, 2, 1, kTabPanelButtonHeight - 4), black); |
1551 | 312 | dst.fill_rect(Rectf(x + tab_width - 1, 1, 1, kTabPanelButtonHeight - 3), black); | 312 | dst.fill_rect(Recti(x + tab_width - 1, 1, 1, kTabPanelButtonHeight - 3), black); |
1552 | 313 | 313 | ||
1553 | 314 | // Draw bottom part | 314 | // Draw bottom part |
1554 | 315 | if (active_ != idx) | 315 | if (active_ != idx) |
1555 | 316 | dst.brighten_rect( | 316 | dst.brighten_rect( |
1557 | 317 | Rectf(x, kTabPanelButtonHeight - 2, tab_width, 2), 2 * BUTTON_EDGE_BRIGHT_FACTOR); | 317 | Recti(x, kTabPanelButtonHeight - 2, tab_width, 2), 2 * BUTTON_EDGE_BRIGHT_FACTOR); |
1558 | 318 | else { | 318 | else { |
1560 | 319 | dst.brighten_rect(Rectf(x, kTabPanelButtonHeight - 2, 2, 2), BUTTON_EDGE_BRIGHT_FACTOR); | 319 | dst.brighten_rect(Recti(x, kTabPanelButtonHeight - 2, 2, 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1561 | 320 | 320 | ||
1563 | 321 | dst.brighten_rect(Rectf(x + tab_width - 2, kTabPanelButtonHeight - 2, 2, 2), | 321 | dst.brighten_rect(Recti(x + tab_width - 2, kTabPanelButtonHeight - 2, 2, 2), |
1564 | 322 | 2 * BUTTON_EDGE_BRIGHT_FACTOR); | 322 | 2 * BUTTON_EDGE_BRIGHT_FACTOR); |
1567 | 323 | dst.fill_rect(Rectf(x + tab_width - 2, kTabPanelButtonHeight - 1, 1, 1), black); | 323 | dst.fill_rect(Recti(x + tab_width - 2, kTabPanelButtonHeight - 1, 1, 1), black); |
1568 | 324 | dst.fill_rect(Rectf(x + tab_width - 2, kTabPanelButtonHeight - 2, 2, 1), black); | 324 | dst.fill_rect(Recti(x + tab_width - 2, kTabPanelButtonHeight - 2, 2, 1), black); |
1569 | 325 | } | 325 | } |
1570 | 326 | } | 326 | } |
1571 | 327 | 327 | ||
1572 | 328 | // draw the remaining separator | 328 | // draw the remaining separator |
1573 | 329 | assert(x <= get_w()); | 329 | assert(x <= get_w()); |
1575 | 330 | dst.brighten_rect(Rectf(x + tab_width, kTabPanelButtonHeight - 2, get_w() - x, 2), | 330 | dst.brighten_rect(Recti(x + tab_width, kTabPanelButtonHeight - 2, get_w() - x, 2), |
1576 | 331 | 2 * BUTTON_EDGE_BRIGHT_FACTOR); | 331 | 2 * BUTTON_EDGE_BRIGHT_FACTOR); |
1577 | 332 | 332 | ||
1578 | 333 | // Draw border around the main panel | 333 | // Draw border around the main panel |
1579 | 334 | if (border_type_ == TabPanel::Type::kBorder) { | 334 | if (border_type_ == TabPanel::Type::kBorder) { |
1580 | 335 | // left edge | 335 | // left edge |
1582 | 336 | dst.brighten_rect(Rectf(0, kTabPanelButtonHeight, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); | 336 | dst.brighten_rect(Recti(0, kTabPanelButtonHeight, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR); |
1583 | 337 | // bottom edge | 337 | // bottom edge |
1586 | 338 | dst.fill_rect(Rectf(2, get_h() - 2, get_w() - 2, 1), black); | 338 | dst.fill_rect(Recti(2, get_h() - 2, get_w() - 2, 1), black); |
1587 | 339 | dst.fill_rect(Rectf(1, get_h() - 1, get_w() - 1, 1), black); | 339 | dst.fill_rect(Recti(1, get_h() - 1, get_w() - 1, 1), black); |
1588 | 340 | // right edge | 340 | // right edge |
1591 | 341 | dst.fill_rect(Rectf(get_w() - 2, kTabPanelButtonHeight - 1, 1, get_h() - 2), black); | 341 | dst.fill_rect(Recti(get_w() - 2, kTabPanelButtonHeight - 1, 1, get_h() - 2), black); |
1592 | 342 | dst.fill_rect(Rectf(get_w() - 1, kTabPanelButtonHeight - 2, 1, get_h() - 1), black); | 342 | dst.fill_rect(Recti(get_w() - 1, kTabPanelButtonHeight - 2, 1, get_h() - 1), black); |
1593 | 343 | } | 343 | } |
1594 | 344 | } | 344 | } |
1595 | 345 | 345 | ||
1596 | 346 | 346 | ||
1597 | === modified file 'src/ui_basic/textarea.cc' | |||
1598 | --- src/ui_basic/textarea.cc 2017-02-27 13:48:29 +0000 | |||
1599 | +++ src/ui_basic/textarea.cc 2017-05-13 13:15:21 +0000 | |||
1600 | @@ -125,10 +125,10 @@ | |||
1601 | 125 | */ | 125 | */ |
1602 | 126 | void Textarea::draw(RenderTarget& dst) { | 126 | void Textarea::draw(RenderTarget& dst) { |
1603 | 127 | if (!text_.empty()) { | 127 | if (!text_.empty()) { |
1606 | 128 | // Blit on pixel boundary (not float), so that the text is blitted pixel perfect. | 128 | Vector2i anchor( |
1605 | 129 | Vector2f anchor( | ||
1607 | 130 | (align_ == Align::kCenter) ? get_w() / 2 : (align_ == UI::Align::kRight) ? get_w() : 0, 0); | 129 | (align_ == Align::kCenter) ? get_w() / 2 : (align_ == UI::Align::kRight) ? get_w() : 0, 0); |
1609 | 131 | dst.blit(anchor, rendered_text_, BlendMode::UseAlpha, align_); | 130 | UI::correct_for_align(align_, rendered_text_->width(), &anchor); |
1610 | 131 | dst.blit(anchor, rendered_text_, BlendMode::UseAlpha); | ||
1611 | 132 | } | 132 | } |
1612 | 133 | } | 133 | } |
1613 | 134 | 134 | ||
1614 | 135 | 135 | ||
1615 | === modified file 'src/ui_basic/window.cc' | |||
1616 | --- src/ui_basic/window.cc 2017-02-27 13:48:29 +0000 | |||
1617 | +++ src/ui_basic/window.cc 2017-05-13 13:15:21 +0000 | |||
1618 | @@ -141,7 +141,7 @@ | |||
1619 | 141 | */ | 141 | */ |
1620 | 142 | void Window::layout() { | 142 | void Window::layout() { |
1621 | 143 | if (center_panel_ && !is_minimal_) { | 143 | if (center_panel_ && !is_minimal_) { |
1623 | 144 | center_panel_->set_pos(Vector2i(0, 0)); | 144 | center_panel_->set_pos(Vector2i::zero()); |
1624 | 145 | center_panel_->set_size(get_inner_w(), get_inner_h()); | 145 | center_panel_->set_size(get_inner_w(), get_inner_h()); |
1625 | 146 | } | 146 | } |
1626 | 147 | } | 147 | } |
1627 | @@ -235,7 +235,7 @@ | |||
1628 | 235 | void Window::draw(RenderTarget& dst) { | 235 | void Window::draw(RenderTarget& dst) { |
1629 | 236 | if (!is_minimal()) { | 236 | if (!is_minimal()) { |
1630 | 237 | dst.tile( | 237 | dst.tile( |
1632 | 238 | Recti(Vector2i(0, 0), get_inner_w(), get_inner_h()), pic_background_, Vector2i(0, 0)); | 238 | Recti(Vector2i::zero(), get_inner_w(), get_inner_h()), pic_background_, Vector2i::zero()); |
1633 | 239 | } | 239 | } |
1634 | 240 | } | 240 | } |
1635 | 241 | 241 | ||
1636 | @@ -253,19 +253,19 @@ | |||
1637 | 253 | int32_t pos = HZ_B_CORNER_PIXMAP_LEN; | 253 | int32_t pos = HZ_B_CORNER_PIXMAP_LEN; |
1638 | 254 | 254 | ||
1639 | 255 | dst.blitrect // top left corner | 255 | dst.blitrect // top left corner |
1641 | 256 | (Vector2f(0.f, 0.f), pic_top_, Recti(Vector2i(0, 0), pos, TP_B_PIXMAP_THICKNESS)); | 256 | (Vector2i::zero(), pic_top_, Recti(Vector2i::zero(), pos, TP_B_PIXMAP_THICKNESS)); |
1642 | 257 | 257 | ||
1643 | 258 | // top bar | 258 | // top bar |
1644 | 259 | static_assert(0 <= HZ_B_CORNER_PIXMAP_LEN, "assert(0 <= HZ_B_CORNER_PIXMAP_LEN) failed."); | 259 | static_assert(0 <= HZ_B_CORNER_PIXMAP_LEN, "assert(0 <= HZ_B_CORNER_PIXMAP_LEN) failed."); |
1645 | 260 | for (; pos < hz_bar_end_minus_middle; pos += HZ_B_MIDDLE_PIXMAP_LEN) | 260 | for (; pos < hz_bar_end_minus_middle; pos += HZ_B_MIDDLE_PIXMAP_LEN) |
1646 | 261 | dst.blitrect( | 261 | dst.blitrect( |
1648 | 262 | Vector2f(pos, 0), pic_top_, Recti(Vector2i(HZ_B_CORNER_PIXMAP_LEN, 0), | 262 | Vector2i(pos, 0), pic_top_, Recti(Vector2i(HZ_B_CORNER_PIXMAP_LEN, 0), |
1649 | 263 | HZ_B_MIDDLE_PIXMAP_LEN, TP_B_PIXMAP_THICKNESS)); | 263 | HZ_B_MIDDLE_PIXMAP_LEN, TP_B_PIXMAP_THICKNESS)); |
1650 | 264 | 264 | ||
1651 | 265 | // odd pixels of top bar and top right corner | 265 | // odd pixels of top bar and top right corner |
1652 | 266 | const int32_t width = hz_bar_end - pos + HZ_B_CORNER_PIXMAP_LEN; | 266 | const int32_t width = hz_bar_end - pos + HZ_B_CORNER_PIXMAP_LEN; |
1653 | 267 | assert(0 <= HZ_B_TOTAL_PIXMAP_LEN - width); | 267 | assert(0 <= HZ_B_TOTAL_PIXMAP_LEN - width); |
1655 | 268 | dst.blitrect(Vector2f(pos, 0), pic_top_, | 268 | dst.blitrect(Vector2i(pos, 0), pic_top_, |
1656 | 269 | Recti(Vector2i(HZ_B_TOTAL_PIXMAP_LEN - width, 0), width, TP_B_PIXMAP_THICKNESS)); | 269 | Recti(Vector2i(HZ_B_TOTAL_PIXMAP_LEN - width, 0), width, TP_B_PIXMAP_THICKNESS)); |
1657 | 270 | } | 270 | } |
1658 | 271 | 271 | ||
1659 | @@ -276,9 +276,10 @@ | |||
1660 | 276 | autofit_ui_text(richtext_escape(title_), get_inner_w(), UI_FONT_CLR_FG, 13); | 276 | autofit_ui_text(richtext_escape(title_), get_inner_w(), UI_FONT_CLR_FG, 13); |
1661 | 277 | 277 | ||
1662 | 278 | // Blit on pixel boundary (not float), so that the text is blitted pixel perfect. | 278 | // Blit on pixel boundary (not float), so that the text is blitted pixel perfect. |
1664 | 279 | Vector2f pos(get_lborder() + get_inner_w() / 2, TP_B_PIXMAP_THICKNESS / 2); | 279 | Vector2i pos(get_lborder() + get_inner_w() / 2, TP_B_PIXMAP_THICKNESS / 2); |
1665 | 280 | UI::correct_for_align(UI::Align::kCenter, text->width(), &pos); | ||
1666 | 280 | UI::center_vertically(text->height(), &pos); | 281 | UI::center_vertically(text->height(), &pos); |
1668 | 281 | dst.blit(pos, text, BlendMode::UseAlpha, UI::Align::kCenter); | 282 | dst.blit(pos, text, BlendMode::UseAlpha); |
1669 | 282 | } | 283 | } |
1670 | 283 | 284 | ||
1671 | 284 | if (!is_minimal_) { | 285 | if (!is_minimal_) { |
1672 | @@ -290,15 +291,15 @@ | |||
1673 | 290 | 291 | ||
1674 | 291 | static_assert(0 <= VT_B_PIXMAP_THICKNESS, "assert(0 <= VT_B_PIXMAP_THICKNESS) failed."); | 292 | static_assert(0 <= VT_B_PIXMAP_THICKNESS, "assert(0 <= VT_B_PIXMAP_THICKNESS) failed."); |
1675 | 292 | dst.blitrect // left top thingy | 293 | dst.blitrect // left top thingy |
1678 | 293 | (Vector2f(0, TP_B_PIXMAP_THICKNESS), pic_lborder_, | 294 | (Vector2i(0, TP_B_PIXMAP_THICKNESS), pic_lborder_, |
1679 | 294 | Recti(Vector2i(0, 0), VT_B_PIXMAP_THICKNESS, VT_B_THINGY_PIXMAP_LEN)); | 295 | Recti(Vector2i::zero(), VT_B_PIXMAP_THICKNESS, VT_B_THINGY_PIXMAP_LEN)); |
1680 | 295 | 296 | ||
1681 | 296 | int32_t pos = TP_B_PIXMAP_THICKNESS + VT_B_THINGY_PIXMAP_LEN; | 297 | int32_t pos = TP_B_PIXMAP_THICKNESS + VT_B_THINGY_PIXMAP_LEN; |
1682 | 297 | 298 | ||
1683 | 298 | // left bar | 299 | // left bar |
1684 | 299 | static_assert(0 <= VT_B_THINGY_PIXMAP_LEN, "assert(0 <= VT_B_THINGY_PIXMAP_LEN) failed."); | 300 | static_assert(0 <= VT_B_THINGY_PIXMAP_LEN, "assert(0 <= VT_B_THINGY_PIXMAP_LEN) failed."); |
1685 | 300 | for (; pos < vt_bar_end_minus_middle; pos += VT_B_MIDDLE_PIXMAP_LEN) | 301 | for (; pos < vt_bar_end_minus_middle; pos += VT_B_MIDDLE_PIXMAP_LEN) |
1687 | 301 | dst.blitrect(Vector2f(0, pos), pic_lborder_, | 302 | dst.blitrect(Vector2i(0, pos), pic_lborder_, |
1688 | 302 | Recti(Vector2i(0, VT_B_THINGY_PIXMAP_LEN), VT_B_PIXMAP_THICKNESS, | 303 | Recti(Vector2i(0, VT_B_THINGY_PIXMAP_LEN), VT_B_PIXMAP_THICKNESS, |
1689 | 303 | VT_B_MIDDLE_PIXMAP_LEN)); | 304 | VT_B_MIDDLE_PIXMAP_LEN)); |
1690 | 304 | 305 | ||
1691 | @@ -306,7 +307,7 @@ | |||
1692 | 306 | const int32_t height = vt_bar_end - pos + VT_B_THINGY_PIXMAP_LEN; | 307 | const int32_t height = vt_bar_end - pos + VT_B_THINGY_PIXMAP_LEN; |
1693 | 307 | assert(0 <= VT_B_TOTAL_PIXMAP_LEN - height); | 308 | assert(0 <= VT_B_TOTAL_PIXMAP_LEN - height); |
1694 | 308 | dst.blitrect( | 309 | dst.blitrect( |
1696 | 309 | Vector2f(0, pos), pic_lborder_, | 310 | Vector2i(0, pos), pic_lborder_, |
1697 | 310 | Recti(Vector2i(0, VT_B_TOTAL_PIXMAP_LEN - height), VT_B_PIXMAP_THICKNESS, height)); | 311 | Recti(Vector2i(0, VT_B_TOTAL_PIXMAP_LEN - height), VT_B_PIXMAP_THICKNESS, height)); |
1698 | 311 | } | 312 | } |
1699 | 312 | 313 | ||
1700 | @@ -314,22 +315,22 @@ | |||
1701 | 314 | const int32_t right_border_x = get_w() - VT_B_PIXMAP_THICKNESS; | 315 | const int32_t right_border_x = get_w() - VT_B_PIXMAP_THICKNESS; |
1702 | 315 | 316 | ||
1703 | 316 | dst.blitrect // right top thingy | 317 | dst.blitrect // right top thingy |
1706 | 317 | (Vector2f(right_border_x, TP_B_PIXMAP_THICKNESS), pic_rborder_, | 318 | (Vector2i(right_border_x, TP_B_PIXMAP_THICKNESS), pic_rborder_, |
1707 | 318 | Recti(Vector2i(0, 0), VT_B_PIXMAP_THICKNESS, VT_B_THINGY_PIXMAP_LEN)); | 319 | Recti(Vector2i::zero(), VT_B_PIXMAP_THICKNESS, VT_B_THINGY_PIXMAP_LEN)); |
1708 | 319 | 320 | ||
1709 | 320 | int32_t pos = TP_B_PIXMAP_THICKNESS + VT_B_THINGY_PIXMAP_LEN; | 321 | int32_t pos = TP_B_PIXMAP_THICKNESS + VT_B_THINGY_PIXMAP_LEN; |
1710 | 321 | 322 | ||
1711 | 322 | // right bar | 323 | // right bar |
1712 | 323 | static_assert(0 <= VT_B_THINGY_PIXMAP_LEN, "assert(0 <= VT_B_THINGY_PIXMAP_LEN) failed."); | 324 | static_assert(0 <= VT_B_THINGY_PIXMAP_LEN, "assert(0 <= VT_B_THINGY_PIXMAP_LEN) failed."); |
1713 | 324 | for (; pos < vt_bar_end_minus_middle; pos += VT_B_MIDDLE_PIXMAP_LEN) | 325 | for (; pos < vt_bar_end_minus_middle; pos += VT_B_MIDDLE_PIXMAP_LEN) |
1715 | 325 | dst.blitrect(Vector2f(right_border_x, pos), pic_rborder_, | 326 | dst.blitrect(Vector2i(right_border_x, pos), pic_rborder_, |
1716 | 326 | Recti(Vector2i(0, VT_B_THINGY_PIXMAP_LEN), VT_B_PIXMAP_THICKNESS, | 327 | Recti(Vector2i(0, VT_B_THINGY_PIXMAP_LEN), VT_B_PIXMAP_THICKNESS, |
1717 | 327 | VT_B_MIDDLE_PIXMAP_LEN)); | 328 | VT_B_MIDDLE_PIXMAP_LEN)); |
1718 | 328 | 329 | ||
1719 | 329 | // odd pixels of right bar and right bottom thingy | 330 | // odd pixels of right bar and right bottom thingy |
1720 | 330 | const int32_t height = vt_bar_end - pos + VT_B_THINGY_PIXMAP_LEN; | 331 | const int32_t height = vt_bar_end - pos + VT_B_THINGY_PIXMAP_LEN; |
1721 | 331 | dst.blitrect( | 332 | dst.blitrect( |
1723 | 332 | Vector2f(right_border_x, pos), pic_rborder_, | 333 | Vector2i(right_border_x, pos), pic_rborder_, |
1724 | 333 | Recti(Vector2i(0, VT_B_TOTAL_PIXMAP_LEN - height), VT_B_PIXMAP_THICKNESS, height)); | 334 | Recti(Vector2i(0, VT_B_TOTAL_PIXMAP_LEN - height), VT_B_PIXMAP_THICKNESS, height)); |
1725 | 334 | } | 335 | } |
1726 | 335 | 336 | ||
1727 | @@ -337,19 +338,19 @@ | |||
1728 | 337 | int32_t pos = HZ_B_CORNER_PIXMAP_LEN; | 338 | int32_t pos = HZ_B_CORNER_PIXMAP_LEN; |
1729 | 338 | 339 | ||
1730 | 339 | dst.blitrect // bottom left corner | 340 | dst.blitrect // bottom left corner |
1733 | 340 | (Vector2f(0, get_h() - BT_B_PIXMAP_THICKNESS), pic_bottom_, | 341 | (Vector2i(0, get_h() - BT_B_PIXMAP_THICKNESS), pic_bottom_, |
1734 | 341 | Recti(Vector2i(0, 0), pos, BT_B_PIXMAP_THICKNESS)); | 342 | Recti(Vector2i::zero(), pos, BT_B_PIXMAP_THICKNESS)); |
1735 | 342 | 343 | ||
1736 | 343 | // bottom bar | 344 | // bottom bar |
1737 | 344 | for (; pos < hz_bar_end_minus_middle; pos += HZ_B_MIDDLE_PIXMAP_LEN) | 345 | for (; pos < hz_bar_end_minus_middle; pos += HZ_B_MIDDLE_PIXMAP_LEN) |
1739 | 345 | dst.blitrect(Vector2f(pos, get_h() - BT_B_PIXMAP_THICKNESS), pic_bottom_, | 346 | dst.blitrect(Vector2i(pos, get_h() - BT_B_PIXMAP_THICKNESS), pic_bottom_, |
1740 | 346 | Recti(Vector2i(HZ_B_CORNER_PIXMAP_LEN, 0), HZ_B_MIDDLE_PIXMAP_LEN, | 347 | Recti(Vector2i(HZ_B_CORNER_PIXMAP_LEN, 0), HZ_B_MIDDLE_PIXMAP_LEN, |
1741 | 347 | BT_B_PIXMAP_THICKNESS)); | 348 | BT_B_PIXMAP_THICKNESS)); |
1742 | 348 | 349 | ||
1743 | 349 | // odd pixels of bottom bar and bottom right corner | 350 | // odd pixels of bottom bar and bottom right corner |
1744 | 350 | const int32_t width = hz_bar_end - pos + HZ_B_CORNER_PIXMAP_LEN; | 351 | const int32_t width = hz_bar_end - pos + HZ_B_CORNER_PIXMAP_LEN; |
1745 | 351 | dst.blitrect( | 352 | dst.blitrect( |
1747 | 352 | Vector2f(pos, get_h() - BT_B_PIXMAP_THICKNESS), pic_bottom_, | 353 | Vector2i(pos, get_h() - BT_B_PIXMAP_THICKNESS), pic_bottom_, |
1748 | 353 | Recti(Vector2i(HZ_B_TOTAL_PIXMAP_LEN - width, 0), width, BT_B_PIXMAP_THICKNESS)); | 354 | Recti(Vector2i(HZ_B_TOTAL_PIXMAP_LEN - width, 0), width, BT_B_PIXMAP_THICKNESS)); |
1749 | 354 | } | 355 | } |
1750 | 355 | } | 356 | } |
1751 | 356 | 357 | ||
1752 | === modified file 'src/ui_fsmenu/mapselect.cc' | |||
1753 | --- src/ui_fsmenu/mapselect.cc 2017-02-28 20:07:07 +0000 | |||
1754 | +++ src/ui_fsmenu/mapselect.cc 2017-05-13 13:15:21 +0000 | |||
1755 | @@ -84,7 +84,7 @@ | |||
1756 | 84 | 84 | ||
1757 | 85 | // Must be initialized before tag checkboxes | 85 | // Must be initialized before tag checkboxes |
1758 | 86 | cb_dont_localize_mapnames_ = | 86 | cb_dont_localize_mapnames_ = |
1760 | 87 | new UI::Checkbox(hbox, Vector2i(0, 0), _("Show original map names")); | 87 | new UI::Checkbox(hbox, Vector2i::zero(), _("Show original map names")); |
1761 | 88 | cb_dont_localize_mapnames_->set_state(false); | 88 | cb_dont_localize_mapnames_->set_state(false); |
1762 | 89 | cb_dont_localize_mapnames_->changedto.connect( | 89 | cb_dont_localize_mapnames_->changedto.connect( |
1763 | 90 | boost::bind(&FullscreenMenuMapSelect::fill_table, boost::ref(*this))); | 90 | boost::bind(&FullscreenMenuMapSelect::fill_table, boost::ref(*this))); |
1764 | @@ -303,7 +303,7 @@ | |||
1765 | 303 | int32_t id = tags_ordered_.size(); | 303 | int32_t id = tags_ordered_.size(); |
1766 | 304 | tags_ordered_.push_back(tag); | 304 | tags_ordered_.push_back(tag); |
1767 | 305 | 305 | ||
1769 | 306 | UI::Checkbox* cb = new UI::Checkbox(box, Vector2i(0, 0), displ_name); | 306 | UI::Checkbox* cb = new UI::Checkbox(box, Vector2i::zero(), displ_name); |
1770 | 307 | cb->changedto.connect(boost::bind(&FullscreenMenuMapSelect::tagbox_changed, this, id, _1)); | 307 | cb->changedto.connect(boost::bind(&FullscreenMenuMapSelect::tagbox_changed, this, id, _1)); |
1771 | 308 | 308 | ||
1772 | 309 | box->add(cb, UI::Box::Resizing::kFullSize); | 309 | box->add(cb, UI::Box::Resizing::kFullSize); |
1773 | 310 | 310 | ||
1774 | === modified file 'src/ui_fsmenu/options.cc' | |||
1775 | --- src/ui_fsmenu/options.cc 2017-03-29 12:37:47 +0000 | |||
1776 | +++ src/ui_fsmenu/options.cc 2017-05-13 13:15:21 +0000 | |||
1777 | @@ -148,15 +148,15 @@ | |||
1778 | 148 | 24, | 148 | 24, |
1779 | 149 | _("In-game resolution")), | 149 | _("In-game resolution")), |
1780 | 150 | 150 | ||
1783 | 151 | fullscreen_(&box_interface_, Vector2i(0, 0), _("Fullscreen"), "", 0), | 151 | fullscreen_(&box_interface_, Vector2i::zero(), _("Fullscreen"), "", 0), |
1784 | 152 | inputgrab_(&box_interface_, Vector2i(0, 0), _("Grab Input"), "", 0), | 152 | inputgrab_(&box_interface_, Vector2i::zero(), _("Grab Input"), "", 0), |
1785 | 153 | 153 | ||
1786 | 154 | sb_maxfps_(&box_interface_, 0, 0, 0, 0, opt.maxfps, 0, 99, _("Maximum FPS:")), | 154 | sb_maxfps_(&box_interface_, 0, 0, 0, 0, opt.maxfps, 0, 99, _("Maximum FPS:")), |
1787 | 155 | 155 | ||
1788 | 156 | // Windows options | 156 | // Windows options |
1789 | 157 | snap_win_overlap_only_( | 157 | snap_win_overlap_only_( |
1792 | 158 | &box_windows_, Vector2i(0, 0), _("Snap windows only when overlapping"), "", 0), | 158 | &box_windows_, Vector2i::zero(), _("Snap windows only when overlapping"), "", 0), |
1793 | 159 | dock_windows_to_edges_(&box_windows_, Vector2i(0, 0), _("Dock windows to edges"), "", 0), | 159 | dock_windows_to_edges_(&box_windows_, Vector2i::zero(), _("Dock windows to edges"), "", 0), |
1794 | 160 | 160 | ||
1795 | 161 | sb_dis_panel_(&box_windows_, | 161 | sb_dis_panel_(&box_windows_, |
1796 | 162 | 0, | 162 | 0, |
1797 | @@ -181,9 +181,9 @@ | |||
1798 | 181 | UI::SpinBox::Units::kPixels), | 181 | UI::SpinBox::Units::kPixels), |
1799 | 182 | 182 | ||
1800 | 183 | // Sound options | 183 | // Sound options |
1804 | 184 | music_(&box_sound_, Vector2i(0, 0), _("Enable Music"), "", 0), | 184 | music_(&box_sound_, Vector2i::zero(), _("Enable Music"), "", 0), |
1805 | 185 | fx_(&box_sound_, Vector2i(0, 0), _("Enable Sound Effects"), "", 0), | 185 | fx_(&box_sound_, Vector2i::zero(), _("Enable Sound Effects"), "", 0), |
1806 | 186 | message_sound_(&box_sound_, Vector2i(0, 0), _("Play a sound at message arrival"), "", 0), | 186 | message_sound_(&box_sound_, Vector2i::zero(), _("Play a sound at message arrival"), "", 0), |
1807 | 187 | 187 | ||
1808 | 188 | // Saving options | 188 | // Saving options |
1809 | 189 | sb_autosave_(&box_saving_, | 189 | sb_autosave_(&box_saving_, |
1810 | @@ -213,26 +213,26 @@ | |||
1811 | 213 | UI::SpinBox::Type::kBig), | 213 | UI::SpinBox::Type::kBig), |
1812 | 214 | 214 | ||
1813 | 215 | zip_(&box_saving_, | 215 | zip_(&box_saving_, |
1815 | 216 | Vector2i(0, 0), | 216 | Vector2i::zero(), |
1816 | 217 | _("Compress widelands data files (maps, replays and savegames)"), | 217 | _("Compress widelands data files (maps, replays and savegames)"), |
1817 | 218 | "", | 218 | "", |
1818 | 219 | 0), | 219 | 0), |
1819 | 220 | write_syncstreams_(&box_saving_, | 220 | write_syncstreams_(&box_saving_, |
1821 | 221 | Vector2i(0, 0), | 221 | Vector2i::zero(), |
1822 | 222 | _("Write syncstreams in network games to debug desyncs"), | 222 | _("Write syncstreams in network games to debug desyncs"), |
1823 | 223 | "", | 223 | "", |
1824 | 224 | 0), | 224 | 0), |
1825 | 225 | 225 | ||
1826 | 226 | // Game options | 226 | // Game options |
1827 | 227 | auto_roadbuild_mode_( | 227 | auto_roadbuild_mode_( |
1830 | 228 | &box_game_, Vector2i(0, 0), _("Start building road after placing a flag")), | 228 | &box_game_, Vector2i::zero(), _("Start building road after placing a flag")), |
1831 | 229 | show_workarea_preview_(&box_game_, Vector2i(0, 0), _("Show buildings area preview")), | 229 | show_workarea_preview_(&box_game_, Vector2i::zero(), _("Show buildings area preview")), |
1832 | 230 | transparent_chat_( | 230 | transparent_chat_( |
1834 | 231 | &box_game_, Vector2i(0, 0), _("Show in-game chat with transparent background"), "", 0), | 231 | &box_game_, Vector2i::zero(), _("Show in-game chat with transparent background"), "", 0), |
1835 | 232 | 232 | ||
1836 | 233 | /** TRANSLATORS: A watchwindow is a window where you keep watching an object or a map region,*/ | 233 | /** TRANSLATORS: A watchwindow is a window where you keep watching an object or a map region,*/ |
1837 | 234 | /** TRANSLATORS: and it also lets you jump to it on the map. */ | 234 | /** TRANSLATORS: and it also lets you jump to it on the map. */ |
1839 | 235 | single_watchwin_(&box_game_, Vector2i(0, 0), _("Use single watchwindow mode")), | 235 | single_watchwin_(&box_game_, Vector2i::zero(), _("Use single watchwindow mode")), |
1840 | 236 | os_(opt) { | 236 | os_(opt) { |
1841 | 237 | // Set up UI Elements | 237 | // Set up UI Elements |
1842 | 238 | title_.set_fontsize(UI_FONT_SIZE_BIG); | 238 | title_.set_fontsize(UI_FONT_SIZE_BIG); |
1843 | 239 | 239 | ||
1844 | === modified file 'src/wlapplication.cc' | |||
1845 | --- src/wlapplication.cc 2017-05-11 10:45:44 +0000 | |||
1846 | +++ src/wlapplication.cc 2017-05-13 13:15:21 +0000 | |||
1847 | @@ -283,9 +283,9 @@ | |||
1848 | 283 | game_type_(NONE), | 283 | game_type_(NONE), |
1849 | 284 | mouse_swapped_(false), | 284 | mouse_swapped_(false), |
1850 | 285 | faking_middle_mouse_button_(false), | 285 | faking_middle_mouse_button_(false), |
1852 | 286 | mouse_position_(0, 0), | 286 | mouse_position_(Vector2i::zero()), |
1853 | 287 | mouse_locked_(0), | 287 | mouse_locked_(0), |
1855 | 288 | mouse_compensate_warp_(0, 0), | 288 | mouse_compensate_warp_(Vector2i::zero()), |
1856 | 289 | should_die_(false), | 289 | should_die_(false), |
1857 | 290 | #ifdef _WIN32 | 290 | #ifdef _WIN32 |
1858 | 291 | homedir_(FileSystem::get_homedir() + "\\.widelands"), | 291 | homedir_(FileSystem::get_homedir() + "\\.widelands"), |
1859 | @@ -469,7 +469,7 @@ | |||
1860 | 469 | case SDL_MOUSEMOTION: | 469 | case SDL_MOUSEMOTION: |
1861 | 470 | ev.motion.xrel += mouse_compensate_warp_.x; | 470 | ev.motion.xrel += mouse_compensate_warp_.x; |
1862 | 471 | ev.motion.yrel += mouse_compensate_warp_.y; | 471 | ev.motion.yrel += mouse_compensate_warp_.y; |
1864 | 472 | mouse_compensate_warp_ = Vector2i(0, 0); | 472 | mouse_compensate_warp_ = Vector2i::zero(); |
1865 | 473 | 473 | ||
1866 | 474 | if (mouse_locked_) { | 474 | if (mouse_locked_) { |
1867 | 475 | warp_mouse(mouse_position_); | 475 | warp_mouse(mouse_position_); |
1868 | @@ -665,7 +665,7 @@ | |||
1869 | 665 | void WLApplication::warp_mouse(const Vector2i position) { | 665 | void WLApplication::warp_mouse(const Vector2i position) { |
1870 | 666 | mouse_position_ = position; | 666 | mouse_position_ = position; |
1871 | 667 | 667 | ||
1873 | 668 | Vector2i cur_position; | 668 | Vector2i cur_position = Vector2i::zero(); |
1874 | 669 | SDL_GetMouseState(&cur_position.x, &cur_position.y); | 669 | SDL_GetMouseState(&cur_position.x, &cur_position.y); |
1875 | 670 | if (cur_position != position) { | 670 | if (cur_position != position) { |
1876 | 671 | mouse_compensate_warp_ += cur_position - position; | 671 | mouse_compensate_warp_ += cur_position - position; |
1877 | 672 | 672 | ||
1878 | === modified file 'src/wui/chatoverlay.cc' | |||
1879 | --- src/wui/chatoverlay.cc 2017-01-25 18:55:59 +0000 | |||
1880 | +++ src/wui/chatoverlay.cc 2017-05-13 13:15:21 +0000 | |||
1881 | @@ -183,10 +183,10 @@ | |||
1882 | 183 | const int width = std::min<int>(get_w(), im->width()); | 183 | const int width = std::min<int>(get_w(), im->width()); |
1883 | 184 | 184 | ||
1884 | 185 | if (!m->transparent_) { | 185 | if (!m->transparent_) { |
1886 | 186 | dst.fill_rect(Rectf(0, top, width, height), RGBAColor(50, 50, 50, 128), BlendMode::Default); | 186 | dst.fill_rect(Recti(0, top, width, height), RGBAColor(50, 50, 50, 128), BlendMode::Default); |
1887 | 187 | } | 187 | } |
1888 | 188 | int32_t topcrop = im->height() - height; | 188 | int32_t topcrop = im->height() - height; |
1889 | 189 | Recti cropRect(0, topcrop, width, height); | 189 | Recti cropRect(0, topcrop, width, height); |
1890 | 190 | 190 | ||
1892 | 191 | dst.blitrect(Vector2f(0, top), im, cropRect); | 191 | dst.blitrect(Vector2i(0, top), im, cropRect); |
1893 | 192 | } | 192 | } |
1894 | 193 | 193 | ||
1895 | === modified file 'src/wui/field_overlay_manager.h' | |||
1896 | --- src/wui/field_overlay_manager.h 2017-01-25 18:55:59 +0000 | |||
1897 | +++ src/wui/field_overlay_manager.h 2017-05-13 13:15:21 +0000 | |||
1898 | @@ -60,7 +60,7 @@ | |||
1899 | 60 | } | 60 | } |
1900 | 61 | 61 | ||
1901 | 62 | const Image* pic; | 62 | const Image* pic; |
1903 | 63 | Vector2i hotspot; | 63 | Vector2i hotspot = Vector2i::zero(); |
1904 | 64 | }; | 64 | }; |
1905 | 65 | 65 | ||
1906 | 66 | /// A function returning Field::nodecaps() for the build overlay. This can be | 66 | /// A function returning Field::nodecaps() for the build overlay. This can be |
1907 | @@ -118,7 +118,7 @@ | |||
1908 | 118 | } | 118 | } |
1909 | 119 | std::set<OverlayId> overlay_ids; | 119 | std::set<OverlayId> overlay_ids; |
1910 | 120 | const Image* pic; | 120 | const Image* pic; |
1912 | 121 | Vector2i hotspot; | 121 | Vector2i hotspot = Vector2i::zero(); |
1913 | 122 | int level; | 122 | int level; |
1914 | 123 | }; | 123 | }; |
1915 | 124 | 124 | ||
1916 | 125 | 125 | ||
1917 | === modified file 'src/wui/game_tips.cc' | |||
1918 | --- src/wui/game_tips.cc 2017-01-25 18:55:59 +0000 | |||
1919 | +++ src/wui/game_tips.cc 2017-05-13 13:15:21 +0000 | |||
1920 | @@ -107,11 +107,11 @@ | |||
1921 | 107 | 107 | ||
1922 | 108 | uint16_t w = pic_background->width(); | 108 | uint16_t w = pic_background->width(); |
1923 | 109 | uint16_t h = pic_background->height(); | 109 | uint16_t h = pic_background->height(); |
1926 | 110 | Vector2f pt((g_gr->get_xres() - w) / 2, (g_gr->get_yres() - h) / 2); | 110 | Vector2i pt((g_gr->get_xres() - w) / 2, (g_gr->get_yres() - h) / 2); |
1927 | 111 | Rectf tips_area(pt, w, h); | 111 | Recti tips_area(pt, w, h); |
1928 | 112 | rt.blit(pt, pic_background); | 112 | rt.blit(pt, pic_background); |
1929 | 113 | 113 | ||
1930 | 114 | const Image* rendered_text = UI::g_fh1->render(as_game_tip(tips_[index].text), tips_area.w); | 114 | const Image* rendered_text = UI::g_fh1->render(as_game_tip(tips_[index].text), tips_area.w); |
1932 | 115 | rt.blit(tips_area.center() - Vector2f(rendered_text->width() / 2, rendered_text->height() / 2), | 115 | rt.blit(tips_area.center().cast<int>() - Vector2i(rendered_text->width() / 2, rendered_text->height() / 2), |
1933 | 116 | rendered_text); | 116 | rendered_text); |
1934 | 117 | } | 117 | } |
1935 | 118 | 118 | ||
1936 | === modified file 'src/wui/general_statistics_menu.cc' | |||
1937 | --- src/wui/general_statistics_menu.cc 2017-05-03 07:24:06 +0000 | |||
1938 | +++ src/wui/general_statistics_menu.cc 2017-05-13 13:15:21 +0000 | |||
1939 | @@ -129,64 +129,66 @@ | |||
1940 | 129 | 129 | ||
1941 | 130 | UI::Radiobutton* btn; | 130 | UI::Radiobutton* btn; |
1942 | 131 | 131 | ||
1944 | 132 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 132 | const Vector2i zero = Vector2i::zero(); |
1945 | 133 | |||
1946 | 134 | radiogroup_.add_button(hbox2, zero, | ||
1947 | 133 | g_gr->images().get("images/wui/stats/genstats_landsize.png"), _("Land"), | 135 | g_gr->images().get("images/wui/stats/genstats_landsize.png"), _("Land"), |
1948 | 134 | &btn); | 136 | &btn); |
1949 | 135 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 137 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1950 | 136 | 138 | ||
1952 | 137 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 139 | radiogroup_.add_button(hbox2, zero, |
1953 | 138 | g_gr->images().get("images/wui/stats/genstats_nrworkers.png"), | 140 | g_gr->images().get("images/wui/stats/genstats_nrworkers.png"), |
1954 | 139 | _("Workers"), &btn); | 141 | _("Workers"), &btn); |
1955 | 140 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 142 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1956 | 141 | 143 | ||
1958 | 142 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 144 | radiogroup_.add_button(hbox2, zero, |
1959 | 143 | g_gr->images().get("images/wui/stats/genstats_nrbuildings.png"), | 145 | g_gr->images().get("images/wui/stats/genstats_nrbuildings.png"), |
1960 | 144 | _("Buildings"), &btn); | 146 | _("Buildings"), &btn); |
1961 | 145 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 147 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1962 | 146 | 148 | ||
1964 | 147 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 149 | radiogroup_.add_button(hbox2, zero, |
1965 | 148 | g_gr->images().get("images/wui/stats/genstats_nrwares.png"), _("Wares"), | 150 | g_gr->images().get("images/wui/stats/genstats_nrwares.png"), _("Wares"), |
1966 | 149 | &btn); | 151 | &btn); |
1967 | 150 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 152 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1968 | 151 | 153 | ||
1970 | 152 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 154 | radiogroup_.add_button(hbox2, zero, |
1971 | 153 | g_gr->images().get("images/wui/stats/genstats_productivity.png"), | 155 | g_gr->images().get("images/wui/stats/genstats_productivity.png"), |
1972 | 154 | _("Productivity"), &btn); | 156 | _("Productivity"), &btn); |
1973 | 155 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 157 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1974 | 156 | 158 | ||
1976 | 157 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 159 | radiogroup_.add_button(hbox2, zero, |
1977 | 158 | g_gr->images().get("images/wui/stats/genstats_casualties.png"), | 160 | g_gr->images().get("images/wui/stats/genstats_casualties.png"), |
1978 | 159 | _("Casualties"), &btn); | 161 | _("Casualties"), &btn); |
1979 | 160 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 162 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1980 | 161 | 163 | ||
1982 | 162 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 164 | radiogroup_.add_button(hbox2, zero, |
1983 | 163 | g_gr->images().get("images/wui/stats/genstats_kills.png"), _("Kills"), | 165 | g_gr->images().get("images/wui/stats/genstats_kills.png"), _("Kills"), |
1984 | 164 | &btn); | 166 | &btn); |
1985 | 165 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 167 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1986 | 166 | 168 | ||
1988 | 167 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 169 | radiogroup_.add_button(hbox2, zero, |
1989 | 168 | g_gr->images().get("images/wui/stats/genstats_msites_lost.png"), | 170 | g_gr->images().get("images/wui/stats/genstats_msites_lost.png"), |
1990 | 169 | _("Military buildings lost"), &btn); | 171 | _("Military buildings lost"), &btn); |
1991 | 170 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 172 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1992 | 171 | 173 | ||
1994 | 172 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 174 | radiogroup_.add_button(hbox2, zero, |
1995 | 173 | g_gr->images().get("images/wui/stats/genstats_msites_defeated.png"), | 175 | g_gr->images().get("images/wui/stats/genstats_msites_defeated.png"), |
1996 | 174 | _("Military buildings defeated"), &btn); | 176 | _("Military buildings defeated"), &btn); |
1997 | 175 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 177 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
1998 | 176 | 178 | ||
2000 | 177 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 179 | radiogroup_.add_button(hbox2, zero, |
2001 | 178 | g_gr->images().get("images/wui/stats/genstats_civil_blds_lost.png"), | 180 | g_gr->images().get("images/wui/stats/genstats_civil_blds_lost.png"), |
2002 | 179 | _("Civilian buildings lost"), &btn); | 181 | _("Civilian buildings lost"), &btn); |
2003 | 180 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 182 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
2004 | 181 | 183 | ||
2006 | 182 | radiogroup_.add_button(hbox2, Vector2i(0, 0), | 184 | radiogroup_.add_button(hbox2, zero, |
2007 | 183 | g_gr->images().get("images/wui/stats/genstats_militarystrength.png"), | 185 | g_gr->images().get("images/wui/stats/genstats_militarystrength.png"), |
2008 | 184 | _("Military"), &btn); | 186 | _("Military"), &btn); |
2009 | 185 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 187 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
2010 | 186 | 188 | ||
2011 | 187 | if (hook) { | 189 | if (hook) { |
2012 | 188 | radiogroup_.add_button( | 190 | radiogroup_.add_button( |
2014 | 189 | hbox2, Vector2i(0, 0), g_gr->images().get(cs_pic), cs_name.c_str(), &btn); | 191 | hbox2, zero, g_gr->images().get(cs_pic), cs_name.c_str(), &btn); |
2015 | 190 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); | 192 | hbox2->add(btn, UI::Box::Resizing::kFillSpace); |
2016 | 191 | } | 193 | } |
2017 | 192 | 194 | ||
2018 | 193 | 195 | ||
2019 | === modified file 'src/wui/inputqueuedisplay.cc' | |||
2020 | --- src/wui/inputqueuedisplay.cc 2017-01-25 18:55:59 +0000 | |||
2021 | +++ src/wui/inputqueuedisplay.cc 2017-05-13 13:15:21 +0000 | |||
2022 | @@ -131,12 +131,12 @@ | |||
2023 | 131 | uint32_t nr_inputs_to_draw = std::min(queue_->get_filled(), cache_size_); | 131 | uint32_t nr_inputs_to_draw = std::min(queue_->get_filled(), cache_size_); |
2024 | 132 | uint32_t nr_empty_to_draw = cache_size_ - nr_inputs_to_draw; | 132 | uint32_t nr_empty_to_draw = cache_size_ - nr_inputs_to_draw; |
2025 | 133 | 133 | ||
2027 | 134 | Vector2f point; | 134 | Vector2i point = Vector2i::zero(); |
2028 | 135 | point.x = Border + (show_only_ ? 0 : CellWidth + CellSpacing); | 135 | point.x = Border + (show_only_ ? 0 : CellWidth + CellSpacing); |
2029 | 136 | point.y = Border + (total_height_ - 2 * Border - WARE_MENU_PIC_HEIGHT) / 2; | 136 | point.y = Border + (total_height_ - 2 * Border - WARE_MENU_PIC_HEIGHT) / 2; |
2030 | 137 | 137 | ||
2031 | 138 | for (; nr_inputs_to_draw; --nr_inputs_to_draw, point.x += CellWidth + CellSpacing) { | 138 | for (; nr_inputs_to_draw; --nr_inputs_to_draw, point.x += CellWidth + CellSpacing) { |
2033 | 139 | dst.blitrect(Vector2f(point.x, point.y), icon_, Recti(0, 0, icon_->width(), icon_->height()), | 139 | dst.blitrect(Vector2i(point.x, point.y), icon_, Recti(0, 0, icon_->width(), icon_->height()), |
2034 | 140 | BlendMode::UseAlpha); | 140 | BlendMode::UseAlpha); |
2035 | 141 | } | 141 | } |
2036 | 142 | for (; nr_empty_to_draw; --nr_empty_to_draw, point.x += CellWidth + CellSpacing) { | 142 | for (; nr_empty_to_draw; --nr_empty_to_draw, point.x += CellWidth + CellSpacing) { |
2037 | 143 | 143 | ||
2038 | === modified file 'src/wui/interactive_base.cc' | |||
2039 | --- src/wui/interactive_base.cc 2017-03-03 18:13:55 +0000 | |||
2040 | +++ src/wui/interactive_base.cc 2017-05-13 13:15:21 +0000 | |||
2041 | @@ -358,8 +358,7 @@ | |||
2042 | 358 | if (is_game) { | 358 | if (is_game) { |
2043 | 359 | const std::string gametime(gametimestring(egbase().get_gametime(), true)); | 359 | const std::string gametime(gametimestring(egbase().get_gametime(), true)); |
2044 | 360 | const std::string gametime_text = as_condensed(gametime); | 360 | const std::string gametime_text = as_condensed(gametime); |
2047 | 361 | dst.blit(Vector2f(5, 5), UI::g_fh1->render(gametime_text), BlendMode::UseAlpha, | 361 | dst.blit(Vector2i(5, 5), UI::g_fh1->render(gametime_text), BlendMode::UseAlpha); |
2046 | 362 | UI::Align::kLeft); | ||
2048 | 363 | 362 | ||
2049 | 364 | static boost::format node_format("(%i, %i)"); | 363 | static boost::format node_format("(%i, %i)"); |
2050 | 365 | node_text = as_condensed((node_format % sel_.pos.node.x % sel_.pos.node.y).str()); | 364 | node_text = as_condensed((node_format % sel_.pos.node.x % sel_.pos.node.y).str()); |
2051 | @@ -370,9 +369,9 @@ | |||
2052 | 370 | } | 369 | } |
2053 | 371 | 370 | ||
2054 | 372 | const Image* rendered_text = UI::g_fh1->render(node_text); | 371 | const Image* rendered_text = UI::g_fh1->render(node_text); |
2058 | 373 | 372 | Vector2i point(get_w() - 5, get_h() - rendered_text->height() - 5); | |
2059 | 374 | dst.blit(Vector2f(get_w() - 5, get_h() - rendered_text->height() - 5), rendered_text, | 373 | UI::correct_for_align(UI::Align::kRight, rendered_text->width(), &point); |
2060 | 375 | BlendMode::UseAlpha, UI::Align::kRight); | 374 | dst.blit(point, rendered_text, BlendMode::UseAlpha); |
2061 | 376 | } | 375 | } |
2062 | 377 | 376 | ||
2063 | 378 | // Blit FPS when playing a game in debug mode. | 377 | // Blit FPS when playing a game in debug mode. |
2064 | @@ -380,8 +379,8 @@ | |||
2065 | 380 | static boost::format fps_format("%5.1f fps (avg: %5.1f fps)"); | 379 | static boost::format fps_format("%5.1f fps (avg: %5.1f fps)"); |
2066 | 381 | const Image* rendered_text = UI::g_fh1->render(as_condensed( | 380 | const Image* rendered_text = UI::g_fh1->render(as_condensed( |
2067 | 382 | (fps_format % (1000.0 / frametime_) % (1000.0 / (avg_usframetime_ / 1000))).str())); | 381 | (fps_format % (1000.0 / frametime_) % (1000.0 / (avg_usframetime_ / 1000))).str())); |
2070 | 383 | dst.blit(Vector2f((get_w() - rendered_text->width()) / 2, 5), rendered_text, | 382 | dst.blit(Vector2i((get_w() - rendered_text->width()) / 2, 5), rendered_text, |
2071 | 384 | BlendMode::UseAlpha, UI::Align::kLeft); | 383 | BlendMode::UseAlpha); |
2072 | 385 | } | 384 | } |
2073 | 386 | } | 385 | } |
2074 | 387 | 386 | ||
2075 | 388 | 387 | ||
2076 | === modified file 'src/wui/interactive_gamebase.cc' | |||
2077 | --- src/wui/interactive_gamebase.cc 2017-02-28 16:00:20 +0000 | |||
2078 | +++ src/wui/interactive_gamebase.cc 2017-05-13 13:15:21 +0000 | |||
2079 | @@ -126,8 +126,10 @@ | |||
2080 | 126 | } | 126 | } |
2081 | 127 | 127 | ||
2082 | 128 | if (!game_speed.empty()) { | 128 | if (!game_speed.empty()) { |
2085 | 129 | dst.blit(Vector2f(get_w() - 5, 5), UI::g_fh1->render(game_speed), BlendMode::UseAlpha, | 129 | Vector2i point(get_w() - 5, 5); |
2086 | 130 | UI::Align::kRight); | 130 | const Image* rendered_speed = UI::g_fh1->render(game_speed); |
2087 | 131 | UI::correct_for_align(UI::Align::kRight, rendered_speed->width(), &point); | ||
2088 | 132 | dst.blit(point, rendered_speed, BlendMode::UseAlpha); | ||
2089 | 131 | } | 133 | } |
2090 | 132 | } | 134 | } |
2091 | 133 | } | 135 | } |
2092 | 134 | 136 | ||
2093 | === modified file 'src/wui/itemwaresdisplay.cc' | |||
2094 | --- src/wui/itemwaresdisplay.cc 2017-01-25 18:55:59 +0000 | |||
2095 | +++ src/wui/itemwaresdisplay.cc 2017-05-13 13:15:21 +0000 | |||
2096 | @@ -98,7 +98,7 @@ | |||
2097 | 98 | void ItemWaresDisplay::draw(RenderTarget& dst) { | 98 | void ItemWaresDisplay::draw(RenderTarget& dst) { |
2098 | 99 | const Widelands::TribeDescr& tribe(player().tribe()); | 99 | const Widelands::TribeDescr& tribe(player().tribe()); |
2099 | 100 | 100 | ||
2101 | 101 | dst.fill_rect(Rectf(0, 0, get_w(), get_h()), RGBAColor(0, 0, 0, 0)); | 101 | dst.fill_rect(Recti(0, 0, get_w(), get_h()), RGBAColor(0, 0, 0, 0)); |
2102 | 102 | 102 | ||
2103 | 103 | for (uint32_t idx = 0; idx < items_.size(); ++idx) { | 103 | for (uint32_t idx = 0; idx < items_.size(); ++idx) { |
2104 | 104 | const Item& it = items_[idx]; | 104 | const Item& it = items_[idx]; |
2105 | @@ -117,7 +117,7 @@ | |||
2106 | 117 | } else { | 117 | } else { |
2107 | 118 | y += IWD_WareBaseLine; | 118 | y += IWD_WareBaseLine; |
2108 | 119 | if (tribe.get_ware_descr(it.index)->icon()) | 119 | if (tribe.get_ware_descr(it.index)->icon()) |
2110 | 120 | dst.blit(Vector2f(x, y), tribe.get_ware_descr(it.index)->icon()); | 120 | dst.blit(Vector2i(x, y), tribe.get_ware_descr(it.index)->icon()); |
2111 | 121 | } | 121 | } |
2112 | 122 | } | 122 | } |
2113 | 123 | } | 123 | } |
2114 | 124 | 124 | ||
2115 | === modified file 'src/wui/mapview.cc' | |||
2116 | --- src/wui/mapview.cc 2017-02-12 09:10:57 +0000 | |||
2117 | +++ src/wui/mapview.cc 2017-05-13 13:15:21 +0000 | |||
2118 | @@ -133,7 +133,7 @@ | |||
2119 | 133 | const Vector2f center_point = center_point_t.value(dt); | 133 | const Vector2f center_point = center_point_t.value(dt); |
2120 | 134 | const Vector2f viewpoint = center_point - Vector2f(width * zoom / 2.f, height * zoom / 2.f); | 134 | const Vector2f viewpoint = center_point - Vector2f(width * zoom / 2.f, height * zoom / 2.f); |
2121 | 135 | plan->push_back(MapView::TimestampedView{ | 135 | plan->push_back(MapView::TimestampedView{ |
2123 | 136 | static_cast<uint32_t>(std::lround(start_time + dt)), MapView::View{viewpoint, zoom}}); | 136 | static_cast<uint32_t>(std::lround(start_time + dt)), MapView::View(viewpoint, zoom)}); |
2124 | 137 | } | 137 | } |
2125 | 138 | } | 138 | } |
2126 | 139 | 139 | ||
2127 | @@ -194,7 +194,7 @@ | |||
2128 | 194 | Vector2f(width * end.zoom / 2.f, height * end.zoom / 2.f); | 194 | Vector2f(width * end.zoom / 2.f, height * end.zoom / 2.f); |
2129 | 195 | plan.push_back( | 195 | plan.push_back( |
2130 | 196 | MapView::TimestampedView{static_cast<uint32_t>(std::lround(start_time + duration_ms)), | 196 | MapView::TimestampedView{static_cast<uint32_t>(std::lround(start_time + duration_ms)), |
2132 | 197 | MapView::View{end_viewpoint, end.zoom}}); | 197 | MapView::View(end_viewpoint, end.zoom)}); |
2133 | 198 | return plan; | 198 | return plan; |
2134 | 199 | } | 199 | } |
2135 | 200 | 200 | ||
2136 | @@ -233,11 +233,11 @@ | |||
2137 | 233 | plan.push_back(start); | 233 | plan.push_back(start); |
2138 | 234 | for (int i = 1; i < kNumKeyFrames - 2; i++) { | 234 | for (int i = 1; i < kNumKeyFrames - 2; i++) { |
2139 | 235 | float dt = (kShortAnimationMs / kNumKeyFrames) * i; | 235 | float dt = (kShortAnimationMs / kNumKeyFrames) * i; |
2142 | 236 | plan.push_back(MapView::TimestampedMouse{ | 236 | plan.push_back(MapView::TimestampedMouse( |
2143 | 237 | static_cast<uint32_t>(std::lround(start.t + dt)), mouse_t.value(dt)}); | 237 | static_cast<uint32_t>(std::lround(start.t + dt)), mouse_t.value(dt))); |
2144 | 238 | } | 238 | } |
2147 | 239 | plan.push_back(MapView::TimestampedMouse{ | 239 | plan.push_back(MapView::TimestampedMouse( |
2148 | 240 | static_cast<uint32_t>(std::lround(start.t + kShortAnimationMs)), target.cast<float>()}); | 240 | static_cast<uint32_t>(std::lround(start.t + kShortAnimationMs)), target.cast<float>())); |
2149 | 241 | return plan; | 241 | return plan; |
2150 | 242 | } | 242 | } |
2151 | 243 | 243 | ||
2152 | @@ -299,7 +299,8 @@ | |||
2153 | 299 | : UI::Panel(parent, x, y, w, h), | 299 | : UI::Panel(parent, x, y, w, h), |
2154 | 300 | renderer_(new GameRenderer()), | 300 | renderer_(new GameRenderer()), |
2155 | 301 | intbase_(player), | 301 | intbase_(player), |
2157 | 302 | view_{Vector2f(0.f, 0.f), 1.f}, | 302 | view_(), |
2158 | 303 | last_mouse_pos_(Vector2i::zero()), | ||
2159 | 303 | dragging_(false) { | 304 | dragging_(false) { |
2160 | 304 | } | 305 | } |
2161 | 305 | 306 | ||
2162 | @@ -446,7 +447,7 @@ | |||
2163 | 446 | const TimestampedView current = animation_target_view(); | 447 | const TimestampedView current = animation_target_view(); |
2164 | 447 | const Rectf area = get_view_area(current.view, get_w(), get_h()); | 448 | const Rectf area = get_view_area(current.view, get_w(), get_h()); |
2165 | 448 | const Vector2f target_view = pos - Vector2f(area.w / 2.f, area.h / 2.f); | 449 | const Vector2f target_view = pos - Vector2f(area.w / 2.f, area.h / 2.f); |
2167 | 449 | set_view(View{target_view, current.view.zoom}, transition); | 450 | set_view(View(target_view, current.view.zoom), transition); |
2168 | 450 | } | 451 | } |
2169 | 451 | 452 | ||
2170 | 452 | MapView::ViewArea MapView::view_area() const { | 453 | MapView::ViewArea MapView::view_area() const { |
2171 | @@ -605,7 +606,7 @@ | |||
2172 | 605 | 606 | ||
2173 | 606 | MapView::TimestampedMouse MapView::animation_target_mouse() const { | 607 | MapView::TimestampedMouse MapView::animation_target_mouse() const { |
2174 | 607 | if (mouse_plans_.empty()) { | 608 | if (mouse_plans_.empty()) { |
2176 | 608 | return TimestampedMouse{SDL_GetTicks(), get_mouse_position().cast<float>()}; | 609 | return TimestampedMouse(SDL_GetTicks(), get_mouse_position().cast<float>()); |
2177 | 609 | } | 610 | } |
2178 | 610 | return mouse_plans_.back().back(); | 611 | return mouse_plans_.back().back(); |
2179 | 611 | } | 612 | } |
2180 | 612 | 613 | ||
2181 | === modified file 'src/wui/mapview.h' | |||
2182 | --- src/wui/mapview.h 2017-01-25 18:55:59 +0000 | |||
2183 | +++ src/wui/mapview.h 2017-05-13 13:15:21 +0000 | |||
2184 | @@ -71,6 +71,11 @@ | |||
2185 | 71 | }; | 71 | }; |
2186 | 72 | 72 | ||
2187 | 73 | struct View { | 73 | struct View { |
2188 | 74 | View(Vector2f init_viewpoint, float init_zoom) : viewpoint(init_viewpoint), zoom(init_zoom) { | ||
2189 | 75 | } | ||
2190 | 76 | View() : View(Vector2f::zero(), 1.0f) { | ||
2191 | 77 | } | ||
2192 | 78 | |||
2193 | 74 | // Mappixel of top-left pixel of this MapView. | 79 | // Mappixel of top-left pixel of this MapView. |
2194 | 75 | Vector2f viewpoint; | 80 | Vector2f viewpoint; |
2195 | 76 | 81 | ||
2196 | @@ -87,8 +92,12 @@ | |||
2197 | 87 | }; | 92 | }; |
2198 | 88 | 93 | ||
2199 | 89 | struct TimestampedMouse { | 94 | struct TimestampedMouse { |
2200 | 95 | TimestampedMouse(uint32_t init_t, Vector2f init_pixel) : t(init_t), pixel(init_pixel) { | ||
2201 | 96 | } | ||
2202 | 97 | TimestampedMouse() : t(0), pixel(Vector2f::zero()) { | ||
2203 | 98 | } | ||
2204 | 90 | uint32_t t; | 99 | uint32_t t; |
2206 | 91 | Vector2f pixel; | 100 | Vector2f pixel = Vector2f::zero(); |
2207 | 92 | }; | 101 | }; |
2208 | 93 | 102 | ||
2209 | 94 | MapView(UI::Panel* const parent, | 103 | MapView(UI::Panel* const parent, |
2210 | 95 | 104 | ||
2211 | === modified file 'src/wui/minimap.cc' | |||
2212 | --- src/wui/minimap.cc 2017-02-12 09:10:57 +0000 | |||
2213 | +++ src/wui/minimap.cc 2017-05-13 13:15:21 +0000 | |||
2214 | @@ -52,7 +52,7 @@ | |||
2215 | 52 | void MiniMap::View::draw(RenderTarget& dst) { | 52 | void MiniMap::View::draw(RenderTarget& dst) { |
2216 | 53 | minimap_image_ = draw_minimap(ibase_.egbase(), ibase_.get_player(), view_area_, *minimap_type_, | 53 | minimap_image_ = draw_minimap(ibase_.egbase(), ibase_.get_player(), view_area_, *minimap_type_, |
2217 | 54 | *minimap_layers_ | MiniMapLayer::ViewWindow); | 54 | *minimap_layers_ | MiniMapLayer::ViewWindow); |
2219 | 55 | dst.blit(Vector2f(), minimap_image_.get()); | 55 | dst.blit(Vector2i::zero(), minimap_image_.get()); |
2220 | 56 | } | 56 | } |
2221 | 57 | 57 | ||
2222 | 58 | /* | 58 | /* |
2223 | 59 | 59 | ||
2224 | === modified file 'src/wui/plot_area.cc' | |||
2225 | --- src/wui/plot_area.cc 2017-05-02 12:09:44 +0000 | |||
2226 | +++ src/wui/plot_area.cc 2017-05-13 13:15:21 +0000 | |||
2227 | @@ -176,12 +176,13 @@ | |||
2228 | 176 | */ | 176 | */ |
2229 | 177 | void draw_value(const string& value, | 177 | void draw_value(const string& value, |
2230 | 178 | const RGBColor& color, | 178 | const RGBColor& color, |
2232 | 179 | const Vector2f& pos, | 179 | const Vector2i& pos, |
2233 | 180 | RenderTarget& dst) { | 180 | RenderTarget& dst) { |
2234 | 181 | const Image* pic = UI::g_fh1->render(ytick_text_style(value, color)); | 181 | const Image* pic = UI::g_fh1->render(ytick_text_style(value, color)); |
2236 | 182 | Vector2f point(pos); // Un-const this | 182 | Vector2i point(pos); // Un-const this |
2237 | 183 | UI::correct_for_align(UI::Align::kRight, pic->width(), &point); | ||
2238 | 183 | UI::center_vertically(pic->height(), &point); | 184 | UI::center_vertically(pic->height(), &point); |
2240 | 184 | dst.blit(point, pic, BlendMode::UseAlpha, UI::Align::kRight); | 185 | dst.blit(point, pic, BlendMode::UseAlpha); |
2241 | 185 | } | 186 | } |
2242 | 186 | 187 | ||
2243 | 187 | uint32_t calc_plot_x_max_ticks(int32_t plot_width) { | 188 | uint32_t calc_plot_x_max_ticks(int32_t plot_width) { |
2244 | @@ -229,6 +230,7 @@ | |||
2245 | 229 | } | 230 | } |
2246 | 230 | // Make sure that we always have a tick | 231 | // Make sure that we always have a tick |
2247 | 231 | how_many_ticks = std::max(how_many_ticks, 1u); | 232 | how_many_ticks = std::max(how_many_ticks, 1u); |
2248 | 233 | |||
2249 | 232 | // Make sure we haven't more ticks than we have space for -> avoid overlap | 234 | // Make sure we haven't more ticks than we have space for -> avoid overlap |
2250 | 233 | how_many_ticks = std::min(how_many_ticks, calc_plot_x_max_ticks(inner_w)); | 235 | how_many_ticks = std::min(how_many_ticks, calc_plot_x_max_ticks(inner_w)); |
2251 | 234 | 236 | ||
2252 | @@ -264,9 +266,10 @@ | |||
2253 | 264 | // over the number, not to the left | 266 | // over the number, not to the left |
2254 | 265 | const Image* xtick = UI::g_fh1->render( | 267 | const Image* xtick = UI::g_fh1->render( |
2255 | 266 | xtick_text_style((boost::format("-%u ") % (max_x / how_many_ticks * i)).str())); | 268 | xtick_text_style((boost::format("-%u ") % (max_x / how_many_ticks * i)).str())); |
2257 | 267 | Vector2f pos(posx, inner_h - kSpaceBottom + 10); | 269 | Vector2i pos(posx, inner_h - kSpaceBottom + 10); |
2258 | 270 | UI::correct_for_align(UI::Align::kCenter, xtick->width(), &pos); | ||
2259 | 268 | UI::center_vertically(xtick->height(), &pos); | 271 | UI::center_vertically(xtick->height(), &pos); |
2261 | 269 | dst.blit(pos, xtick, BlendMode::UseAlpha, UI::Align::kCenter); | 272 | dst.blit(pos, xtick, BlendMode::UseAlpha); |
2262 | 270 | 273 | ||
2263 | 271 | posx -= sub; | 274 | posx -= sub; |
2264 | 272 | } | 275 | } |
2265 | @@ -282,9 +285,9 @@ | |||
2266 | 282 | 285 | ||
2267 | 283 | // print the used unit | 286 | // print the used unit |
2268 | 284 | const Image* xtick = UI::g_fh1->render(xtick_text_style(get_generic_unit_name(unit))); | 287 | const Image* xtick = UI::g_fh1->render(xtick_text_style(get_generic_unit_name(unit))); |
2270 | 285 | Vector2f pos(2, kSpacing + 2); | 288 | Vector2i pos(2, kSpacing + 2); |
2271 | 286 | UI::center_vertically(xtick->height(), &pos); | 289 | UI::center_vertically(xtick->height(), &pos); |
2273 | 287 | dst.blit(pos, xtick, BlendMode::UseAlpha, UI::Align::kLeft); | 290 | dst.blit(pos, xtick, BlendMode::UseAlpha); |
2274 | 288 | } | 291 | } |
2275 | 289 | 292 | ||
2276 | 290 | } // namespace | 293 | } // namespace |
2277 | @@ -459,8 +462,8 @@ | |||
2278 | 459 | * Draw this. This is the main function | 462 | * Draw this. This is the main function |
2279 | 460 | */ | 463 | */ |
2280 | 461 | void WuiPlotArea::draw(RenderTarget& dst) { | 464 | void WuiPlotArea::draw(RenderTarget& dst) { |
2283 | 462 | dst.tile(Recti(Vector2i(0, 0), get_inner_w(), get_inner_h()), g_gr->images().get(BG_PIC), | 465 | dst.tile(Recti(Vector2i::zero(), get_inner_w(), get_inner_h()), g_gr->images().get(BG_PIC), |
2284 | 463 | Vector2i(0, 0)); | 466 | Vector2i::zero()); |
2285 | 464 | draw_plot(dst, get_inner_h() - kSpaceBottom, std::to_string(highest_scale_), highest_scale_); | 467 | draw_plot(dst, get_inner_h() - kSpaceBottom, std::to_string(highest_scale_), highest_scale_); |
2286 | 465 | } | 468 | } |
2287 | 466 | 469 | ||
2288 | @@ -482,7 +485,7 @@ | |||
2289 | 482 | 485 | ||
2290 | 483 | // print the maximal value into the top right corner | 486 | // print the maximal value into the top right corner |
2291 | 484 | draw_value(yscale_label, RGBColor(60, 125, 0), | 487 | draw_value(yscale_label, RGBColor(60, 125, 0), |
2293 | 485 | Vector2f(get_inner_w() - kSpaceRight - 3, kSpacing + 2), dst); | 488 | Vector2i(get_inner_w() - kSpaceRight - 3, kSpacing + 2), dst); |
2294 | 486 | } | 489 | } |
2295 | 487 | 490 | ||
2296 | 488 | /** | 491 | /** |
2297 | @@ -671,8 +674,8 @@ | |||
2298 | 671 | void DifferentialPlotArea::draw(RenderTarget& dst) { | 674 | void DifferentialPlotArea::draw(RenderTarget& dst) { |
2299 | 672 | 675 | ||
2300 | 673 | // first, tile the background | 676 | // first, tile the background |
2303 | 674 | dst.tile(Recti(Vector2i(0, 0), get_inner_w(), get_inner_h()), g_gr->images().get(BG_PIC), | 677 | dst.tile(Recti(Vector2i::zero(), get_inner_w(), get_inner_h()), g_gr->images().get(BG_PIC), |
2304 | 675 | Vector2i(0, 0)); | 678 | Vector2i::zero()); |
2305 | 676 | 679 | ||
2306 | 677 | // yoffset of the zero line | 680 | // yoffset of the zero line |
2307 | 678 | float const yoffset = kSpacing + ((get_inner_h() - kSpaceBottom) - kSpacing) / 2; | 681 | float const yoffset = kSpacing + ((get_inner_h() - kSpaceBottom) - kSpacing) / 2; |
2308 | @@ -687,7 +690,7 @@ | |||
2309 | 687 | 690 | ||
2310 | 688 | // Print the min value | 691 | // Print the min value |
2311 | 689 | draw_value((boost::format("-%u") % (highest_scale_)).str(), RGBColor(125, 0, 0), | 692 | draw_value((boost::format("-%u") % (highest_scale_)).str(), RGBColor(125, 0, 0), |
2313 | 690 | Vector2f(get_inner_w() - kSpaceRight - 3, get_inner_h() - kSpacing - 23), dst); | 693 | Vector2i(get_inner_w() - kSpaceRight - 3, get_inner_h() - kSpacing - 23), dst); |
2314 | 691 | } | 694 | } |
2315 | 692 | 695 | ||
2316 | 693 | /** | 696 | /** |
2317 | 694 | 697 | ||
2318 | === modified file 'src/wui/soldierlist.cc' | |||
2319 | --- src/wui/soldierlist.cc 2017-02-25 13:27:40 +0000 | |||
2320 | +++ src/wui/soldierlist.cc 2017-05-13 13:15:21 +0000 | |||
2321 | @@ -82,7 +82,7 @@ | |||
2322 | 82 | Widelands::OPtr<Soldier> soldier; | 82 | Widelands::OPtr<Soldier> soldier; |
2323 | 83 | uint32_t row; | 83 | uint32_t row; |
2324 | 84 | uint32_t col; | 84 | uint32_t col; |
2326 | 85 | Vector2i pos; | 85 | Vector2i pos = Vector2i::zero(); |
2327 | 86 | 86 | ||
2328 | 87 | /** | 87 | /** |
2329 | 88 | * Keep track of how we last rendered this soldier, | 88 | * Keep track of how we last rendered this soldier, |
2330 | @@ -281,11 +281,11 @@ | |||
2331 | 281 | uint32_t fullrows = capacity / kMaxColumns; | 281 | uint32_t fullrows = capacity / kMaxColumns; |
2332 | 282 | 282 | ||
2333 | 283 | if (fullrows) { | 283 | if (fullrows) { |
2335 | 284 | dst.fill_rect(Rectf(0.f, 0.f, get_w(), icon_height_ * fullrows), RGBAColor(0, 0, 0, 0)); | 284 | dst.fill_rect(Recti(0, 0, get_w(), icon_height_ * fullrows), RGBAColor(0, 0, 0, 0)); |
2336 | 285 | } | 285 | } |
2337 | 286 | if (capacity % kMaxColumns) { | 286 | if (capacity % kMaxColumns) { |
2338 | 287 | dst.fill_rect( | 287 | dst.fill_rect( |
2340 | 288 | Rectf(0.f, icon_height_ * fullrows, icon_width_ * (capacity % kMaxColumns), icon_height_), | 288 | Recti(0, icon_height_ * fullrows, icon_width_ * (capacity % kMaxColumns), icon_height_), |
2341 | 289 | RGBAColor(0, 0, 0, 0)); | 289 | RGBAColor(0, 0, 0, 0)); |
2342 | 290 | } | 290 | } |
2343 | 291 | 291 | ||
2344 | @@ -297,7 +297,7 @@ | |||
2345 | 297 | 297 | ||
2346 | 298 | constexpr float kNoZoom = 1.f; | 298 | constexpr float kNoZoom = 1.f; |
2347 | 299 | soldier->draw_info_icon( | 299 | soldier->draw_info_icon( |
2349 | 300 | icon.pos.cast<float>() + Vector2f(kIconBorder, kIconBorder), kNoZoom, false, &dst); | 300 | icon.pos + Vector2i(kIconBorder, kIconBorder), kNoZoom, false, &dst); |
2350 | 301 | } | 301 | } |
2351 | 302 | } | 302 | } |
2352 | 303 | 303 | ||
2353 | @@ -398,7 +398,7 @@ | |||
2354 | 398 | 398 | ||
2355 | 399 | bool can_act = igbase_.can_act(building_.owner().player_number()); | 399 | bool can_act = igbase_.can_act(building_.owner().player_number()); |
2356 | 400 | if (upcast(Widelands::MilitarySite, ms, &building)) { | 400 | if (upcast(Widelands::MilitarySite, ms, &building)) { |
2358 | 401 | soldier_preference_.add_button(buttons, Vector2i(0, 0), | 401 | soldier_preference_.add_button(buttons, Vector2i::zero(), |
2359 | 402 | g_gr->images().get("images/wui/buildings/prefer_rookies.png"), | 402 | g_gr->images().get("images/wui/buildings/prefer_rookies.png"), |
2360 | 403 | _("Prefer Rookies")); | 403 | _("Prefer Rookies")); |
2361 | 404 | soldier_preference_.add_button(buttons, Vector2i(32, 0), | 404 | soldier_preference_.add_button(buttons, Vector2i(32, 0), |
2362 | 405 | 405 | ||
2363 | === modified file 'src/wui/warehousewindow.cc' | |||
2364 | --- src/wui/warehousewindow.cc 2017-02-27 18:28:39 +0000 | |||
2365 | +++ src/wui/warehousewindow.cc 2017-05-13 13:15:21 +0000 | |||
2366 | @@ -94,7 +94,7 @@ | |||
2367 | 94 | } | 94 | } |
2368 | 95 | assert(pic != nullptr); | 95 | assert(pic != nullptr); |
2369 | 96 | 96 | ||
2371 | 97 | dst.blit(ware_position(ware).cast<float>(), pic); | 97 | dst.blit(ware_position(ware), pic); |
2372 | 98 | } | 98 | } |
2373 | 99 | 99 | ||
2374 | 100 | /** | 100 | /** |
2375 | 101 | 101 | ||
2376 | === modified file 'src/wui/waresdisplay.cc' | |||
2377 | --- src/wui/waresdisplay.cc 2017-04-30 08:40:08 +0000 | |||
2378 | +++ src/wui/waresdisplay.cc 2017-05-13 13:15:21 +0000 | |||
2379 | @@ -320,20 +320,20 @@ | |||
2380 | 320 | "images/wui/ware_list_bg.png"); | 320 | "images/wui/ware_list_bg.png"); |
2381 | 321 | uint16_t w = bgpic->width(); | 321 | uint16_t w = bgpic->width(); |
2382 | 322 | 322 | ||
2384 | 323 | const Vector2f p = ware_position(id).cast<float>(); | 323 | const Vector2i p = ware_position(id); |
2385 | 324 | dst.blit(p, bgpic); | 324 | dst.blit(p, bgpic); |
2386 | 325 | 325 | ||
2387 | 326 | const Image* icon = type_ == Widelands::wwWORKER ? tribe_.get_worker_descr(id)->icon() : | 326 | const Image* icon = type_ == Widelands::wwWORKER ? tribe_.get_worker_descr(id)->icon() : |
2388 | 327 | tribe_.get_ware_descr(id)->icon(); | 327 | tribe_.get_ware_descr(id)->icon(); |
2389 | 328 | 328 | ||
2391 | 329 | dst.blit(p + Vector2f((w - WARE_MENU_PIC_WIDTH) / 2.f, 1.f), icon); | 329 | dst.blit(p + Vector2i((w - WARE_MENU_PIC_WIDTH) / 2, 1), icon); |
2392 | 330 | 330 | ||
2394 | 331 | dst.fill_rect(Rectf(p + Vector2f(0.f, WARE_MENU_PIC_HEIGHT), w, WARE_MENU_INFO_SIZE), | 331 | dst.fill_rect(Recti(p + Vector2i(0, WARE_MENU_PIC_HEIGHT), w, WARE_MENU_INFO_SIZE), |
2395 | 332 | info_color_for_ware(id)); | 332 | info_color_for_ware(id)); |
2396 | 333 | 333 | ||
2397 | 334 | const Image* text = UI::g_fh1->render(as_waresinfo(info_for_ware(id))); | 334 | const Image* text = UI::g_fh1->render(as_waresinfo(info_for_ware(id))); |
2398 | 335 | if (text) // might be zero when there is no info text. | 335 | if (text) // might be zero when there is no info text. |
2400 | 336 | dst.blit(p + Vector2f(w - text->width() - 1, | 336 | dst.blit(p + Vector2i(w - text->width() - 1, |
2401 | 337 | WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + 1 - text->height()), | 337 | WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + 1 - text->height()), |
2402 | 338 | text); | 338 | text); |
2403 | 339 | } | 339 | } |
Continuous integration builds have changed state:
Travis build 2111. State: passed. Details: https:/ /travis- ci.org/ widelands/ widelands/ builds/ 224722001. /ci.appveyor. com/project/ widelands- dev/widelands/ build/_ widelands_ dev_widelands_ rendertarget_ ints-1946.
Appveyor build 1946. State: success. Details: https:/