• Derma being effected by held weapon
    2 replies, posted
Howdy, I'm making a fairly detailed GUI using derma for an entity. I use a loop to spit out a bunch of image buttons on the screen, and to label them. However, if you are holding a weapon from the customizable weaponry pack, the labels shift to the left strangely. Here's an idea of what I'm doing: [CODE] for k, v in ipairs(attachTable) do if k == i then local w = surface.GetTextSize(v) local DLabel = vgui.Create( "DLabel", ListItem ) DLabel:SetPos( 128/2 - w/2, ListItem.y + 108 ) DLabel:SetText( v ) DLabel:SizeToContents() end end [/CODE] Now I know that the pack is probably causing some kind of black-magics interference, but I can't really figure out a workaround. It appears to move them left a specific amount, but I can't figure out how to compare [CODE]DLabel:GetPos() with (x , y)[/CODE] or something similar. Any help, as always, is greatly appreciated!
Somewhere before calling local w = surface.GetTextSize(v) you are calling surface.SetFont("the font you are using") right? Because if you don't it will calculate based on the last font used by the surface library.
[QUOTE=wh1t3rabbit;43178145]Somewhere before calling local w = surface.GetTextSize(v) you are calling surface.SetFont("the font you are using") right? Because if you don't it will calculate based on the last font used by the surface library.[/QUOTE] Yes, of course, silly. [editline]14th December 2013[/editline] [QUOTE=Aura1;43178265]Yes, of course, silly.[/QUOTE] Actually, thanks for pointing that out, I did a doubletake at my code, and I actually didn't define the font for that DLabel. Thank you very much!
Sorry, you need to Log In to post a reply to this thread.