This library requires three components to function:
-
JGP_HudMessageHandler
class (handles the drawing) -
JGP_HudMessage
(handles the message itself) -
MAPINFO
(adds the handler)
To draw the hud message, call JGP_HudMessage.Create
from anywhere in play context. Currently cannot be called in UI scope.
static JGP_HudMessage Create(string text, uint id = 0, name fontname = 'NewSmallFont', int fontColor = Font.CR_Red, vector2 pos = (160, 50), int alignment = ALIGN_LEFT, uint fadeInTime = 0, uint typeTime = 0, uint holdTime = 35, uint fadeOutTime = 0, vector2 scale = (1,1), PlayerInfo viewer = null)
Arguments:
-
text
— the text to print. LANGUAGE references are supported. -
id
(default: 0) — the ID of the message. If non-zero, new messages will override older messages with the same ID. -
fontname
(default: 'NewSmallFont') — the name of the font to be used. -
fontcolor
(default: Font.CR_Red) — the color of the font (as defined in theFont
struct). -
pos
(default: (160, 50)) — the position of the message in a virtual 320x200 grid. Note, this is virtual resolution, so(0, 0)
corresponds to top left corner of the screen. -
alignment
(default: ALIGN_LEFT) — the alignment of the text relative to thepos
.-
JGP_HudMessage.ALIGN_CENTER
— center alignment -
JGP_HudMessage.ALIGN_LEFT
— left alignment (default) -
JGP_HudMessage.ALIGN_RIGHT
— right alignment
-
-
fadeInTime
(default: 0) — the time in tics it takes the message to fade in. If non-zero,holdTime
will begin the countdown after the message has fully faded in. -
typeTime
(default: 0) — if non-zero, each character in the string will take this amount of time in tics to apear to imitate typing. IffadeInTime
is non-zero, typing and fade-in will overlap, andholdTime
will begin counting after whatever took longer (fade-in or typing) has finished. -
holdTime
(default: 35) — the time in tics the message will stay on the screen (fade-in, fade-out and type-out are added on top of this). -
fadeOutTime
(default: 0) — the time in tics the message will take to fade out before disappearing. -
scale
(default: (1, 1)) — the scale of the text as avector2
value. -
viewer
(default: null) — aPlayerInfo
pointer. If non-null, the message will only be visible to the specified player. Otherwise it'll be visible to everyone.
MIT License (see ZSHudmsg/LICENSE.txt).