Skip to content

Commit

Permalink
[print]: Center the message within the map area
Browse files Browse the repository at this point in the history
In master, this just moves the message down by the height of the top bar.

In themes where the left end of the map isn't at x=0, this makes [print]
centered within the main map, rather than centered within the rectangle
with corners (0,0) and (bottom right corner of the main map), regardless
of where the top and left ends of the map are with respect to the screen.

Currently, the [print] messages are vertically centered, whereas the
"Planning mode activated" message is vertically at one-third of the
height. We should perhaps make these consistent, but this commit
doesn't change that.

(cherry picked from commit 7c6fbf3)
  • Loading branch information
jostephd committed Oct 15, 2019
1 parent a323c68 commit 104bfed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scripting/game_lua_kernel.cpp
Expand Up @@ -2036,7 +2036,7 @@ int game_lua_kernel::intf_print(lua_State *L) {
font::floating_label flabel(text);
flabel.set_font_size(size);
flabel.set_color(color);
flabel.set_position(rect.w/2,rect.h/2);
flabel.set_position(rect.x + rect.w/2, rect.y + rect.h/2);
flabel.set_lifetime(lifetime);
flabel.set_clip_rect(rect);

Expand Down

0 comments on commit 104bfed

Please sign in to comment.