surface.DrawText only appears when console is open
2 replies, posted
No idea why. anybody have a similar problem?
[lua]
surface.SetDrawColor(self:GetColor())
surface.DrawRect(0,0,self:GetWide(),self:GetTall()) -- Background "outline" box
surface.DrawRect(7,7,self:GetWide() - 14,self:GetTall() - 14) -- Inner Box
surface.DrawRect(25,17,self:GetWide() - 50,self:GetTall() - 67) -- Inner box for outlined model section
surface.SetDrawColor(Color(0,0,0,255))
surface.DrawOutlinedRect(25, 17,self:GetWide() - 50, self:GetTall() - 67) -- Outline for model area
surface.SetFont("Default")
surface.SetDrawColor(Color(255,255,255,255))
surface.SetTextPos((self:GetWide() / 2) - (surface.GetTextSize(curitem.Name) / 2), (self:GetTall() / 2) + (self:GetTall() / 3))
surface.DrawText(curitem.Name)
[/lua]
Shows up fine and perfect with console open.
Also a bit back it would disappear after awhile.
How are you rendering this; I'd look at what hook you are using as the code is correct.
edit:
I stand corrected, some funky shit is going on with surface.DrawText
Tried rendering your bit, the text shows up but it's rendered as blue instead of black; when console is open it renders the correct color.
edit 2:
Got it, Instead of using SetDrawColor for the text color you have to use SetTextColor
[lua]
surface.SetDrawColor(self:GetColor())
surface.DrawRect(0,0,self:GetWide(),self:GetTall()) -- Background "outline" box
surface.DrawRect(7,7,self:GetWide() - 14,self:GetTall() - 14) -- Inner Box
surface.DrawRect(25,17,self:GetWide() - 50,self:GetTall() - 67) -- Inner box for outlined model section
surface.SetDrawColor(Color(0,0,0,255))
surface.DrawOutlinedRect(25, 17,self:GetWide() - 50, self:GetTall() - 67) -- Outline for model area
surface.SetFont("Default")
surface.SetTextColor(255,255,255,255)
surface.SetTextPos((self:GetWide() / 2) - (surface.GetTextSize(curitem.Name) / 2), (self:GetTall() / 2) + (self:GetTall() / 3))
surface.DrawText(curitem.Name)
[/lua]
You are a god among men, I tip my keyboard to you.
Thanks for the help mate.
Sorry, you need to Log In to post a reply to this thread.