Ui::getTextScreenWidth: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
In scripts font most of the time is passed as 1.<br>Use _SET_TEXT_ENTRY_FOR_WIDTH<br><br>param is not font from what i've tested
__TOC__
 
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">ui.getTextScreenWidth(p0);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.game.ui.getTextScreenWidth(p0);</syntaxhighlight>
 
=== Required Arguments ===
=== Required Arguments ===
*'''p0:''' Boolean
*'''p0: <font color="blue">Boolean</font>'''
 
===Return value===
===Return value===
*'''float'''
*'''<font color="green">float</font>'''
 
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
todo
const getTextWidth = (text, font, scale) => {
    mp.game.ui.setTextEntryForWidth("STRING");
    mp.game.ui.addTextComponentSubstringPlayerName(text);
    mp.game.ui.setTextFont(font);
    mp.game.ui.setTextScale(scale * 1.25, scale);
    return mp.game.ui.getTextScreenWidth(true);
};
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Ui_function_c}}
{{Ui_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:UI API]]

Latest revision as of 21:37, 2 October 2018

Syntax

mp.game.ui.getTextScreenWidth(p0);

Required Arguments

  • p0: Boolean

Return value

  • float

Example

const getTextWidth = (text, font, scale) => {
    mp.game.ui.setTextEntryForWidth("STRING");
    mp.game.ui.addTextComponentSubstringPlayerName(text);
    mp.game.ui.setTextFont(font);
    mp.game.ui.setTextScale(scale * 1.25, scale);
    return mp.game.ui.getTextScreenWidth(true);
};

See also