Jump to content

dx Drawing


-.Paradox.-

Recommended Posts

Hello guys, can somebody tell me how i can make these texts work in all resolution, I have no idea how to do that..Can somebody help? and thanks.

  
        dxDrawText("XP "..XP, 1214, 268, 1357, 320, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText("XP "..XP, 1214, 266, 1357, 318, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText("XP "..XP, 1212, 268, 1355, 320, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText("XP "..XP, 1212, 266, 1355, 318, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText("XP "..XP, 1213, 267, 1356, 319, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
  
        dxDrawText(""..LV, 1214, 284, 1357, 320, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText(""..LV, 1214, 282, 1357, 318, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText(""..LV, 1212, 284, 1355, 320, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText(""..LV, 1212, 282, 1355, 318, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
        dxDrawText(""..LV, 1213, 283, 1356, 319, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) 
--Money 
    dxDrawText(tostring (money), 1165, 28, 1350, 74, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText(tostring (money), 1165, 26, 1350, 72, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText(tostring (money), 1163, 28, 1348, 74, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText(tostring (money), 1163, 26, 1348, 72, tocolor(0, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText(tostring (money), 1164, 27, 1349, 73, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) 
--Image 
dxDrawImage(1162, 143, 145, 168, ":Ranks/rank/Rank_"..icon..".png") 
  

Link to comment

I'm not familiar with sizes as well. I got some free time yesterday and decided to make some tests with

getCursorPosition() 

and I found out that its really amazing for sizes. :fadein:

If you want to display your text on the center then:

( This will work on all resolutions )

local sx,sy =  guiGetScreenSize() 
function drawIt () 
dxDrawText("LOL",sx/2,sy/2, sx/2, sy/2,tocolor(0,255,255,255),0.8,"bankgothic","center","center",false,false,false 
end  
  
addEventHandler("onClientResourceStart", resourceRoot, 
function () addEventHandler("onClientRender", root, drawIt) end ) 

Now may god bless you. If you want them at top right or where ever you want on the screen we'll use getCursorPosition() to get the X and Y coordinates to make it fit on all resolutions.

_____________________________________________________________________________________________________________

Use the following code to get the X and Y sizes where you want to display your text.

addCommandHandler("sh", function ()  
if not showed then  
showCursor (true)  
showed = true 
else 
showCursor (false)  
showed = nil 
end  
end) 
  
addCommandHandler("cu",  
function () 
        if isCursorShowing() then 
        outputChatBox ("a") 
            local ScreX, ScreY, _, _,_ = getCursorPosition() 
            outputChatBox("SizeX: "..ScreX.." |||| SizeY: "..ScreY ) 
        end 
    end ) 

Step #1: Use the code I posted. Now execute the command /sh to toggle the cursor ( you must execute this command or else getCursorPosition() won't work.

Step #2: Once you execute /sh then place your cursor on the position where you want to display the text and then type /cu and it will output the Screen X and Y in chatbox.

Step #3: Now copy the SizeX and SizeY from the chatbox and we'll make a use of it

  
local sx,sy = guiGetScreenSize() 
local SizeX, SizeY = X,Y   --- Replace it with the Size X and Y you got from the chatbox ( with the help of getCursorPosition () 
  
function drawIt () 
dxDrawText("LOL",(SizeX)*sx,( SizeY )*sy, (  SizeX )*sx, ( SizeY )*sy,tocolor(0,255,255,255),0.8,"bankgothic","center","center",false,false,false) 
end  
  
addEventHandler("onClientResourceStart", resourceRoot, 
function () addEventHandler("onClientRender", root, drawIt) end ) 

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...