• HUD
    2 replies, posted
[code] -- Add 16 to the width and set the height of the box. width = width + 16; height = (20 * #information) + 14 - cutheight; -- The position of the information box. local x = 4; local y = ScrH() - height - 4; -- Increase the x and y position by 8. x = x; y = y + 16; local last_textwidth = 0 -- Draw the information on the box. for k, v in pairs(information) do textwidth, textheight = surface.GetTextSize(v[1]) if ( v[3] == true ) then draw.RoundedBox(0, x + last_textwidth + 24, y - 20, textwidth + 23, 18, Color(0, 0, 0, 200)) self:DrawInformation(v[1], "ChatFont", x + last_textwidth + 45, y - 19, Color(255, 255, 255, 255), 255, true); if ( v[2] ) then surface.SetMaterial( Material( v[2] ) ); surface.SetDrawColor(255, 255, 255, 255); surface.DrawTexturedRect(x + last_textwidth + 25, y - 19, 16, 16); end elseif ( v[2] ) then draw.RoundedBox(0, x, y, textwidth + 22, 18, Color(0, 0, 0, 200)) self:DrawInformation(v[1], "ChatFont", x + 20, y + 1, Color(255, 255, 255, 255), 255, true); -- Draw the icon that respresents the text. surface.SetMaterial( Material( v[2] ) ); surface.SetDrawColor(255, 255, 255, 255); surface.DrawTexturedRect(x + 1, y + 1, 16, 16); else draw.RoundedBox(0, x, y, width, 20, Color(0, 0, 0, 200)) self:DrawInformation(v[1], "ChatFont", x, y + 1, Color(255, 255, 255, 255), 255, true); end; -- Increase the y position. if ( !v[3] or v[3] == false ) then y = y + 20; end last_textwidth = textwidth end; -- Return the width and height of the box. return width, height; end;[/code] I think this piece of code makes it show up like: [img]https://i.gyazo.com/2c26edb2c033c359a52c3a609acfc703.png[/img] What do I have to change in the code to make it appear like this: [img]https://i.gyazo.com/75605fa349e6330eab9ff0e55815dd01.png[/img] Like what do I have to change to make it appear in a square box instead of single boxes.
I would recommend just getting rid of the draw.RoundedBox's under the "for, do" loop and just put a draw.RoundedBox before the "for, do" loop
[QUOTE=Richtofen;52271118]I would recommend just getting rid of the draw.RoundedBox's under the "for, do" loop and just put a draw.RoundedBox before the "for, do" loop[/QUOTE] And how would I do that, what I've tried so far did not work (Including your way, but I think I didn't do it right.) [editline]25th May 2017[/editline] Fixed, thanks for the help.
Sorry, you need to Log In to post a reply to this thread.