Text drawing under DrawRect?

I’m just cleaning up gStream a bit for use on my server and come across this problem.

Is there a way to fix it?
Here’s the relevant source snippets.

[lua]function gStreamHud.PaintBar()
//PROGRESS BAR FOREGROUND//
surface.SetDrawColor(140,140,140,230)
surface.DrawRect(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)) + 2,12,gStreamHud.Pos - 4,16)
end[/lua]

[lua]function gStreamHud.GetSong(Name,Len)
gStreamHud.Pos = 0
gStreamHud.Minz = 0
gStreamHud.Secz = 0
gStreamHud.Min = 0
gStreamHud.Sec = 0
gStreamHud.i = 0
gStreamHud.Timer = “00:00”
//gStreamHud.Text = Name…" ("…Len…")"
gStreamHud.Text = Name
surface.SetFont(“TabLarge”)
gStreamHud.Wid,gStreamHud.Hei = surface.GetTextSize(gStreamHud.Text)
if gStreamHud.Wid < 200 then
gStreamHud.Wid = 200
end
gStreamHud.Width = gStreamHud.Wid + 20
local Splodey = string.Explode(":",Len)
gStreamHud.ToSec = (Splodey[2] + (Splodey[1]*60))
timer.Create(“Counter”, 1, 0, gStreamHud.Count)
hook.Add(“HUDPaint”, “DrawBar”, gStreamHud.PaintBar)
end[/lua]

Since i can’t see where the text is being drawn i think you are drawing the text first and then the rect, try drawing the rect first and then the text.

The rect is being drawn first, But I’ll try swapping them around.

[editline]11:19AM[/editline]

Nah, Does the same thing either way around.

Whoah, hey Ben :smiley:

Try hooking it to HUDPaintBackground instead of HUDPaint

Thanks, worked :slight_smile:

The progress bar gets drawn behind the grey bar but it’s okay I can still achieve the same effect that I wanted by messing with the alpha levels.