Sign in to follow this  

[help]hud off screen?

Recommended Posts

so me and my scripter forged a new hud using the alternative hud resources. it looks great thanks to me :) but ive noticed that resolution plays into the positioning of the hud.

here are some screen shots of the hud


this photo is of the hud on my laptop using 1280x800x32 resolution. my friends hp touchsmart also runs a similar res and see the hud fully, but on the otherhand this pc im on and my scripter both had issues and the hud is cut off on the top. any ideas? my idea was to allow custom postioning of the hud like some speedometers do. a simplier solution would be nice though seeing as im lua illiterate. im just a artist.


Share this post

Link to post

i wouldnt say «it looks great», but whatever (some hints: dont scale (up) images unless you absolutly need to; use 2^x image sizes to prevent blurring).

on topic: try using relative positioning for the hud, which is calculated on client resource start.

anyway you should at least post the code that places the hud if you're expecting to get some help or advice.

moved to scripting section.

Share this post

Link to post

humm well i deff dont see any blur on my side...... maybe u should put ur glasses on lol.

    dxDrawImage(sWidth-177,sHeight-701,lineLength1,12.0,"healthbar.png",0.0,0.0,0.0,tocolor(255,255,255,200),true) -- Health Bar - Image 
    if money == "0" then 
    dxDrawText(tostring (money),sWidth-156,sHeight-798,sWidth-149,sHeight-57,tocolor(0,0,0,200),1.7,"arial","left","top",false,false,true) -- Money DX text (shadow) 
    dxDrawText(tostring (money),sWidth-154,sHeight-800,sWidth-150,sHeight-57,tocolor(255,255,255,200),1.7,"arial","left","top",false,false,true) -- Money DX text 
    dxDrawText(tostring (money),sWidth-156,sHeight-798,sWidth-149,sHeight-57,tocolor(0,0,0,200),1.7,"arial","left","top",false,false,true) -- Money DX text (shadow) 
    dxDrawText(tostring (money),sWidth-154,sHeight-800,sWidth-150,sHeight-57,tocolor(255,255,255,200),1.7,"arial","left","top",false,false,true) -- Money DX text    
    dxDrawImage(sWidth-177,sHeight-688,lineLength2,8.0,"armorbar.png",0.0,0.0,0.0,tocolor(255,255,255,200),true) -- Armor Bar - Image    
    ------- Weapon icons & Ammo DX drawings 
    local weaponID = getPedWeapon (getLocalPlayer()); -- Get weapon ID 
    dxDrawImage(sWidth-140,sHeight-770,66.0,65.0,"icons/".. tostring( weaponID ) .. ".png",0.0,0.0,0.0,tocolor(255,255,255,200),true) -- Weapon icons image. 
    dxDrawImage(sWidth-180,sHeight-800,195.0,122.0,"hudbackground.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) -- Background - Black 
    local hour, mins = getTime () 
    time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins)  
dxDrawText(tostring (time),sWidth-40,sHeight-800,sWidth-15,sHeight-13,tocolor(250,250,250,200),1.5,"arial","center","top",false,false,false) -- GTA Time DX text     
   -- now decide if the optional stuff should be drawn 
    if noreloadweapons [getPedWeapon(getLocalPlayer())] then 
    dxDrawText(tostring (showammo2),sWidth-200,sHeight-765,sWidth-15,sHeight-13,tocolor(255,255,255,200),3.5,"arial","right","top",false,false,true) -- No reload weapons (for shotgun, grenades, etc) 
    elseif meleespecialweapons [getPedWeapon(getLocalPlayer())] then 
    -- Draw Nothing for melee and special weapons. 
    else --Weapons that reloads. 
    dxDrawText(tostring (showammo1),sWidth-180,sHeight-775,sWidth-0,sHeight-13,tocolor(255,255,255,200),3.5,"arial","right","top",false,false,true) 
    dxDrawText(tostring (showammo2),sWidth-47,sHeight-735,sWidth-272,sHeight-12,tocolor(255,255,255,200),2,"arial","left","top",false,false,true) 
end -- End of the DX Drawing function 
addEventHandler("onClientRender", getRootElement(), DXdraw) 

Edited by Guest

Share this post

Link to post

no blur? well, whatever you say, sir.

as for code: since your hud is on top — calculate vertical offset from 0 (which is top of the screen), not the bottom (sHeight).

that way you should be fine, at least vertically.

Share this post

Link to post

sorry can u provide me with an example? i understand what your saying but im very in the dark with lua. should i replace sheight with something else?

Share this post

Link to post

you should simply put position in pixels from the top of the screen. you dont have to subtract anything or use sHeight.



Share this post

Link to post

sometimes i feel like im retarded. im looking on mtawiki atm. so i remove the sheight/width and im going to replace it with??? one i find the right command ill be in business

Share this post

Link to post

what command? dx functions need a number, a position, not any command or whatever.

sWidth and sHeight are simply variables with screen width and height in pixels, and since you've moved the hud to the top, you dont need sHeight. but you still need sWidth — cause your hud is on the right.

screen coordinates start in top left corner, which is 0,0.

well. idk what else i can say. :3

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.