ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:hudlib

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
Last revisionBoth sides next revision
functions:hudlib [2016/08/08 19:10] korshunfunctions:hudlib [2016/10/16 13:29] – [Hudlib] korshun
Line 7: Line 7:
 Only drawing functions actually draw stuff. All other functions only manipulate render state. Only drawing functions actually draw stuff. All other functions only manipulate render state.
  
-Only drawing functions change ZDoom's global message settings[[zdoom>SetHudSize]] and [[zdoom>SetFont]].+Drawing functions change ZDoom's global message settings ([[zdoom>SetHudSize]] and [[zdoom>SetFont]]) every time they are calledOther functions do not touch them. 
 + 
 +===== Examples ===== 
 + 
 +==== Simple 2D drawing ==== 
 + 
 +<code> 
 +HudSetPoint(320.0, 240.0); 
 +HudDrawText(1, "Hello!"); 
 +</code> 
 + 
 +==== Simple 3D drawing ==== 
 + 
 +<code> 
 +HudSetCameraActor(0); 
 +HudSetPoint3D(0.0, 0.0, 0.0); 
 +HudDrawText(2, "This is the center of the map!"); 
 +</code>
  
 ===== Virtual screen size ===== ===== Virtual screen size =====
Line 18: Line 35:
 ''void HudSetVirtualSize(fixed width, fixed height)'' ''void HudSetVirtualSize(fixed width, fixed height)''
  
-Sets the virtual screen size to the given dimensions. The default size is 640x480. This works exactly like ''SetHudSize''.+Sets the virtual screen size to the given dimensions. The default size is 640x480. This works exactly like ''[[zdoom>SetHudSize]]''.
  
 ==== HudUseRealSize ==== ==== HudUseRealSize ====
Line 34: Line 51:
  
 Controls whether the statusbar area should be included into the virtual screen. This corresponds to the third parameter of ''[[zdoom>SetHudSize]]'' Controls whether the statusbar area should be included into the virtual screen. This corresponds to the third parameter of ''[[zdoom>SetHudSize]]''
 +
 +===== Widescreen support =====
 +
 +==== Hud boundaries ====
 +''fixed HudLeft()''
 +
 +''fixed HudRight()''
 +
 +''fixed HudTop()''
 +
 +''fixed HudBottom()''
 +
 +Return the boundaries of the screen for current virtual screen size, accounting for current **physical** aspect ratio. Equivalent to adding or subtracting a hud border manually.
 +
 +**Example**
 +
 +<code>
 +// This message will stick to the left border of the screen (with a gap), even in widescren.
 +HudSetPoint(HudLeft() + 3.0, 240.0);
 +</code>
 +
 +==== Hud borders ====
 +''fixed HudBorderX()''
 +
 +''fixed HudBorderY()''
 +
 +Return hud borders for current virtual screen size, accounting for current **physical** aspect ratio.
  
 ===== 2D positioning ===== ===== 2D positioning =====
Line 210: Line 254:
 ''void HudSetShowToEveryone(bool showToEveryone)'' ''void HudSetShowToEveryone(bool showToEveryone)''
  
-If set to true, the message will be shown to everyone, and not just to the activator. This settings toggles between ''[[zdoom>HudMessage]]'' and ''[[zdoom>HudMessageBold]]'' in hudlib.+If set to true, the message will be shown to everyone, and not just to the activator. This setting toggles between ''[[zdoom>HudMessage]]'' and ''[[zdoom>HudMessageBold]]'' in hudlib.
  
 ==== HudSetLayer ==== ==== HudSetLayer ====
Line 255: Line 299:
  
 Default: (0, 0). Default: (0, 0).
 +
 +<note important>Remember that actor pitch in ZDoom is inverted.</note>
 +
 +<note tip>If you want to do ''HudSetCameraAngles(GetActorAngle(tid), -GetActorPitch(tid))'', use ''HudSetCameraActor(tid)'' instead.</note>
  
 ==== HudSetCameraActor ==== ==== HudSetCameraActor ====
Line 324: Line 372:
  
 ===== State management ===== ===== State management =====
 +
 +You can save and retrieve hudlib states using these functions. The maximum amount of saved states is configured through ''#define ACSUTILS_HUDLIB_SAVEDSTATES'' in your project's ACSUtils settings.
  
 ==== HudResetState ==== ==== HudResetState ====
Line 337: Line 387:
 Saves the current render state to a stack. Saves the current render state to a stack.
  
-<note important>There is a limit on how many states can be saved. If you save too many states, you will be notified through [[.error|the error system]].</note>+<note important>There is a limit on how many states can be saved. If you save more than ''ACSUTILS_HUDLIB_SAVEDSTATES'' states, you will be notified through [[.error|the error system]].</note>
 ==== HudPopState ==== ==== HudPopState ====
 ''void HudPopState()'' ''void HudPopState()''