• Making draw.RoundedBox button?
    2 replies, posted
Hey, I am making an entity that has a HUD interface on it. And I want to make a button on it. I already figured out how to check if the player is pressing the USE key and if all their important eye trace info. But I cant think of a way on how to check if the player is specifically looking at a certain draw.RoundedBox element. [B]What I am basically trying to do is to make something like what you could make with WireMod EGP.[/B] This is my entity drawing code [code] hook.Add("KeyPress", "MissileControl_KeyPress", function(_, key) if (key == IN_USE) then local ply = LocalPlayer() ply.isClicking = true end end) hook.Add("KeyRelease", "MissileControl_KeyRelease", function(_, key) if (key == IN_USE) then local ply = LocalPlayer() ply.isClicking = false end end) function ENT:Draw() self:DrawModel() local pos = self:GetPos() + self:GetRight() * 12 local posTxt = self:GetPos() + self:GetRight() * 12.01 local ang = self:GetAngles() ang:RotateAroundAxis(ang:Forward(), 90) cam.Start3D2D(pos, ang, 1) //How many missiles are left? Display local red = 0 local plys = player.GetAll() for k,ply in pairs(plys) do local _distance = ply:GetPos():Distance(self:GetPos()) local _hitentity = ply:GetEyeTrace().Entity local _hitpos = ply:GetEyeTrace().HitPos local _isclicking = ply.isClicking if(IsValid(ply) && _distance < 150) then if(_hitentity == self && _isclicking) then red = 255 end end end draw.RoundedBox(0,-78,-10,156,21,Color(red,0,0)) //This is the Box I am trying to turn into a button. //There is more code down here. But is not relevant to the button question. cam.End3D2D() end [/code]
[url]https://github.com/HandsomeMatt/3d2d-vgui[/url] That should point you in the right direction :)
[QUOTE=AIX-Who;46508941][url]https://github.com/HandsomeMatt/3d2d-vgui[/url] That should point you in the right direction :)[/QUOTE] I tried that, but it was too difficult to constantly move the VGUI frame according to the ent's location. Only option left is draw. elements. I heard something about util.rayintersectwithplane but I have no idea how to use it.
Sorry, you need to Log In to post a reply to this thread.