AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   Dynamic HUD (https://forums.alliedmods.net/showthread.php?t=137894)

Scherzo 09-10-2010 19:00

Dynamic HUD
 
3 Attachment(s)
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:x, 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

alan_el_more 09-11-2010 06:21

Re: Dynamic HUD
 
WOW, THIS IS REALLY A - W - E - S - O - M - E !!!!

DaxProxy 09-11-2010 07:19

Re: Dynamic HUD
 
Now i actually might use a hud message or two.

Alka 09-11-2010 15:50

Re: Dynamic HUD
 
Actually this is really nice, i had in mind something like this but w/e. Gj

Scherzo 09-11-2010 16:56

Re: Dynamic HUD
 
1 Attachment(s)
Thanks for comments :)

There is one more .sma which I used for make video. First post has enough attachments :wink: I didnt include some functions in description, but I believe these samples and .inc file will be helpful.

Arkshine 09-11-2010 18:06

Re: Dynamic HUD
 
Quite creative. Good job. :)

abdul-rehman 09-12-2010 03:06

Re: Dynamic HUD
 
Its COOLL :D

albert123 09-13-2010 01:42

Re: Dynamic HUD
 
Very useful..you're awesome!

Owner123 09-13-2010 08:39

Re: Dynamic HUD
 
O f*ck, really AWESOME. GJ!

Moe 09-13-2010 20:43

Re: Dynamic HUD
 
Nice man, good idea! =)


All times are GMT -4. The time now is 08:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.