Jump to content

dxDrawImage Attach dxDrawText


Laysiks

Recommended Posts

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.

Link to comment

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 

Link to comment

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 

Link to comment
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 

Link to comment

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

)

Link to comment
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 ) 
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...