FWGS / hlsdk-portable

Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
https://xash.su
Other
260 stars 120 forks source link

Proof of concept: VGUI2 support #269

Open FreeSlave opened 2 years ago

FreeSlave commented 2 years ago

Maybe we should add a branch with VGUI2 support. Ideally the same client binary should be usable in both GoldSource and Xash3D. Of course Xash3D can't benefit from VGUI2 in client library, but the presence of VGUI2 shouldn't break starting the game under Xash3D.

a1batross commented 2 years ago

the presence of VGUI2 shouldn't break starting the game under Xash3D.

Unfortunately, VGUI2 is designed that way that it will break if one of VGUI2, FileSystem, Tier0, VStdlib and other Source libraries are missing.

Sure, we may never call it, but then what's the point of having an alternative UI that never gets drawn under an engine that doesn't support it?

FreeSlave commented 2 years ago

Sure, we may never call it, but then what's the point of having an alternative UI that never gets drawn under an engine that doesn't support it?

Mod-makers could use IsXashFWGS checks to never call VGUI2 on Xash3D, but call it on GoldSource.

It's really just about about the ease distribution. If Xash3D allows the client library have some other name, then modders could just distribute client.dll and client-xash3d.dll (without any links to VGUI2) in the mod archive.

It's also nice to have VGUI2 (at least as a branch) for completeness.

In Field Intensity I didn't use VGUI2, but I had to use IsXashFWGS to avoid calling custom scaling code as scaling applies automatically on Xash3D (at least on FWGS, I've never tested how it works on original Xash3D). I also chose different text drawing methods depending on the endine.

a1batross commented 2 years ago

Mod probably will use VGUI2 to show something important on screen.

If Xash doesn't work with VGUI2, then there is no need for engine checks as mod just doesn't work as intended. And it's my bug, to be honest.

FreeSlave commented 2 years ago

Mod probably will use VGUI2 to show something important on screen.

A mod can use VGUI2 just to render scalable texts, like Counter Strike does.

a1batross commented 2 years ago

A mod can use VGUI2 just to render scalable texts, like Counter Strike does.

And that would not render on Xash or look ugly. In the meanwhile, we could do something about VGUI2 support, but mod already has a dumb check for the engine it's running on that we can't avoid.

Theoretically, such mods can go through VGUI2DrawCharacter(Additive) callbacks in engine interface, that has additional font argument to set up the scale and typeface. But font handle itself must be acquired through scheme interface of VGUI2 that's not exposed into client.

FreeSlave commented 4 months ago

Partial work has been done in https://github.com/FWGS/hlsdk-portable/pull/447