Merge lp:~widelands-dev/widelands/editor-grid into lp:widelands

Proposed by Benedikt Straub
Status: Merged
Merged at revision: 9083
Proposed branch: lp:~widelands-dev/widelands/editor-grid
Merge into: lp:widelands
Diff against target: 457 lines (+225/-6)
15 files modified
data/shaders/grid.fp (+5/-0)
data/shaders/grid.vp (+10/-0)
src/editor/editorinteractive.cc (+14/-1)
src/editor/editorinteractive.h (+3/-0)
src/graphic/CMakeLists.txt (+2/-0)
src/graphic/game_renderer.cc (+8/-0)
src/graphic/game_renderer.h (+1/-0)
src/graphic/gl/grid_program.cc (+89/-0)
src/graphic/gl/grid_program.h (+72/-0)
src/graphic/render_queue.cc (+10/-0)
src/graphic/render_queue.h (+3/-0)
src/wui/interactive_player.cc (+1/-1)
src/wui/interactive_spectator.cc (+1/-1)
src/wui/mapview.cc (+2/-1)
src/wui/mapview.h (+4/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/editor-grid
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+366505@code.launchpad.net

Commit message

Add a grid overlay to the editor that can be toggled with a button or the hotkey 'G'

Description of the change

Next try :)

I also experimented with draw_line_strip – there was no visible difference but it was a bit slower. So a new, small shader is better IMHO.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

Performance is definitely an important point!

Reviewed, tested and working :)

@bunnybot merge

review: Approve
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4802. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/524556788.
Appveyor build 4583. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_editor_grid-4583.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Refusing to merge, since Travis is not green. Use @bunnybot merge force for merging anyways.

Travis build 4802. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/524556788.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Just the usual stalled inputqueues

@bunnybot merge force

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'data/images/wui/menus/menu_toggle_grid.png'
0Binary files data/images/wui/menus/menu_toggle_grid.png 1970-01-01 00:00:00 +0000 and data/images/wui/menus/menu_toggle_grid.png 2019-04-25 16:22:57 +0000 differ0Binary files data/images/wui/menus/menu_toggle_grid.png 1970-01-01 00:00:00 +0000 and data/images/wui/menus/menu_toggle_grid.png 2019-04-25 16:22:57 +0000 differ
=== added file 'data/shaders/grid.fp'
--- data/shaders/grid.fp 1970-01-01 00:00:00 +0000
+++ data/shaders/grid.fp 2019-04-25 16:22:57 +0000
@@ -0,0 +1,5 @@
1#version 120
2
3void main() {
4 gl_FragColor = vec4(.0, .0, .0, .8);
5}
06
=== added file 'data/shaders/grid.vp'
--- data/shaders/grid.vp 1970-01-01 00:00:00 +0000
+++ data/shaders/grid.vp 2019-04-25 16:22:57 +0000
@@ -0,0 +1,10 @@
1#version 120
2
3// Attributes.
4attribute vec2 attr_position;
5
6uniform float u_z_value;
7
8void main() {
9 gl_Position = vec4(attr_position, u_z_value, 1.);
10}
011
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc 2019-04-24 15:56:31 +0000
+++ src/editor/editorinteractive.cc 2019-04-25 16:22:57 +0000
@@ -98,6 +98,10 @@
98 toggle_buildhelp_ = add_toolbar_button(98 toggle_buildhelp_ = add_toolbar_button(
99 "wui/menus/menu_toggle_buildhelp", "buildhelp", _("Show building spaces (on/off)"));99 "wui/menus/menu_toggle_buildhelp", "buildhelp", _("Show building spaces (on/off)"));
100 toggle_buildhelp_->sigclicked.connect(boost::bind(&EditorInteractive::toggle_buildhelp, this));100 toggle_buildhelp_->sigclicked.connect(boost::bind(&EditorInteractive::toggle_buildhelp, this));
101 toggle_grid_ =
102 add_toolbar_button("wui/menus/menu_toggle_grid", "grid", _("Show grid (on/off)"));
103 toggle_grid_->set_perm_pressed(true);
104 toggle_grid_->sigclicked.connect([this]() { toggle_grid(); });
101 toggle_immovables_ = add_toolbar_button(105 toggle_immovables_ = add_toolbar_button(
102 "wui/menus/menu_toggle_immovables", "immovables", _("Show immovables (on/off)"));106 "wui/menus/menu_toggle_immovables", "immovables", _("Show immovables (on/off)"));
103 toggle_immovables_->set_perm_pressed(true);107 toggle_immovables_->set_perm_pressed(true);
@@ -262,7 +266,7 @@
262266
263void EditorInteractive::draw(RenderTarget& dst) {267void EditorInteractive::draw(RenderTarget& dst) {
264 const auto& ebase = egbase();268 const auto& ebase = egbase();
265 auto* fields_to_draw = map_view()->draw_terrain(ebase, Workareas(), &dst);269 auto* fields_to_draw = map_view()->draw_terrain(ebase, Workareas(), draw_grid_, &dst);
266270
267 const float scale = 1.f / map_view()->view().zoom;271 const float scale = 1.f / map_view()->view().zoom;
268 const uint32_t gametime = ebase.get_gametime();272 const uint32_t gametime = ebase.get_gametime();
@@ -430,6 +434,11 @@
430 toggle_bobs_->set_perm_pressed(draw_bobs_);434 toggle_bobs_->set_perm_pressed(draw_bobs_);
431}435}
432436
437void EditorInteractive::toggle_grid() {
438 draw_grid_ = !draw_grid_;
439 toggle_grid_->set_perm_pressed(draw_grid_);
440}
441
433bool EditorInteractive::handle_key(bool const down, SDL_Keysym const code) {442bool EditorInteractive::handle_key(bool const down, SDL_Keysym const code) {
434 if (down) {443 if (down) {
435 switch (code.sym) {444 switch (code.sym) {
@@ -504,6 +513,10 @@
504 toggle_buildhelp();513 toggle_buildhelp();
505 return true;514 return true;
506515
516 case SDLK_g:
517 toggle_grid();
518 return true;
519
507 case SDLK_c:520 case SDLK_c:
508 set_display_flag(521 set_display_flag(
509 InteractiveBase::dfShowCensus, !get_display_flag(InteractiveBase::dfShowCensus));522 InteractiveBase::dfShowCensus, !get_display_flag(InteractiveBase::dfShowCensus));
510523
=== modified file 'src/editor/editorinteractive.h'
--- src/editor/editorinteractive.h 2019-04-24 07:09:29 +0000
+++ src/editor/editorinteractive.h 2019-04-25 16:22:57 +0000
@@ -149,6 +149,7 @@
149 void toggle_resources();149 void toggle_resources();
150 void toggle_immovables();150 void toggle_immovables();
151 void toggle_bobs();151 void toggle_bobs();
152 void toggle_grid();
152153
153 // state variables154 // state variables
154 bool need_save_;155 bool need_save_;
@@ -170,6 +171,7 @@
170 UI::UniqueWindow::Registry helpmenu_;171 UI::UniqueWindow::Registry helpmenu_;
171172
172 UI::Button* toggle_buildhelp_;173 UI::Button* toggle_buildhelp_;
174 UI::Button* toggle_grid_;
173 UI::Button* toggle_resources_;175 UI::Button* toggle_resources_;
174 UI::Button* toggle_immovables_;176 UI::Button* toggle_immovables_;
175 UI::Button* toggle_bobs_;177 UI::Button* toggle_bobs_;
@@ -182,6 +184,7 @@
182 bool draw_resources_ = true;184 bool draw_resources_ = true;
183 bool draw_immovables_ = true;185 bool draw_immovables_ = true;
184 bool draw_bobs_ = true;186 bool draw_bobs_ = true;
187 bool draw_grid_ = true;
185};188};
186189
187#endif // end of include guard: WL_EDITOR_EDITORINTERACTIVE_H190#endif // end of include guard: WL_EDITOR_EDITORINTERACTIVE_H
188191
=== modified file 'src/graphic/CMakeLists.txt'
--- src/graphic/CMakeLists.txt 2019-04-24 15:56:31 +0000
+++ src/graphic/CMakeLists.txt 2019-04-25 16:22:57 +0000
@@ -225,6 +225,8 @@
225225
226wl_library(graphic_terrain_programs226wl_library(graphic_terrain_programs
227 SRCS227 SRCS
228 gl/grid_program.cc
229 gl/grid_program.h
228 gl/road_program.cc230 gl/road_program.cc
229 gl/road_program.h231 gl/road_program.h
230 gl/terrain_program.cc232 gl/terrain_program.cc
231233
=== modified file 'src/graphic/game_renderer.cc'
--- src/graphic/game_renderer.cc 2019-04-24 15:56:31 +0000
+++ src/graphic/game_renderer.cc 2019-04-25 16:22:57 +0000
@@ -61,6 +61,7 @@
61 const FieldsToDraw& fields_to_draw,61 const FieldsToDraw& fields_to_draw,
62 const float scale,62 const float scale,
63 Workareas workarea,63 Workareas workarea,
64 bool grid,
64 RenderTarget* dst) {65 RenderTarget* dst) {
65 const Recti& bounding_rect = dst->get_rect();66 const Recti& bounding_rect = dst->get_rect();
66 const Surface& surface = dst->get_surface();67 const Surface& surface = dst->get_surface();
@@ -94,6 +95,13 @@
94 RenderQueue::instance().enqueue(i);95 RenderQueue::instance().enqueue(i);
95 }96 }
9697
98 if (grid) {
99 // Enqueue the drawing of the grid layer.
100 i.program_id = RenderQueue::Program::kTerrainGrid;
101 i.blend_mode = BlendMode::UseAlpha;
102 RenderQueue::instance().enqueue(i);
103 }
104
97 // Enqueue the drawing of the road layer.105 // Enqueue the drawing of the road layer.
98 i.program_id = RenderQueue::Program::kTerrainRoad;106 i.program_id = RenderQueue::Program::kTerrainRoad;
99 RenderQueue::instance().enqueue(i);107 RenderQueue::instance().enqueue(i);
100108
=== modified file 'src/graphic/game_renderer.h'
--- src/graphic/game_renderer.h 2019-03-11 14:45:04 +0000
+++ src/graphic/game_renderer.h 2019-04-25 16:22:57 +0000
@@ -34,6 +34,7 @@
34 const FieldsToDraw& fields_to_draw,34 const FieldsToDraw& fields_to_draw,
35 const float scale,35 const float scale,
36 Workareas workarea,36 Workareas workarea,
37 bool grid,
37 RenderTarget* dst);38 RenderTarget* dst);
3839
39// Draw the border stones for 'field' if it is a border and 'visibility' is40// Draw the border stones for 'field' if it is a border and 'visibility' is
4041
=== added file 'src/graphic/gl/grid_program.cc'
--- src/graphic/gl/grid_program.cc 1970-01-01 00:00:00 +0000
+++ src/graphic/gl/grid_program.cc 2019-04-25 16:22:57 +0000
@@ -0,0 +1,89 @@
1/*
2 * Copyright (C) 2006-2019 by the Widelands Development Team
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 */
19
20#include "graphic/gl/grid_program.h"
21
22#include "graphic/gl/coordinate_conversion.h"
23#include "graphic/gl/fields_to_draw.h"
24#include "graphic/gl/utils.h"
25#include "graphic/texture.h"
26
27GridProgram::GridProgram() {
28 gl_program_.build("grid");
29
30 attr_position_ = glGetAttribLocation(gl_program_.object(), "attr_position");
31
32 u_z_value_ = glGetUniformLocation(gl_program_.object(), "u_z_value");
33}
34
35void GridProgram::gl_draw(int gl_texture, float z_value) {
36 glUseProgram(gl_program_.object());
37
38 auto& gl_state = Gl::State::instance();
39
40 gl_array_buffer_.bind();
41 gl_array_buffer_.update(vertices_);
42
43 Gl::vertex_attrib_pointer(
44 attr_position_, 2, sizeof(PerVertexData), offsetof(PerVertexData, gl_x));
45
46 gl_state.bind(GL_TEXTURE0, gl_texture);
47
48 glUniform1f(u_z_value_, z_value);
49
50 glDrawArrays(GL_LINES, 0, vertices_.size());
51}
52
53void GridProgram::add_vertex(const FieldsToDraw::Field& field) {
54 vertices_.emplace_back();
55 PerVertexData& back = vertices_.back();
56 back.gl_x = field.gl_position.x;
57 back.gl_y = field.gl_position.y;
58}
59
60void GridProgram::draw(uint32_t texture_id,
61 const FieldsToDraw& fields_to_draw,
62 float z_value) {
63 vertices_.clear();
64 vertices_.reserve(fields_to_draw.size() * 2);
65
66 for (size_t current_index = 0; current_index < fields_to_draw.size(); ++current_index) {
67 const FieldsToDraw::Field& field = fields_to_draw.at(current_index);
68
69 // Southwestern edge
70 if (field.bln_index != FieldsToDraw::kInvalidIndex) {
71 add_vertex(fields_to_draw.at(current_index));
72 add_vertex(fields_to_draw.at(field.bln_index));
73 }
74
75 // Southeastern edge
76 if (field.brn_index != FieldsToDraw::kInvalidIndex) {
77 add_vertex(fields_to_draw.at(current_index));
78 add_vertex(fields_to_draw.at(field.brn_index));
79 }
80
81 // Eastern edge
82 if (field.rn_index != FieldsToDraw::kInvalidIndex) {
83 add_vertex(fields_to_draw.at(current_index));
84 add_vertex(fields_to_draw.at(field.rn_index));
85 }
86 }
87
88 gl_draw(texture_id, z_value);
89}
090
=== added file 'src/graphic/gl/grid_program.h'
--- src/graphic/gl/grid_program.h 1970-01-01 00:00:00 +0000
+++ src/graphic/gl/grid_program.h 2019-04-25 16:22:57 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 2006-2019 by the Widelands Development Team
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 */
19
20#ifndef WL_GRAPHIC_GL_GRID_PROGRAM_H
21#define WL_GRAPHIC_GL_GRID_PROGRAM_H
22
23#include <vector>
24
25#include "base/vector.h"
26#include "graphic/gl/fields_to_draw.h"
27#include "graphic/gl/utils.h"
28#include "logic/description_maintainer.h"
29#include "logic/map_objects/world/terrain_description.h"
30
31class GridProgram {
32public:
33 // Compiles the program. Throws on errors.
34 GridProgram();
35
36 // Draws the grid layer
37 void draw(uint32_t texture_id,
38 const FieldsToDraw& fields_to_draw,
39 float z_value);
40
41private:
42 struct PerVertexData {
43 float gl_x;
44 float gl_y;
45 };
46 static_assert(sizeof(PerVertexData) == 8, "Wrong padding.");
47
48 void gl_draw(int gl_texture, float z_value);
49
50 // Adds a vertex to the end of vertices with data from 'field'.
51 void add_vertex(const FieldsToDraw::Field& field);
52
53 // The program used for drawing the grid layer
54 Gl::Program gl_program_;
55
56 // The buffer that will contain 'vertices_' for rendering.
57 Gl::Buffer<PerVertexData> gl_array_buffer_;
58
59 // Attributes.
60 GLint attr_position_;
61
62 // Uniforms.
63 GLint u_z_value_;
64
65 // Objects below are kept around to avoid memory allocations on each frame.
66 // They could theoretically also be recreated.
67 std::vector<PerVertexData> vertices_;
68
69 DISALLOW_COPY_AND_ASSIGN(GridProgram);
70};
71
72#endif // end of include guard: WL_GRAPHIC_GL_GRID_PROGRAM_H
073
=== modified file 'src/graphic/render_queue.cc'
--- src/graphic/render_queue.cc 2019-04-25 00:03:42 +0000
+++ src/graphic/render_queue.cc 2019-04-25 16:22:57 +0000
@@ -28,6 +28,7 @@
28#include "graphic/gl/dither_program.h"28#include "graphic/gl/dither_program.h"
29#include "graphic/gl/draw_line_program.h"29#include "graphic/gl/draw_line_program.h"
30#include "graphic/gl/fill_rect_program.h"30#include "graphic/gl/fill_rect_program.h"
31#include "graphic/gl/grid_program.h"
31#include "graphic/gl/road_program.h"32#include "graphic/gl/road_program.h"
32#include "graphic/gl/terrain_program.h"33#include "graphic/gl/terrain_program.h"
33#include "graphic/gl/workarea_program.h"34#include "graphic/gl/workarea_program.h"
@@ -144,6 +145,7 @@
144 terrain_program_(new TerrainProgram()),145 terrain_program_(new TerrainProgram()),
145 dither_program_(new DitherProgram()),146 dither_program_(new DitherProgram()),
146 workarea_program_(new WorkareaProgram()),147 workarea_program_(new WorkareaProgram()),
148 grid_program_(new GridProgram()),
147 road_program_(new RoadProgram()) {149 road_program_(new RoadProgram()) {
148}150}
149151
@@ -167,6 +169,7 @@
167 case Program::kTerrainBase:169 case Program::kTerrainBase:
168 case Program::kTerrainDither:170 case Program::kTerrainDither:
169 case Program::kTerrainWorkarea:171 case Program::kTerrainWorkarea:
172 case Program::kTerrainGrid:
170 case Program::kTerrainRoad:173 case Program::kTerrainRoad:
171 /* all fallthroughs intended */174 /* all fallthroughs intended */
172 break;175 break;
@@ -262,6 +265,13 @@
262 ++i;265 ++i;
263 } break;266 } break;
264267
268 case Program::kTerrainGrid: {
269 ScopedScissor scoped_scissor(item.terrain_arguments.destination_rect);
270 grid_program_->draw(item.terrain_arguments.terrains->get(0).get_texture(0).blit_data().texture_id,
271 *item.terrain_arguments.fields_to_draw, item.z_value);
272 ++i;
273 } break;
274
265 case Program::kTerrainRoad: {275 case Program::kTerrainRoad: {
266 ScopedScissor scoped_scissor(item.terrain_arguments.destination_rect);276 ScopedScissor scoped_scissor(item.terrain_arguments.destination_rect);
267 road_program_->draw(item.terrain_arguments.renderbuffer_width,277 road_program_->draw(item.terrain_arguments.renderbuffer_width,
268278
=== modified file 'src/graphic/render_queue.h'
--- src/graphic/render_queue.h 2019-03-11 14:45:04 +0000
+++ src/graphic/render_queue.h 2019-04-25 16:22:57 +0000
@@ -36,6 +36,7 @@
36#include "logic/map_objects/world/terrain_description.h"36#include "logic/map_objects/world/terrain_description.h"
3737
38class DitherProgram;38class DitherProgram;
39class GridProgram;
39class RoadProgram;40class RoadProgram;
40class TerrainProgram;41class TerrainProgram;
41class WorkareaProgram;42class WorkareaProgram;
@@ -84,6 +85,7 @@
84 kTerrainBase,85 kTerrainBase,
85 kTerrainDither,86 kTerrainDither,
86 kTerrainWorkarea,87 kTerrainWorkarea,
88 kTerrainGrid,
87 kTerrainRoad,89 kTerrainRoad,
88 kBlit,90 kBlit,
89 kRect,91 kRect,
@@ -182,6 +184,7 @@
182 std::unique_ptr<TerrainProgram> terrain_program_;184 std::unique_ptr<TerrainProgram> terrain_program_;
183 std::unique_ptr<DitherProgram> dither_program_;185 std::unique_ptr<DitherProgram> dither_program_;
184 std::unique_ptr<WorkareaProgram> workarea_program_;186 std::unique_ptr<WorkareaProgram> workarea_program_;
187 std::unique_ptr<GridProgram> grid_program_;
185 std::unique_ptr<RoadProgram> road_program_;188 std::unique_ptr<RoadProgram> road_program_;
186189
187 std::vector<Item> blended_items_;190 std::vector<Item> blended_items_;
188191
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc 2019-04-25 00:03:42 +0000
+++ src/wui/interactive_player.cc 2019-04-25 16:22:57 +0000
@@ -288,7 +288,7 @@
288 const uint32_t gametime = gbase.get_gametime();288 const uint32_t gametime = gbase.get_gametime();
289289
290 Workareas workareas = get_workarea_overlays(map);290 Workareas workareas = get_workarea_overlays(map);
291 auto* fields_to_draw = given_map_view->draw_terrain(gbase, workareas, dst);291 auto* fields_to_draw = given_map_view->draw_terrain(gbase, workareas, false, dst);
292 const auto& road_building = road_building_overlays();292 const auto& road_building = road_building_overlays();
293293
294 const float scale = 1.f / given_map_view->view().zoom;294 const float scale = 1.f / given_map_view->view().zoom;
295295
=== modified file 'src/wui/interactive_spectator.cc'
--- src/wui/interactive_spectator.cc 2019-04-24 15:56:31 +0000
+++ src/wui/interactive_spectator.cc 2019-04-25 16:22:57 +0000
@@ -116,7 +116,7 @@
116116
117 const Widelands::Game& the_game = game();117 const Widelands::Game& the_game = game();
118 const Widelands::Map& map = the_game.map();118 const Widelands::Map& map = the_game.map();
119 auto* fields_to_draw = given_map_view->draw_terrain(the_game, get_workarea_overlays(map), dst);119 auto* fields_to_draw = given_map_view->draw_terrain(the_game, get_workarea_overlays(map), false, dst);
120 const float scale = 1.f / given_map_view->view().zoom;120 const float scale = 1.f / given_map_view->view().zoom;
121 const uint32_t gametime = the_game.get_gametime();121 const uint32_t gametime = the_game.get_gametime();
122122
123123
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2019-04-25 00:03:42 +0000
+++ src/wui/mapview.cc 2019-04-25 16:22:57 +0000
@@ -341,6 +341,7 @@
341341
342FieldsToDraw* MapView::draw_terrain(const Widelands::EditorGameBase& egbase,342FieldsToDraw* MapView::draw_terrain(const Widelands::EditorGameBase& egbase,
343 Workareas workarea,343 Workareas workarea,
344 bool grid,
344 RenderTarget* dst) {345 RenderTarget* dst) {
345 uint32_t now = SDL_GetTicks();346 uint32_t now = SDL_GetTicks();
346 while (!view_plans_.empty()) {347 while (!view_plans_.empty()) {
@@ -385,7 +386,7 @@
385386
386 fields_to_draw_.reset(egbase, view_.viewpoint, view_.zoom, dst);387 fields_to_draw_.reset(egbase, view_.viewpoint, view_.zoom, dst);
387 const float scale = 1.f / view_.zoom;388 const float scale = 1.f / view_.zoom;
388 ::draw_terrain(egbase, fields_to_draw_, scale, workarea, dst);389 ::draw_terrain(egbase, fields_to_draw_, scale, workarea, grid, dst);
389 return &fields_to_draw_;390 return &fields_to_draw_;
390}391}
391392
392393
=== modified file 'src/wui/mapview.h'
--- src/wui/mapview.h 2019-04-25 00:03:42 +0000
+++ src/wui/mapview.h 2019-04-25 16:22:57 +0000
@@ -172,8 +172,10 @@
172 // Schedules drawing of the terrain of this MapView. The returned value can172 // Schedules drawing of the terrain of this MapView. The returned value can
173 // be used to override contents of 'fields_to_draw' for player knowledge and173 // be used to override contents of 'fields_to_draw' for player knowledge and
174 // visibility, and to correctly draw map objects, overlays and text.174 // visibility, and to correctly draw map objects, overlays and text.
175 FieldsToDraw*175 FieldsToDraw* draw_terrain(const Widelands::EditorGameBase& egbase,
176 draw_terrain(const Widelands::EditorGameBase& egbase, Workareas workarea, RenderTarget* dst);176 Workareas workarea,
177 bool grid,
178 RenderTarget* dst);
177179
178 // Not overriden from UI::Panel, instead we expect to be passed the data through.180 // Not overriden from UI::Panel, instead we expect to be passed the data through.
179 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y);181 bool handle_mousepress(uint8_t btn, int32_t x, int32_t y);

Subscribers

People subscribed via source and target branches

to status/vote changes: