Dynamic HUD
v1.03
Start from see what i mean:
http://www.youtube.com/watch?v=mS2aUWay9D4
Interface for making attractive effects on HUD messages. You can prepare animation frame per frame or use filters to work on few frames in one call.
This is separate plugin to install with your plugin, which will use it.
Firstly create new object
Code:
DHUD_create(dhud = -1)
it allow to make copy of another dhud object, to make brand new set dhud=-1 (as in default)
Each frame is descripted by position, color and life (iLen).
Code:
DHUD_setFrame(dhud, frame, iColor[3]={0,0,0}, Float:x=0.0, Float:y=0.0, iLen = 1);
dhud is result of DHUD_create
frame is number of frame; start from 0, when > NUM it add needed frames;
fe. empty dhud object + setting frame=4 will make frames # 0,1,2,3,4
iLen is multiplier of displaying time, frame with iLen=2 will stay on screen twice longer than that with iLen=1
Filters are quick way to set many frames with given scheme
Code:
DHUD_applyFilter(dhud, const szFilter[], startFrame, endFrame, Float:dx=D_LONG, Float:dy=D_ZERO, any:...)
dhud is result of DHUD_create
szFilter[] is name of filter, type 'dhud info' in console to view list
startFrame - endFrame on these frames filter will work, endFrame can`t be greater than num of frames, so before call make sure that in dhud has enough frame,
in other case it will be clamped to 0-NUMFRAMES,
dx, dy when you want to draw path of function it allow you to autoincrement/decrement position
example is in in attachment, there is sinus function, just set first frame(0) to your values and call with dx!=0.0 ; filter will get linear growing/falling values of x,y
... are additional parameter of filter, listed in 'dhud info'
The most basic filters are SetPosition (Float
, Float:y) and SetColor(r, g, b)
Code:
DHUD_setFrame(dhud, 50);
DHUD_applyFilter(dhud, "SetPosition", 0, 50, D_ZERO, D_ZERO, 0.5, 0.5);
DHUD_applyFilter(dhud, "SetColor", 0, 50, D_ZERO, D_ZERO, 255, 255, 255);
One other is TransColor(start[3], target[3])
To display Dynamic HUD message use
Code:
DHUD_display(id, dhud, Float:fInterval = 0.1, channel = 4, const szMessage[], any:...)
id - player or 0 for all
dhud - dhud object
fInterval - time of displaying frame with iLen=1
channel - hud channel 1-4
szMessage[],... - message to display, Warning:message for all not realize valid %L LANG_PLAYER