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()
surface.DrawRect(math.ceil(gStreamHud.Mid - (gStreamHud.Width / 2)) + 2,12,gStreamHud.Pos - 4,16)

[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
gStreamHud.Wid,gStreamHud.Hei = surface.GetTextSize(gStreamHud.Text)
if gStreamHud.Wid < 200 then
gStreamHud.Wid = 200
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)

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.


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.