ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


hud_library

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
hud_library [2017/04/17 16:43] korshunhud_library [2017/07/09 14:26] (current) korshun
Line 1: Line 1:
-====== HUD Library State ======+====== HUD Library ====== 
 +HUD Library is an advanced replacement for [[zdoom>HudMessage]]. It uses [[HUD Library state]] instead of many function arguments and implements scaling and 3D HudMessages.
  
-HUD library state can be reset to default using [[functions:HudResetState]].+Here is an example:
  
-===== 2D drawing ===== +<code> 
-These settings apply to 2D drawing only.+HudResetState(); // Just like calling SetFont and SetHudSize before HudMessage. 
 +HudSetPoint(320.0, 240.0); 
 +HudDrawText(1, "Hello"); 
 +</code>
  
-==== 2D position =====+The only drawing functions in HUD Library are [[functions:HudDrawText]] and [[functions:HudDrawImage]]. They call [[zdoom>SetHudSize]], [[zdoom>SetFont]] and then [[zdoom>HudMessage]]([[zdoom>HudMessageBold|Bold]]) every time a message is drawn. This means that if you are mixing HUD Library with HudMesasge, then, after calling one of HudDraw* functions, your SetHudSize and SetFont settings are lost and you need to set them back.
  
-The current 2D point in the [[HUD coordinate system]] to draw the message at.+===== Scaling =====
  
-**Default:** ''0.0, 0.0''+Scaling is implemented by calling [[zdoom>SetHudSize]] with values that don't match those set in [[functions:HudSetVirtualSize]]
  
-Manipulated by [[functions:HudSetPoint]]. +For example:
----- +
-===== General appearance ===== +
-These settings affect *all* messages drawn through HUD Library. +
-==== 2D/3D mode ===== +
-Whether to draw in 2D or 3D mode.+
  
