Jump to content

Add borders to dxtext ?


novo

Recommended Posts

Draw a few black (or whatever you want the border color to be) labels with some offset and the main label on the top. Example:

dxDrawText("Text with border",100-1,100,100-1,100,tocolor(0,0,0,255)) 
dxDrawText("Text with border",100+1,100,100+1,100,tocolor(0,0,0,255)) 
dxDrawText("Text with border",100,100-1,100,100-1,tocolor(0,0,0,255)) 
dxDrawText("Text with border",100,100+1,100,100+1,tocolor(0,0,0,255)) 
dxDrawText("Text with border",100,100,100,100,tocolor(255,255,255,255)) 

This will draw white text with black border at coordinates (100, 100). The border width will be 1 because this number is added to or subtracted from border labels.

Link to comment

How can i change this:

dxDrawColorText ('#00FF00Spectators: (#FFFFFF' .. #Spectators .. '#00FF00)', 2, screenHeight - dxGetFontHeight(3.00, 'bankgothic')/2, 100, 100, tocolor ( 255, 255, 255, 255 ), 0.55, 'bankgothic', 0.55, 'left') 

?

Plz help.

Thanks <3

Link to comment
How can i change this:
dxDrawColorText ('#00FF00Spectators: (#FFFFFF' .. #Spectators .. '#00FF00)', 2, screenHeight - dxGetFontHeight(3.00, 'bankgothic')/2, 100, 100, tocolor ( 255, 255, 255, 255 ), 0.55, 'bankgothic', 0.55, 'left') 

?

Plz help.

Thanks <3

How can I change this?

doifjsdfjsdoijfsdofjdasogjsoåajgsdoifjsdfjsdoijfsdofjdasogjsoåajgsdoifjsdfjsdoijfsdofjdasogjsoåajgs

Please be a little more clear when you ask questions...

Link to comment
I mean, how can i change that code for have borders.

First.. Is ' dxDrawColorText ' a custom function you have written?

' dxDrawColorText ' does not exist in MTA. You should use ' dxDrawText '

Have a look at this example

  
local rootElement = getRootElement() 
local screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolution 
  
  
function createText ( ) 
    local playerX, playerY, playerZ = getElementPosition( getLocalPlayer() )  -- Get player's coordinates. 
    local playerZoneName =  getZoneName( playerX, playerY, playerZ )          -- Get name of the player's zone. 
  
    dxDrawText( playerZoneName, 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" )    -- Draw Zone Name text shadow. 
    dxDrawText( playerZoneName, 44, screenHeight-43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) -- Draw Zone Name text. 
end 
  
  
function HandleTheRendering() 
    addEventHandler("onClientRender",rootElement, createText) -- keep the text visible with onClientRender. 
end 
addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) 
  

Source: https://wiki.multitheftauto.com/wiki/DxDrawText

Link to comment

It's not the same. A few displaced labels give the border the same width in all places, while one scaled label makes the border thinner near the center. Sometimes the difference may be small enough, but my way is more universal.

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