Jump to content

dxDrawText signature


Recommended Posts

I want to make signature more realistic, I'm using a signature font with dxDrawText it's looks like a real signature but I want to make that looks like when you are signature some document in real life.

I getting the character name with getElementData:

local name = getElementData(localPlayer, "char:name")

Suppose that the localPlayer's name is "John Cena" how can I do that "John Cena" is displaying on the screen slowly (but smoothly) letter by letter with dxDrawText?

What is the logic behind it? May I need timers and?

Link to comment

It sounds like you want to tie the amount of letters drawn by dxDrawText to a function based on the elapsed time. You can calculate the elapsed time in milliseconds by taking two time samples using getTickCount and subtracting the first one from the second. Then you have a positive number that you can multiply by a factor and then multiply with the amount of character ("John Cena" is 9 characters if you count the space character). Then you use the string.sub function in combination with the calculated character count to get the delimited text for drawing.

Good luck!

Link to comment
35 minutes ago, The_GTA said:

It sounds like you want to tie the amount of letters drawn by dxDrawText to a function based on the elapsed time. You can calculate the elapsed time in milliseconds by taking two time samples using getTickCount and subtracting the first one from the second. Then you have a positive number that you can multiply by a factor and then multiply with the amount of character ("John Cena" is 9 characters if you count the space character). Then you use the string.sub function in combination with the calculated character count to get the delimited text for drawing.

Good luck!

Hello,

Thank you. But what about string.len? I mean I use string.len for get the character count and then how can I get letter by letter?

I need to set a timer for every character or what? Sorry but I don't understand this logic well

Link to comment
1 minute ago, spaghetti1337 said:

Sorry but I don't understand this logic well

I am afraid this has a lot to do with math. Did you have basic math at school? Did you by chance also attend physics classes? Then you should know what a function with parameter t is, the time.

drawing speed = 9 characters divided by 5 seconds (5000ms)

elapsed time ms = now - start (obtained by two getTickCount() samples)

drawing length in characters = drawing-speed-ms * elapsed-time-ms

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