-**Default:** 2D mode.+<code> 
 +HudResetState(); 
 +HudSetVirtualSize(640.0, 480.0); 
 +HudSetScale(0.5); 
 +HudDrawText(1, "Hello"
 +</code>
  
-Manipulated by: +Will result in the following sequence of calls to ZDoom'functions: 
-  * [[functions:HudSetPoint]] (switches to 2D mode+<code> 
-  * [[functions:HudSetPoint3D]] (switches to 3D mode)+SetFont("SMALLFONT"); // Default HUD Library font 
 +SetHudSize(1280, 1024, 0); // To implement 0.5 scale 
 +HudMessage(s:"Hello"; HUDMSG_PLAIN, 1, etc); 
 +</code>
  
----- +===== 3D messages ===== 
-==== Scale ==== +HUD Library supports an accurate projection of 3D messages. 3D messages are correctly projected in [[hud_library_state#projection_mode|both software and OpenGL renderers]]
-Current X and Y scale of the message to draw.+
  
-**Default:** ''1.0, 1.0''+Example:
  
-Manipulated by: +<code
-  * [[functions:HudSetScale]] +HudResetState(); 
-  * [[functions:HudSetScaleXY]] +HudSetPoint3D(x, y, z); 
-  * [[functions:HudSetInvScale]] +HudSetCameraActor(0); // Set HUD Library camera to match the activator 
-  * [[functions:HudSetInvScaleXY]] +HudDrawText(1"Look here!") 
- +</code>
----- +
-==== Show to everyone ==== +
-Whether to use [[zdoom>HudMessage]] or [[zdoom>HudMessageBold]]. +
- +
-**Default:** ''false'' (use HudMessage+
- +
-Manipulated by [[functions:HudSetShowToEveryone]]. +
----- +
-==== Appearance time ==== +
-Duration of fade-in animation. 0 disables fade-in animation and makes the message appear instantly. +
- +
-**Default:** ''0.0'' +
- +
-Manipulated by [[functions:HudSetAppearTime]]. +
----- +
-==== Stay time ==== +
-For how long the message stays after the end of fade-in and before the beginning fade-out.  +
- +
-**Default:** ''HUD_STAYTIME_FOREVER''+
- +
-Manipulated by [[functions:HudSetStayTime]]. +
----- +
-==== Disappearance time ==== +
-Duration of fade-out animation. 0 disables fade-out animation and makes the message disappear instantly. +
- +
-**Default:** ''0.0'' +
- +
-Manipulated by [[functions:HudSetDisappearTime]]. +
----- +
-==== Blend style ==== +
-Which blend style to use for the message. Can be one of the following: +
-  * HUD_BLENDSTYLE_NORMAL -- normal translucency +
-  * HUD_BLENDSTYLE_ADDITIVE -- additive translucency +
- +
-**Default:** ''HUD_BLENDSTYLE_NORMAL'' (makes messages with alpha = 1.0 opaque). +
- +
-Manipulated by [[functions:HudSetBlendStyle]]. +
----- +
-==== Alpha ==== +
-The alpha (opaquenessof the message. +
- +
-**Default:** ''1.0'' +
- +
-Manipulated by [[functions:HudSetAlpha]]. +
----- +
-===== Text drawing ===== +
-These settings apply only to [[functions:HudDrawText]], not to [[functions:HudDrawImage]]. +
----- +
-==== Word wrap ==== +
-Whether to enable word wrap when the message goes off the right edge of the screen. +
- +
-**Default:** ''false'' +
- +
-Manipulated by [[functions:HudSetWordWrap]]. +
----- +
-===== 3D drawing ===== +
-These settings apply to 3D drawing only. +
- +
-==== 3D position ==== +
-The current 3D point to draw the message at. +
- +
-**Default:** ''0.0, 0.0, 0.0'' +
- +
-Manipulated by [[functions:HudSetPoint3D]]. +
----- +
-==== Camera position ==== +
-The 3D position of the camera that views the 3D points. +
- +
-**Default:** ''0.0, 0.0, 0.0'' +
- +
-Manipulated by: +
-  * [[functions:HudSetCameraPosition]] +
-  * [[functions:HudSetCameraActor]] +
-  * [[functions:HudSetCameraActorAdvanced]] +
- +
----- +
-==== Camera direction ==== +
-The direction of the camera that views the 3D points. +
- +
-**Default:** along the world X axis. +
- +
-Manipulated by: +
-  * [[functions:HudSetCameraAngles]] +
-  * [[functions:HudSetCameraActor]] +
-  * [[functions:HudSetCameraActorAdvanced]] +
- +
----- +
-==== 2D offset ==== +
-A 2D offset to shift the message on screen by. +
- +
-**Default:** ''0.00.0'' +
- +
-Manipulated by [[functions:HudSet2DOffset]]. +
- +
----- +
-==== Projection mode ==== +
-3D projection mode to convert 3D coordinates to 2D. Can be one of the following: +
- +
-  * HUD_PROJECTION_AUTO -- use true 3D projection if [[functions:IsOpenGL]] returns true and Y-shearing projection otherwise. +
-  * HUD_PROJECTION_3D -- true 3D projection. +
-  * HUD_PROJECTION_YSHEARING -- a 3D projection with Y-shearing like in software renderer. +
- +
-**Default:** ''HUD_PROJECTION_AUTO'' +
- +
-Manipulated by [[functions:HudSetProjectionMode]]. +
- +
----- +
-==== Auto distance scale ==== +
-Whether to multiply the scale of the message by a factor to make it change size with distance. +
- +
-**Default:** true +
- +
-Manipulated by [[functions:HudSetAutoDistanceScale]].+
  
 +[[functions:HudSetPoint3D]] switches HUD Library to 3D drawing mode, while [[functions:HudSetPoint]] switches it back to 2D mode. 3D messages support all features that 2D messages support, including scaling.
  
 +By default, 3D messages are automatically scaled with distance. You can disable this setting using [[functions:HudSetAutoDistanceScale]].
  
 +===== State operations =====
 +The whole [[HUD Library state]] can be reset to default using [[functions:HudResetState]]. It can be saved and loaded using [[functions:HudPushState]] and [[functions:HudPopState]] to a stack. The stack can be cleared using [[functions:HudClearStateStack]].
hud_library.txt · Last modified: 2017/07/09 14:26 by korshun