font.render: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
(Fixed the params section; added an example)
m (fixed the script example's spacing)
 
Line 43: Line 43:
return;
return;


if(sdl.ticks - gameMsgStart < gameMsgDuration ) {
if (sdl.ticks - gameMsgStart < gameMsgDuration ) {
if(gameMsgFont != null) {
if (gameMsgFont != null) {
gameMsgFont.render(gameMsgText, [0, gta.height-45], gta.width, 0.5, 0.0, gameMsgFont.size, gameMsgColour, true, true, false, true);
gameMsgFont.render(gameMsgText, [0, gta.height - 45], gta.width, 0.5, 0.0, gameMsgFont.size, gameMsgColour, true, true, false, true);
}
}
}
}
});
});
}}
}}

Latest revision as of 15:21, 3 October 2021

render

Signature: void render(string text, Vec2 position, float width, float align, float justify, float size, int colour, [ bool wordWrap = false, bool colourCodes = true, bool ignoreColourCodes = false, bool shadow = false ])

Usage: draw text on the screen using a font

Parameters

string text The text to draw.
Vec2 position The 2D position for the text.
float width The maximum width of the text, in pixels.
float align The horizontal alignment of the text, as a float.
float justify The justify alignment of the text, as a float.
float size The size of the text, as a float.
int colour The colour of the text, as an integer; visit the colour defines page for info.
bool wordWrap optional false Whether word wrap is enabled.
bool colourCodes optional true Whether colour codes are resolved.
bool ignoreColourCodes optional false Whether colour codes are not resolved.

Return

void

On failure: void