Laysiks Posted February 22, 2015 Posted February 22, 2015 Helo! How can i attach dxDrawText to dxDrawImage. I'm doing it at my resolution 800x600, image is not sizable but dxDrawText when i click in guieditor showInResoltion 1024x728 this text are near image not at it. How to attach this text to image. I'm waiting for any help.
Enargy, Posted February 22, 2015 Posted February 22, 2015 Try this: local screenx, screeny = guiGetScreenSize() resolutionA = 1024 resolutionB = 764 x, y = (screenx/resolutionA ), (screeny/resolutionB )
Enargy, Posted February 22, 2015 Posted February 22, 2015 and when you say 'attach' you mean that the text on the image is outside of dxDrawImage?
Laysiks Posted February 22, 2015 Author Posted February 22, 2015 I didn't tested it bcs i need to all resolutions. Or how to set parent ? Default window dxDrawImage, how to add dxDrawText and how to do this not sizable.
Laysiks Posted February 22, 2015 Author Posted February 22, 2015 No it like that |-------------------------------| |Here is text on up window| |-------------------------------|
Enargy, Posted February 22, 2015 Posted February 22, 2015 what you can do is multiply the number of the resolution by the size of the text font; local _, screeny = guiGetScreenSize() y = (screeny/768) --height resolution 1024x768, '768' is take size = y*1.50 dxDrawText("hello", flatX, floatY, floatX, flatY, tocolor(R, G, B, A), size, "pricedown", "left", "top", false, false, false, false, false) -- values are set by you, but the 'size' is the definition of multiplication
Laysiks Posted February 22, 2015 Author Posted February 22, 2015 Still its not working good. Text in other resolution is not within image
#RooTs Posted February 22, 2015 Posted February 22, 2015 try using my calculation, example of my code local screenW,screenH = guiGetScreenSize() local resW, resH = 1280, 720 local x, y = (screenW/resW), (screenH/resH) function HudGtaV ( ) dxDrawImage(x*1145, y*110, 100, 50, "img/"..getPedWeapon(getLocalPlayer())..".png") -- image local money = string.format("%08d", getPlayerMoney(getLocalPlayer())) dxDrawText("$"..money,x*1120, y*50, x*1358, y*40,tocolor(73,208,141,255),1.0,"pricedown","left","top",false,false,false) showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) dxDrawText("".. showammo2 ,x*1150, y*75, x*1205, y*40,tocolor(255, 255, 255,255),1.0,"pricedown","right","top",false,false,false) dxDrawText("".. showammo1 ,x*1212, y*75, x*750, y*40,tocolor(190, 190, 190,255),1.0,"pricedown","left","top",false,false,false) end
Laysiks Posted February 22, 2015 Author Posted February 22, 2015 Ty #RooTs, i have one question. I must all do without editor (dxDrawImage(x*this, y*this, 100, 50..)? With editor it will be bugged.
#RooTs Posted February 22, 2015 Posted February 22, 2015 Ty #RooTs, i have one question. I must all do without editor (dxDrawImage(x*this, y*this, 100, 50..)? With editor it will be bugged. sorry, corrected. ( with the height and width are the same thing ) dxDrawImage(x*1145, y*110, x*100, y*50, "img/"..getPedWeapon(getLocalPlayer())..".png") -- image
Laysiks Posted February 22, 2015 Author Posted February 22, 2015 I'll test it but i dont have time now. i'll post if this problem end or not.
#RooTs Posted February 22, 2015 Posted February 22, 2015 I'll test it but i dont have time now. i'll post if this problem end or not. I always use these calculations in my huds.. never had problems Look https://community.multitheftauto.com/in ... &id=389640
Laysiks Posted February 22, 2015 Author Posted February 22, 2015 Ok thank you, have you notepad++ mtaLua syntax? Plugin.
#RooTs Posted February 22, 2015 Posted February 22, 2015 Ok thank you, have you notepad++ mtaLua syntax? Plugin. just got the notepad++
Laysiks Posted February 22, 2015 Author Posted February 22, 2015 I've notepad++. I have 1 question, can u change position this image to center ? Its very stupid ;p addEventHandler("onClientRender", root, function() dxDrawImage(x*400, y*100,x*500, y*400, ":Lay-New/window.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Zmień Skin", x*825, y*200, x*477, y*34, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end )
#RooTs Posted February 22, 2015 Posted February 22, 2015 I've notepad++. I have 1 question, can u change position this image to center ? Its very stupid ;p addEventHandler("onClientRender", root, function() dxDrawImage(x*400, y*100,x*500, y*400, ":Lay-New/window.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Zmień Skin", x*825, y*200, x*477, y*34, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end) -- close function ) yes you can, you must be new in LUA, right friend? addEventHandler("onClientRender", root, function() dxDrawImage(x*400, y*100,x*500, y*400, ":Lay-New/window.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Zmień Skin", x*825, y*200, x*477, y*34, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end) -- close function -- or function Event() dxDrawImage(x*400, y*100,x*500, y*400, ":Lay-New/window.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Zmień Skin", x*825, y*200, x*477, y*34, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end addEventHandler("onClientRender", root, Event )
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