awb Posted January 24, 2011 Share Posted January 24, 2011 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. thanks Link to comment
Aibo Posted January 24, 2011 Share Posted January 24, 2011 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. Link to comment
awb Posted January 24, 2011 Author Share Posted January 24, 2011 (edited) 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 else 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 end 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 -- End of the DX Drawing function addEventHandler("onClientRender", getRootElement(), DXdraw) Edited January 24, 2011 by Guest Link to comment
Aibo Posted January 24, 2011 Share Posted January 24, 2011 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. Link to comment
awb Posted January 24, 2011 Author Share Posted January 24, 2011 much appricated my soviet friend:) Link to comment
awb Posted January 24, 2011 Author Share Posted January 24, 2011 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? Link to comment
Aibo Posted January 24, 2011 Share Posted January 24, 2011 you should simply put position in pixels from the top of the screen. you dont have to subtract anything or use sHeight. PS: Link to comment
awb Posted January 24, 2011 Author Share Posted January 24, 2011 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 Link to comment
Aibo Posted January 24, 2011 Share Posted January 24, 2011 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 Link to comment
awb Posted January 24, 2011 Author Share Posted January 24, 2011 i think that cleared it up, kinda like ur motivational picture 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