Page 1 of 1
Is there a way to draw an image dynamically on a HUD?
Posted: Wed Jun 05, 2019 6:59 pm
by Alexagon
And what I mean by that is, draw an image on screen that can be moved around when some condition is met.
For example, I want to put a bar in my HUD that has the map name, but since map names vary so much in length, I wanted to know if there is a way to just draw the "end" of the bar right after the level name, so the bar never exceeds more than a few pixels after the level name. Essentially, the end of the bar moveswith the end of the level name dynamically.
I hope that makes sense. If anyone could help that'd be great.
Re: Is there a way to draw an image dynamically on a HUD?
Posted: Wed Jun 05, 2019 11:19 pm
by Dan_The_Noob
well how do you plan to measure level length?
Re: Is there a way to draw an image dynamically on a HUD?
Posted: Thu Jun 06, 2019 12:15 am
by kodi
Once you got the level name accessible as a string, you should be able to do this:
YourCurrentFont.StringWidth(LevelNameStringHere) to get the width of the string, then clip the bar drawing to that.
Re: Is there a way to draw an image dynamically on a HUD?
Posted: Sat Jun 08, 2019 8:53 pm
by Alexagon
kodi wrote:Once you got the level name accessible as a string, you should be able to do this:
YourCurrentFont.StringWidth(LevelNameStringHere) to get the width of the string, then clip the bar drawing to that.
I'm not following entirely. How would I format it with this code I'm using?:
Code: Select all
drawstring CONFONT, white, levellump, 9, 6, 0, alignment (left);
drawstring CONFONT, white, levelname, 60, 6, 0, alignment (left);
Re: Is there a way to draw an image dynamically on a HUD?
Posted: Fri Jun 14, 2019 1:00 am
by Alexagon
anyone else able to help me with this?
Re: Is there a way to draw an image dynamically on a HUD?
Posted: Fri Jun 14, 2019 2:56 am
by Graf Zahl
No, not with SBARINFO. That is totally static.
If you want more dynamic effects you'll have to code your HUD in ZScript.
Re: Is there a way to draw an image dynamically on a HUD?
Posted: Fri Jun 14, 2019 11:49 pm
by Alexagon
Graf Zahl wrote:No, not with SBARINFO. That is totally static.
If you want more dynamic effects you'll have to code your HUD in ZScript.
Ok. Thank you.