From 104bfed8b5f1ac9d018bfc7a84b640463b24ea80 Mon Sep 17 00:00:00 2001 From: josteph Date: Mon, 14 Oct 2019 23:54:51 +0000 Subject: [PATCH] [print]: Center the message within the map area 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 7c6fbf343c4d4c212ed33717985be0266d28ef3b) --- src/scripting/game_lua_kernel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/game_lua_kernel.cpp b/src/scripting/game_lua_kernel.cpp index 4362118f81fa..684d347da711 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -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);