Hello, I need some help with drawing a simple line on this entity somewhere between the first text
I reallly can't do 3d2d it beats me, also this code is not all mine, but i thought i wouldn't need to bother the creator for making a simple line.
[IMG]http://i.imgur.com/IGm17By.jpg[/IMG]
Also the code if it helps: [CODE]surface.CreateFont( "Bebas", {
font = "Bebas",
extended = false,
size = 35,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
function ENT:Initialize()
end
function ENT:Draw()
self:DrawModel()
self:SetColor( Color( 115, 0, 0, 255 ) )
self:SetMaterial("models/shiny")
local Pos = self:GetPos()
local Ang = self:GetAngles()
local owner = self:Getowning_ent()
owner = (IsValid(owner) and owner:Nick()) or DarkRP.getPhrase("unknown")
local health_amount = self:GetNWInt("Health_amount")
surface.SetFont("Bebas")
local text = "Health"
local text2 = "VIP"
local TextWidth = surface.GetTextSize(text)
local TextWidth4 = surface.GetTextSize(text2)
local TextWidth2 = surface.GetTextSize(owner)
local TextWidth3 = surface.GetTextSize(health_amount)
Ang:RotateAroundAxis(Ang:Up(), 90)
cam.Start3D2D(Pos + Ang:Up() * 8, Ang, 0.11)-- 11.5
draw.RoundedBox( 8, -100, -100, 200, 170, Color( 64, 64, 64, 0 ) ) -- Color( 255, 0, 0, 255 )
-- draw.WordBox(2, -TextWidth*0.5, -90, text, "BEBAS", Color(0, 255, 63, 0), Color(0, 0, 0,255))
-- draw.WordBox(2, -TextWidth4*0.5, -60, text2, "BEBAS", Color(64, 64, 64, 0), Color(0, 0, 0,255))
draw.WordBox(2, -TextWidth*0.5, -90, text, "Bebas", Color(0, 255, 63, 0), Color(0, 0, 0,255))
draw.WordBox(2, -TextWidth4*0.5, -60, text2, "Bebas", Color(64, 64, 64, 0), Color(0, 0, 0,255))
--draw.RoundedBox( 8, -50, -20, 105, 80, Color( 64, 64, 64, 255 ) ) -- Color( 255, 0, 0, 255 )
--draw.WordBox(2, -TextWidth3*0.5, 0, health_amount, "BEBAS", Color(140, 0, 0, 0), Color(0, 0, 0,255))
draw.WordBox(2, -TextWidth3*0.5, 0, health_amount, "Bebas", Color(140, 0, 0, 0), Color(0, 0, 0,255))
cam.End3D2D()
Ang:RotateAroundAxis( Ang:Forward(), 90 )
cam.Start3D2D(Pos + Ang:Up() * 10.5, Ang, 0.11)-- 11.5
draw.RoundedBox( 0, -98, -70, 195, 60, Color(178,34,34) )
draw.WordBox(2, -TextWidth2*0.5, -60, owner, "Bebas", Color(0, 0, 0, 0), Color(0, 0, 0,255))
--surface.SetDrawColor( 255, 255, 255, 255 )
--surface.SetMaterial( Material( "icon16/star.png" ) )
--surface.DrawTexturedRect( 0, 0, 128, 128 )
cam.End3D2D()
cam.Start3D2D(Pos + Ang:Up() * 20, Ang, 0.10)
-- draw.RoundedBox( 0, -98, -70, 195, 60, Color(125,62,125))
-- WHERE THE LINE SHOULD BE --
cam.End3D2D()
end
function ENT:Think()
end[/CODE]
You gotta just mess around with this stuff before you can begin to understand 3D2D.
As for your question. You don't need to even think about angles or axis or anything. He already did that for you. Just simply insert a DrawLine func or draw.RounedBox(for thicker lines) somewhere in here:
[CODE]
cam.Start3D2D(Pos + Ang:Up() * 8, Ang, 0.11)-- 11.5
draw.RoundedBox( 8, -100, -100, 200, 170, Color( 64, 64, 64, 0 ) ) -- Color( 255, 0, 0, 255 )
-- draw.WordBox(2, -TextWidth*0.5, -90, text, "BEBAS", Color(0, 255, 63, 0), Color(0, 0, 0,255))
-- draw.WordBox(2, -TextWidth4*0.5, -60, text2, "BEBAS", Color(64, 64, 64, 0), Color(0, 0, 0,255))
draw.WordBox(2, -TextWidth*0.5, -90, text, "Bebas", Color(0, 255, 63, 0), Color(0, 0, 0,255))
draw.WordBox(2, -TextWidth4*0.5, -60, text2, "Bebas", Color(64, 64, 64, 0), Color(0, 0, 0,255))
--draw.RoundedBox( 8, -50, -20, 105, 80, Color( 64, 64, 64, 255 ) ) -- Color( 255, 0, 0, 255 )
--draw.WordBox(2, -TextWidth3*0.5, 0, health_amount, "BEBAS", Color(140, 0, 0, 0), Color(0, 0, 0,255))
draw.WordBox(2, -TextWidth3*0.5, 0, health_amount, "Bebas", Color(140, 0, 0, 0), Color(0, 0, 0,255))
cam.End3D2D()
[/CODE]
You can just mess around with the variables of the draw line func to get the line right. :)
Sorry, you need to Log In to post a reply to this thread.