ZScript: Status Bar Questions

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

So, the status bar is done. I just went through the remaining C code and decided not to export anything more, because nothing would be gained from it.
The RenderOverlay event is now activated, it will fire right after the HUD messages have been drawn, but before the (very rarely seen) system messages.
User avatar
DoomRater
Posts: 8265
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ

Re: ZScript: Status Bar Questions

Post by DoomRater »

From what I am understanding here is that when I want to design a UI I can give percentages of where something should be on the screen and what size it should be taking up, and that will be automatically scaled for me. I definitely do not want to be giving exact pixel values for HUD elements or exact pixel sizes of elements because that assumes a screen size.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

No, not percentages. What you do is specify a virtual resolution and then position it in that space in virtual pixels. The scaling will be done automatically, depending on engine settings.
Placement in percent is not usable, when you have some graphics you can best measure them in pixels, so that needs to be the base unit here.


BTW, the scaling stuff has just been cleaned up, it still requires a bit of work on the menu but that's quickly done tomorrow.
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: ZScript: Status Bar Questions

Post by Nash »

Thank you for all the work so far Graf. However, is customazible rectangle clipping still missing? I see some commented // SetClip and // Unsetclip still around the scripts.

The reason I ask is, I use DrawImage to draw some moving stuff on the status bar (as in, the position actually changes) and I'd like to explicitly define where my clip rectangles are.

I'd rather stick to using DrawImage because it's simple and does everything else perfectly.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

...zzzzz use my library already I need testers. :glare:
There's also scaling, clipping and simple Draw function that takes 5 parameters: texture, x, y, alpha and animate yes/no.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

Nash wrote:Thank you for all the work so far Graf. However, is customazible rectangle clipping still missing? I see some commented // SetClip and // Unsetclip still around the scripts.
Oops.

I implemented it in the Canvas class but forgot to export it to scripting and to the status bar.
Thanks for reminding me. I'll do it when the menu adjustments are complete.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

ZZYZX wrote:...zzzzz use my library already I need testers. :glare:.
I recommend against high level clipping. This isn't the same as using a hardware scissor function and can introduce some jitter.
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: ZScript: Status Bar Questions

Post by Nash »

ZZYZX wrote:...zzzzz use my library already I need testers. :glare:
I promise I will, for my game's in-game character and inventory menu system. I'm too dumb to figure out every little dirty detail about screen drawing so I'll definitely need it. You will get PLENTY of annoying messages and questions from me in the days to come. >8D

@Graf Zahl: Ok, awesome. Will wait for it to be implemented. For actual status bars/HUDs, the native HUD methods are perfect for my needs and I'd rather not try to fight against the engine.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

Graf Zahl wrote:I recommend against high level clipping. This isn't the same as using a hardware scissor function and can introduce some jitter.
I'm using DTA_Clip*. Unless you call this high level.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

No, that goes down to the same thing. The only problem with DTA_Clip* is that it needs to be specified for each draw command, but what was needed here is some means to set a clipping rectangle for more than one draw operation because it's far too clumsy to let this info filter down 3 or 4 function levels, which can happen in the status bar code

In the end, both pieces of info will be merged into a combined clipping rectangle.
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

I was referring to this viewtopic.php?p=986562#p986562
It exactly works with DTA_, but also eliminates the need to specify DTA_ manually for each call (and also virtualwidth/virtualheight), by calculating it based on element settings and providing it automatically.
It also allows having different relative scale for each of the nested elements.
For example, something of scale 2.0 inside the parent root something of scale 1.5, will receive the resulting scale of 3, VirtualWidth/VirtualHeight of screen/3, and XY coordinates automatically adjusted to that.

But, the user doesn't really need to know all this — he can simply use methods in Drawer — for these, only the 3.0 scale exists, top-left of the element is 0,0, and bottom-right is GetClientRect().Width and GetClientRect().Height (which is essentially mRect.Width/mRect.Height divided by the resulting scale based on all parent elements).
It even scales things that otherwise aren't scaled — Dim, Clear or DTA_Clip*.
Oh and it also provides word wrapping and text align. :D

The only real downside here is that if you use this, generic sbar functions will be unavailable.
But it should be more or less straightforward to take the required info from BaseStatusBar and setup the position/scale based on user sbar settings.

Technically: https://github.com/jewalky/zgui/blob/ma ... drawer.txt
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

I think we better not go there. Especially for status bars the high level functions do a lot of stuff that is essential for creating a working HUD.
User avatar
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript: Status Bar Questions

Post by Major Cooke »

What's the difference between BeginHUD and BeginStatusBar?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript: Status Bar Questions

Post by Graf Zahl »

These functions set the coordinate system, one for drawing a status bar (stuff gets aligned like on a normal status bar) and one for a HUD (like fullscreenoffsets in SBARINFO with stuff getting aligned to the screen edges.)
User avatar
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine

Re: ZScript: Status Bar Questions

Post by ZZYZX »

Graf Zahl wrote:I think we better not go there. Especially for status bars the high level functions do a lot of stuff that is essential for creating a working HUD.
For example?..
I think knowing this would be important in order to not accidentally create a broken statusbar, since I most definitely will eventually find myself doing certain things manually. The builtin HUD scaling is so broken...

Return to “Scripting”