twhl-community / halflife-updated

Half-Life SDK updated to compile under VS2019 and 2022. Check README.md for more information.
Other
382 stars 146 forks source link

HUD scaling via triangle API #245

Open Toodles2You opened 1 month ago

Toodles2You commented 1 month ago

Real HUD scaling!

This is achieved by having HUD elements use a reference resolution, instead of the actual window resolution. Some of the engine rendering macros have been replaced with functions that call the triangle API. These new drawing functions internally scale the HUD to fit the window.

The reference resolution is 640x480 and, as such, the 640 sprite set is used.

This feature can be toggled off via the hud_scale cvar. Though, it does require a video restart. It will also be disabled for software rendering.

The nice part is that this requires no code changes in the actual HUD elements themselves.

Toodles2You commented 1 month ago

I realized that I still need to re-implement the auto-aim crosshair.

Toodles2You commented 1 month ago

I fixed the VGUI menus getting affected. I forgot they used the same macros. I ended up making changes to the HUD elements but, only to replace the old macros with new "get" functions.

sabianroberts commented 1 week ago

I've just tested this and when hud_scale is set to 0 after a video restart the HUD number sprites because scruffed up in >= 2560 resolutions. I haven't tested it in any lower resolutions yet but when I do I'll edit this comment and provide screenshots