This is an old revision of the document!
Hudlib is an advanced wrapper for HudMessage that supports scaling and 3D messages. It features an OpenGL-style API instead of making one function take ten parameters.
Hudlib is based around the concept of render state, a render state is a collection of all current rendering settings that are taken into account when drawing a message.
Only drawing functions actually draw stuff. All other functions only manipulate render state.
These functions replace SetHudSize
. They work exactly the same, but hudlib needs to wrap SetHudSize
for message scaling.
void HudSetVirtualSize(fixed width, fixed height)
Sets the virtual screen size to the given dimensions. The default size is 640×480. This works exactly like SetHudSize
.
void HudUseRealSize()
Sets the virtual screen size to match the real size. This allows you to draw messages with 1:1 scale between real and virtual pixels.
void HudUseDefaultSize()
Sets the virtual screen size to 640×480.
void HudSetExcludeStatusBar(bool exclude)
Controls whether the statusbar area should be included into the virtual screen. This corresponds to the third parameter of SetHudSize
Before drawing a 2D message, you need to set its position.
void HudSetPoint(fixed x, fixed y)
Sets the position at which the messages will be drawn.
void HudDrawImage(int id, str image)
Draws the specified image at the previously set point using the given HudMessage ID.
The point of the image that will be positioned is determined by the image's sprite offsets.
void HudDrawText(int id, str text)
Draws the specified text at the previously set point using the given HudMessage ID.
The point of the text message that will positioned is determined by HudSetTextOrigin
.
Default message scale is 1.0.
void HudSetScale(fixed scale)
Sets the message scale.
void HudSetScaleXY(fixed scaleX, fixed scaleY)
Sets the horizontal and vertical scale.
void HudSetInvScale(fixed invScale)
Sets the message scale from a 1 / scale value.
void HudSetInvScaleXY(fixed invScaleX, fixed invScaleY)
Sets the horizontal and vertical scale from 1 / scale values.
Default message stay time is unlimited.
void HudSetAppearTime(fixed time)
Sets the duration of the fade-in animation of the message in seconds. 0 means that messages will appear instantly.
Default: 0.
void HudSetStayTime(fixed time)
Sets the amount of time to wait between appearing and disappearing. 0 means that the disappearing animation will start instantly after the appear animation. HUD_STAYTIME_UNLIMITED
means that the message will stay until removed by another HudMessage with the same id.
HUD_STAYTIME_UNLIMITED
will only stay for 9 hours, because this greatly simplifies the implementation.
void HudSetDisappearTime(fixed time)
Sets the duration of the fade-in animation of the message in seconds. 0 means that messages will disappear instantly.
Default message blending style is HUD_BLENDSTYLE_NORMAL.
Default message alpha is 1.0.
void HudSetBlendStyle(int blendStyle)
void HudSetAlpha(fixed alpha)
Default message font is SMALLFONT.
void HudSetFont(str font)
void HudSetCenterText(bool center)
void HudSetTextColor(int color)
void HudSetTextColorString(str colorName)
void HudSetTextTypeOn(bool typeOn)
void HudSetTextOrigin(fixed originX, fixed originY)
void HudSetTextOriginX(fixed originX)
void HudSetTextOriginY(fixed originY)
void HudSetLogMessage(bool log)
void HudSetWordWrap(bool wrap)
void HudSetShowToEveryone(bool showToEveryone)
void HudSetLayer(int layer)
void HudSetShowIn3DView(bool showIn3DView)
void HudSetShowOnFullAutomap(bool showOnFullAutomap)
void HudSetShowOnOverlayAutomap(bool showOnOverlayAutomap)
Default camera position is (0, 0, 0).
Default camera direction is the world X axis.
void HudSetCameraActor(int tid)
void HudSetCameraActor(int tid, fixed offsetX, fixed offsetY, fixed offsetZ, int flags)
Default camera position is (0, 0, 0).
Default 2D offset for 3D messages is (0, 0).
There is no default 3D position as messages are drawn in 2D by default.
void HudSetPoint3D(fixed x, fixed y, fixed z)
void HudSetPointActor(int tid, fixed offsetX, fixed offsetY, fixed offsetZ)
void HudSet2DOffset(fixed x, fixed y)
Automatic distance scaling is OFF by default.
void HudSetAutoDistanceScale(bool autoDistanceScale)
fixed HudGetDistance()
void HudResetState()
Resets hudlib render state to default.
HudPushState
.
void HudPushState()
Saves the current render state to a stack.
void HudPopState()
Restores the previous saved render state from the stack.
void HudClearStateStack()
Deletes all saved render states.