Jump to content

Write on the wall


Recommended Posts

  • Moderators
Posted

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

[b]FROM VERSION 1.3.5 r6054 ONWARDS[/b] 
  
    fRotation: Rotation 
    fRotationCenterX: Rotation Origin X 
    fRotationCenterY: Rotation Origin Y 
  
  

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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

[b]FROM VERSION 1.3.5 r6054 ONWARDS[/b] 
  
    fRotation: Rotation 
    fRotationCenterX: Rotation Origin X 
    fRotationCenterY: Rotation Origin Y 
  
  

Dont work:

        dxDrawText(text, x, y, 746, 235, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false, 0, 50, 50) 
        dxDrawText(text, x, y, 745, 234, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false, 0, 50, 50) 

  • Moderators
Posted

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

u dont understand...

addEventHandler("onClientRender", root, 
    function() 
        local x,y,z = getElementPosition( skinEx ) 
        dxDrawText(text, x, y, 746, 235, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 100, 100) 
        dxDrawText(text, x, y, 745, 234, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 100, 100) 
        dxDrawText("<- " .. text .. " ->", 417, 538, 836, 567, tocolor(0, 0, 0, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false) 
    end 
) 

  • Moderators
Posted

ah you are further then I thought, GOOD :)

Check this out man:

https://wiki.multitheftauto.com/wiki/Ge ... ldPosition

World positions aren't the same as the screen resolution, this function will convert that.

This function can also return false(when the x,y,z aren't on screen), keep that in mind. Check the returned values.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
ah you are further then I thought, GOOD :)

Check this out man:

https://wiki.multitheftauto.com/wiki/Ge ... ldPosition

World positions aren't the same as the screen resolution, this function will convert that.

This function can also return false(when the x,y,z aren't on screen), keep that in mind. Check the returned values.

Thanx. This attach relative to a point, but is not rotated so far.

    function selectorON() 
        local x, y = guiGetScreenSize() 
        local xg, yg = getScreenFromWorldPosition ( 218.19999694824, -98.5, 1005.299987793 ) 
        if ( xg and yg ) then 
            dxDrawText("Test", xg, yg, 746, 235, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 50, 50) 
            dxDrawText("Test", xg, yg, 745, 234, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, true, 0, 50, 50) 
        end 
    end 

Posted

You got the rotations wrong thought. This gave me a really bad time while working out my horizonal menu...

Look at this, it will make a 90° rotation to the right. (The three rotations in the table)

  
{270, x * 0.05 + (x*0.2), y*0.85} 
  

Explanation:

270° clockwise rotation.

x * 0.25 Right > Left screen position rotation point.

y * 0.85 Top > Down screen position rotation point.

By the way, use dxDrawText3D instead, this only rotates on a 2D way.

PD: This is how it goes for a dxDrawText every 0.2 * X in the screen. (Part of long table)

  
local x,y = guiGetScreenSize() 
        TextNow = { 
            Text1 = {"Achivements", 0.21, 0.8, 0.1,0.1,270, x * 0.05 + (x*0.2 ), y*0.85,255}, 
            Text2 = {"Rankings", 0.41   , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.4 ), y*0.85,255}, 
            Text3 = {"Tuning",0.61      , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.6 ), y*0.85,255}, 
            Text4 = {"Settings", 0.81   , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.8 ), y*0.85,255}, 
        }, 
  
--- Drawing 
  
i=1 
        local a = "Text"..i 
        dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true, false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8])   
  

EDIT: Did a small sketch to illustrate how it works:

bJY1xpt.png

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
You got the rotations wrong thought. This gave me a really bad time while working out my horizonal menu...

Look at this, it will make a 90° rotation to the right. (The three rotations in the table)

  
{270, x * 0.05 + (x*0.2), y*0.85} 
  

Explanation:

270° clockwise rotation.

x * 0.25 Right > Left screen position rotation point.

y * 0.85 Top > Down screen position rotation point.

By the way, use dxDrawText3D instead, this only rotates on a 2D way.

PD: This is how it goes for a dxDrawText every 0.2 * X in the screen. (Part of long table)

  
local x,y = guiGetScreenSize() 
        TextNow = { 
            Text1 = {"Achivements", 0.21, 0.8, 0.1,0.1,270, x * 0.05 + (x*0.2 ), y*0.85,255}, 
            Text2 = {"Rankings", 0.41   , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.4 ), y*0.85,255}, 
            Text3 = {"Tuning",0.61      , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.6 ), y*0.85,255}, 
            Text4 = {"Settings", 0.81   , 0.8, 0.1,0.1,270, x * 0.05 + (x*0.8 ), y*0.85,255}, 
        }, 
  
--- Drawing 
  
i=1 
        local a = "Text"..i 
        dxDrawText(Dashboard.Positions.TextNow[a][1] , Dashboard.Positions.TextNow[a][2] * x, Dashboard.Positions.TextNow[a][3] * y, Dashboard.Positions.TextNow[a][4] * x, Dashboard.Positions.TextNow[a][5] * y, tocolor(255,255,255,alpha),3,"clear","left", "top", true, false,true, false, true, Dashboard.Positions.TextNow[a][6], Dashboard.Positions.TextNow[a][7], Dashboard.Positions.TextNow[a][8])   
  

EDIT: Did a small sketch to illustrate how it works:

bJY1xpt.png

Thanks for your reply. Unfortunately, it did not affect my problem. The text also only rotates around its axis. And I could not test the performance of your script, it does not work for me, sorry. I noticed that on the forum wrote that the text rotation is not working.

Posted

It does work, if you want i can PM you with my menu setup. (Full working with the texts)

It just wont work for doing a 3D thing. (Since its 2D rotation)

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

Posted
If I understood you correctly:

Create a new texture (or render target) with https://wiki.multitheftauto.com/wiki/Dx ... nderTarget, then draw the text to the render target and at the end draw the render target with https://wiki.multitheftauto.com/wiki/Dx ... tionLine3D at your desired position

Thanks for the quick reply. I 'conjured' and got the expected result. Thank you.

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