Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of all dxDrawText arguments #2363

Closed
CrosRoad95 opened this issue Sep 18, 2021 · 7 comments
Closed

Get rid of all dxDrawText arguments #2363

CrosRoad95 opened this issue Sep 18, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@CrosRoad95
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Too many arguments

Describe the solution you'd like
make option to create some style userdata to pass it into dxDrawText class
pseudocode:

style = createStyle({ fontSize: 10 })
dxDrawText("tete", style)

Describe alternatives you've considered
No alternative

Additional context
For years this function grown in amount of arguments, this function keep getting harder and harder to use.
Also this amount of checks cause function to be slower as well

@CrosRoad95 CrosRoad95 added the enhancement New feature or request label Sep 18, 2021
@multitheftauto multitheftauto deleted a comment from Inder00 Sep 18, 2021
@Allerek
Copy link
Contributor

Allerek commented Sep 18, 2021

This would also allow to split arguments in few lines, which is cool and more readable.

@Vadya963
Copy link

it would be even cooler if it was like this
dxDrawText("tete", { fontSize: 10 })

@CrosRoad95
Copy link
Contributor Author

it would be even cooler if it was like this
dxDrawText("tete", { fontSize: 10 })

no, because "createStyle" would return userdata for faster access for c++

@PlatinMTA
Copy link
Contributor

PlatinMTA commented Sep 18, 2021

Does this kill backwards compatibility or its just a more efficent way to run dxDrawText? If it's the latter I like this idea, but if it's the former then I'm against it.

What I mean with a more efficent way to run dxDrawText is that you have this way, with styles, and another way which is the current one.

Seeing that draw functions are really slow we should try to get the most of it as possible. The real rn alternative is using renderTargets, which can improve the performance a lot and are pretty simple to implement, but they also have some sidedowns.

@CrosRoad95
Copy link
Contributor Author

Does this kill backwards compatibility or its just a more efficent way to run dxDrawText? If it's the latter I like this idea, but if it's the former then I'm against it.

What I mean with a more efficent way to run dxDrawText is that you have this way, with styles, and another way which is the current one.

Seeing that draw functions are really slow we should try to get the most of it as possible. The real rn alternative is using renderTargets, which can improve the performance a lot and are pretty simple to implement, but they also have some sidedowns.

my approach with userdata at second argument is easy to make compatibile with older versions, it also make it faster due you already keep in memory all properties you want

@Inder00
Copy link
Contributor

Inder00 commented Sep 18, 2021

@CrosRoad95 make a pull request to that

@Pirulax
Copy link
Contributor

Pirulax commented Sep 19, 2021

I dont think we want this.
All this adds extra run time penalty.

Theres an extension for VSC with MTA function syntax, use that + function argument labels.
Sadly this isn't Python with named arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants