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.

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Wed Mar 29, 2017 4:55 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby DoomRater » Wed Mar 29, 2017 6:14 pm

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
DoomRater
Hi, I'm bob.
 
Joined: 28 Jul 2004
Location: WATR HQ
Discord: DoomRater#6308

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Wed Mar 29, 2017 7:17 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby Nash » Wed Mar 29, 2017 8:10 pm

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: ZScript: Status Bar Questions

Postby ZZYZX » Thu Mar 30, 2017 2:10 am

...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
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Thu Mar 30, 2017 3:27 am

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 Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Thu Mar 30, 2017 3:28 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby Nash » Thu Mar 30, 2017 3:45 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: ZScript: Status Bar Questions

Postby ZZYZX » Thu Mar 30, 2017 4:58 am

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
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Thu Mar 30, 2017 5:10 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby ZZYZX » Thu Mar 30, 2017 7:36 am

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
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Thu Mar 30, 2017 10:51 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby Major Cooke » Sat Apr 01, 2017 9:42 am

What's the difference between BeginHUD and BeginStatusBar?
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Sat Apr 01, 2017 11:29 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby ZZYZX » Sat Apr 01, 2017 11:33 am

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...
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest