Named Game of the Year by over 50 publications, Valve's début title blends action and adventure with award-winning technology to create a frighteningly realistic world where players must think to survive. Also includes an exciting multiplayer mode that allows you to play against friends and enemies around the world.

Report article RSS Feed HuD Colouring

This tutorial will cover the Basics for changing the colour of the HUD in HL

Posted by Davik on Dec 4th, 2005
Basic Client Side Coding.

[page=Introduction]
Okay - first thing is open your Compiler. Half-Life was ment to be built in Microsoft Studio 6 so either get that and open the source there, or download a compiler equalivent to Microsoft's. It can be done in 7 aswell.
[page=The First Step]
After you have your stuff opened. Open your Project files etc. goto your Client Project DLL and find the hud.h file and you should see something like so:

code:
#define RGB_YELLOWISH 0x00FFFFFF //255,160,0
#define RGB_REDISH 0x00FFFFFF //255,160,0
#define RGB_GREENISH 0x00FFFFFF //0,160,0
 

Tutorial Image
The reason I say like so is because this is my changed HUD that I'm using for my HELL-FIRE mod. The comments beside them were the original RGB Color values but as you can see here, the actual code itself is more of... HEX color that you would use for your site. Now, I must admit Half life's engine has some messed up color tables.

code:
#define RGB_REDISH 0x00  << these State what the Colour will be
#define RGB_REDISH 0x00XXXXXXX << The hex colour code for the colour hud you want
#define RGB_REDISH 0x00 <<< w.e
 

Anyways...
We will work with white here.
White's color in hex is #ffffff so to get the whole hud white, we edit all three sections with that colour code.

code:
#define RGB_YELLOWISH 0x00FFFFFF //255,160,0
#define RGB_REDISH 0x00FFFFFF //255,160,0
#define RGB_GREENISH 0x00FFFFFF //0,160,0  
 

As So.....

For more Hex Colors go here: Html-color-codes.com <<< good for HUDS :D Well I hope you got it, because honestly a person who isn't the greatest at C/C++ can figure out what im trying to say :P okay... Go to the last section....

[page=Second step and final step]

Okay, so you changed the primary HUD colour, but you somehow still got an orange bar inbetween your Health and Armour. To get of that just simply follow this...

Open up Health.cpp in the client project.
and goto line 227 or somewhere near there, now you should see something like this:

code:
FillRGBA&#40;x, y, iWidth, iHeight, #, #, #, a&#41;;
 

Okay, so this time, it uses RGB Colour Format! So what do you do? Convert your HEX colour to RGB by Photoshop or a converter on the net... GOOGLE IT! Anyways don't try the one I put there... Obviously replace the # symbols with numbers, here are some examples!

code:
FillRGBA&#40;x, y, iWidth, iHeight, 0, 0, 0, a&#41;; //BLACK BAR
FillRGBA&#40;x, y, iWidth, iHeight, 255, 255, 255, a&#41;; //WHITE BAR
FillRGBA&#40;x, y, iWidth, iHeight, 255, 0, 255, a&#41;; //PURPLE BAR
 

These codes simply follow the rule of...

RED, GREEN AND BLUE for each section, so the first # is a red, second is a green, and third is a blue. Save it, and save the other if you haven't and compile :D

NOW YOUR DONE! HAVE FUN CODING!

[page=Author]
By: Davik
Email: admin@clandespair.com

Post comment Comments
Davik
Davik Dec 4 2005, 6:17pm says:

Varsity. its Almost the exact same in the HL2 Source code. ill try to put the Half-life 2 tutorial up soon :D next will be changing trip mine laser colours :D

+3 votes     reply to comment
Varsity
Varsity Dec 4 2005, 12:43pm says:

Is this for Half-Life 1 or 2?

-3 votes     reply to comment
TheDiddyHop
TheDiddyHop Oct 12 2012, 7:36pm replied:

...

+2 votes     reply to comment
Chunky
Chunky Dec 4 2005, 1:37pm says:

Half Life 1 - the HL1 icon next to the tutorial ;)

+2 votes     reply to comment
SuperRad
SuperRad Dec 5 2005, 7:13am says:

Nice I liked it

