llunak Posted July 1, 2014 Share Posted July 1, 2014 Are there some docs, or could somebody please explain to me in brief how positioning of elements in the LUA scripts works? I'm trying to modify the GC panel to show little soldier role icons in all the minibars, so that one does not have to hover each of them for a tooltip, and I've kind of managed to get coordinates that place things correctly for me, but I'm totally confused on how it actually works. For example, it seems to me that I actually had to move the soldier role icon to the left of the soldier number (i.e. negative infobar_roleimage_left) in order to have it placed just to the right of it. Do x/y actually specify center of the item, or what am I missing? diff --git a/assets/scripts/combatguiexport_large.lua b/assets/scripts/combatguiexport_large.luaindex 334e1da..d7253ca 100644--- a/assets/scripts/combatguiexport_large.lua+++ b/assets/scripts/combatguiexport_large.lua@@ -276,10 +276,14 @@ local infobar_top = gui_background_top - infobar_height;local infobar_spacing = -4;local soldier_infobars_image = "uitextures/progressbar_fill"; -local miniprogressbar_width = infobar_width-35;+local infobar_roleimage_size = infobar_height - 14;+-- I don't quite get how this positioning works, but this value seems about right.+local infobar_roleimage_left = -6;++local miniprogressbar_width = infobar_width-33-infobar_roleimage_size;local miniprogressbar_height = 5;local miniprogressbar_top = infobar_top + 6;-local miniprogressbar_left = 7;+local miniprogressbar_left = 7 + infobar_roleimage_size/2+2;local miniprogressbar_vspacing = 4;local infobar_vehicle_left = infobar_init_x + (infobar_width+infobar_spacing)*13;@@ -1638,6 +1642,16 @@ MakeDialog barimage = soldier_infobars_image, percent = false, },+ NonUniformScaledImage+ {+ name = "soldier1_roleimage",+ x = infobar_init_x + infobar_roleimage_left,+ y = miniprogressbar_top,+ w = infobar_roleimage_size,+ h = infobar_roleimage_size,+ --image = "uitextures/roles/unused",+ aspectfix = 1.0;+ }, Window { name = "soldier1_miniPortraitPopup",@@ -1761,6 +1775,16 @@ MakeDialog barimage = soldier_infobars_image, percent = false, },+ NonUniformScaledImage+ {+ name = "soldier2_roleimage",+ x = (infobar_init_x + infobar_roleimage_left) + (infobar_width+infobar_spacing)*1,+ y = miniprogressbar_top,+ w = infobar_roleimage_size,+ h = infobar_roleimage_size,+ --image = "uitextures/roles/unused",+ aspectfix = 1.0;+ }, Window { name = "soldier2_miniPortraitPopup", Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.