Hi, Trying to make text that is drawn with surface.DrawText go bigger / smaller, the only way i could think of is to constantly make a new font with the math.sin() function, It does work but its awefully laggy, Any better way to change the size of text?
Might be able to use a Cam2D and set the scale of it with math.sin.
Elaborate
This function could work:
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexedb0.html[/url]
Just take a look at the first example. To accomplish what you want you simply draw this text in 3d and then let it go further away from the player, or closer to the player (dependant on if you want to make it bigger or smaller) based on the time.
It may also be possible to use the scale parameter, I have never used it but you should give it a shot.
You could lose quality of the font though.
There might also be other ways but this would definitely work.
eh, it doesnt draw anything on the PreDrawOpaqueRenderables hook.
Can you please post your code?
You should also try it with a HUDPaint hook.
[lua]
hook.Add("PostDrawOpaqueRenderables","crashty",function()
A = A + 1
if A == 360 then A = 1 end
if comboOn == 1 then
cam.Start3D2D(Vector(0,0,0),Angle(0,0,0),1)
local w,h = ScrW(),ScrH()
draw.DrawText("Test: "..count,"chatfont",w*0.01,h*0.2,Color(255-math.sin(A)*10,0,math.sin(A)*20),TEXT_ALIGN_CENTER)
cam.End3D2D()
end
end)
[/lua]
It's because you are drawing at the world spawn, here is code that works:
[CODE]hook.Add("PostDrawOpaqueRenderables","crashty",function()
local pos = EyePos();
local ang = EyeAngles();
local addpos = math.sin(RealTime())*ang:Forward()*200
cam.Start3D2D( pos + ang:Forward() * 500 + addpos, EyeAngles():Right():Angle() + Angle(0,0,90), 1);
draw.DrawText( "LOL", "HUDNumber", 2, 2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
cam.End3D2D();
end)[/CODE]
It is drawn behind other entities sometimes, but I am sure there is a hook that is suitable.
Sorry, you need to Log In to post a reply to this thread.