+2 votes     reply to comment
zombieOnion
zombieOnion Dec 5 2005, 4:14pm says:

this cant be for HL1. see HL1 uses sprites for HUD. those cant change color like in the tutorial. in HL2, they used fonts. fonts are vector images, and can be scaled without loosing data. they can be coloured in any color too, as long as it is monochromatic.

+1 vote     reply to comment
heavyweaponsguy153
heavyweaponsguy153 May 12 2009, 4:17pm replied:

how do you get there

+1 vote     reply to comment
The_zxeno_prophet
The_zxeno_prophet Aug 2 2009, 11:17am replied:

Yeah but the sprites for the HUD are white and you can "recolor" any sprites of HL with code

+1 vote     reply to comment
_Erebus_
_Erebus_ Oct 22 2009, 12:07am replied:

The SPR files in HL1 are white by default, and turned a different shade depending on what is defined in the client.DLL

+1 vote     reply to comment
Davik
Davik Dec 5 2005, 7:56pm says:

Trust me it is for HL1. As i can see from what you know is nothing about the source code so, your a n00b its not my fault. if you have a C++ compiler(MVS 6+) open the HL source and follow the tutorial :P Yes it uses sprites but those sprites are white.... blank... therefore you code it to be a certain colour.

+1 vote     reply to comment
Chunky
Chunky Dec 9 2005, 10:48am says:

I didn't even look through the tutorial when I said that. The icon on top was the HL2 icon, which usually means it's for HL2 :rolleyes:

+2 votes     reply to comment
Enerccio
Enerccio Aug 14 2006, 6:11pm says:

When i edit hud colour in hud.h my file hud_spectator.cpp is making this error c:\halflife\SDK\Source Code\cl_dll\hud_spectator.cpp(771): error C2668: 'sqrt' : ambiguous call to overloaded function
even when i change hud.h back to original!

+1 vote     reply to comment
Enerccio
Enerccio Aug 14 2006, 6:59pm says:

I compiled the edited file and moved to my mod cl_dll but hl is making some bad lines and couldnt get DLL API !
Whats wrong?

+1 vote     reply to comment
agrs700
agrs700 Sep 22 2006, 4:25pm says:

Guejejejei kabroncetes
hehehehehehhehehehehheheheiiiiii
uujujujujuja XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD
cool XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD

-4 votes     reply to comment
agrs700
agrs700 Sep 22 2006, 4:28pm says:

doom's day is soon....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................hip................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................/XD/XD

-3 votes     reply to comment
TheDiddyHop
TheDiddyHop Jan 27 2013, 4:45pm replied:

da fuq?

+1 vote     reply to comment
Ter3
Ter3 Jan 8 2007, 7:17am says:

Have anyone done this? I can't get it to work!!! :Æ

+2 votes     reply to comment
AcidBarrel
AcidBarrel Feb 10 2007, 7:24pm says:

Its quiet easy to get working, it's just a matter of did you change anything else prior to the colour changing?

+1 vote     reply to comment
vaynecactus
vaynecactus Jul 13 2008, 9:02am says:

Thanks man, this really helped :)

+1 vote     reply to comment
m82sniper
m82sniper Apr 23 2009, 2:57pm says:

Nice tut dude.

+1 vote     reply to comment
NanoXax67
NanoXax67 Dec 24 2009, 4:40pm says:

Can someone help me? I have Microsoft Visual 6 and I open the .dll files and I get stuck from there! Can anyone please PM me?!?!?!?!?

+1 vote     reply to comment
PeterHat
PeterHat Jan 18 2010, 8:10am says:

my c++ compiler dosent open my cillent.dll

+1 vote     reply to comment
unknow5763
unknow5763 Mar 29 2010, 12:38pm says:

actually they used a bmp

+1 vote     reply to comment
Mr-HaXoR
Mr-HaXoR Jul 4 2010, 5:05pm says:

hi i am using visual studio 2010
but how do i compile file like "hud.h"???
cant find compile any where?!

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Half-Life
Platforms
Windows, Mac, Linux, PS2, DC
Developer
Valve
Engine
GoldSource
Contact
Send Message
Release Date
Released Oct 24, 1998
Game Watch
Track this game
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Games
Half-Life
Half-Life Single & Multiplayer First Person Shooter