Blinker. Posted March 8, 2015 Share Posted March 8, 2015 Hello folks, i'm using a custom font to draw a vehicle's health ,but i got 2 problems , 1 - it lags when the number changes like if i had 99% hp and i hit someone it will go down to 90 % and here it lags for 1 sec 2 - when the number changes also , a line is drawn under the number like in this photo : http://imgur.com/9PlrSfz nothing more to say.. i've tried bangothic font and it works with 0 lag. any help would be greatly appreciated. Link to comment
Castillo Posted March 8, 2015 Share Posted March 8, 2015 Show us the code, how else can we help you? My first guess, is that you are creating the font on every render. Link to comment
Blinker. Posted March 8, 2015 Author Share Posted March 8, 2015 local font = dxCreateFont( "font.ttf",19 ) function render() local vehicle = getPedOccupiedVehicle(localPlayer) local health = math.round(((getElementHealth(vehicle)-250)/750*100),0) local speed = getElementSpeed(vehicle) if health <= 0 then health = 0 end dxDrawImage ( sw-118, sh/1.15,110,70, 'progress_health_bg.png') dxDrawImage ( sw-118, sh/1.15,speed,70, 'progress_speed.png') dxDrawText(health.."%", sw-118, (sh/1.15)+5,sw-6,1,tocolor(r,g,b,255),1,font,"right") end addEventHandler("onClientRender",root,render) Link to comment
vx89 Posted March 8, 2015 Share Posted March 8, 2015 I don't know why, but some font files have bad performance. You could try with a different font, or a different format of this font. Link to comment
Enargy, Posted March 9, 2015 Share Posted March 9, 2015 Maybe the font size provided was not created to be used to a very large size, afaik. Link to comment
Blinker. Posted March 9, 2015 Author Share Posted March 9, 2015 i've tried another custom font , it works with 0 lag. so i guess the first font "28 days later" have bad performance , thanks. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now