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 » Sat Apr 01, 2017 11:49 am

In what way is it broken?
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 12:24 pm

D4D's credit counter for example, which uses ACS's HUDMessage. That thing is tiny now...
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007

Re: ZScript: Status Bar Questions

Postby ZZYZX » Sat Apr 01, 2017 12:27 pm

I'm on the phone right now, but you might remember how statusbar gets squished with nonstandard video modes, I've made a bug about it earlier. Thanks to this fine example of weird aspect heuristics I'd want to use manual scaling and positioning whenever possible now, but first I need to know what needs to be done before handmade library can compete with builtin statusbar code (provided all the statusbar info is available).
Also, apparently it's not possible to create a non-fullscreen non-4:3 statusbar.

And either way I'd like to know some of the magic that I don't do, but BaseStatusBar does.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Sat Apr 01, 2017 1:44 pm

ZZYZX wrote:Thanks to this fine example of weird aspect heuristics I'd want to use manual scaling and positioning whenever possible now



It does work for all screen sizes without a forced aspect ratio. I already fixed a huge part of the problems in the scaling logic and most importantly consolidated most of it into a single function. To say that this was a gigantic mess would be a huge understatement.

The ones with a forced aspect ratio that cause a non-1:1 pixel ratio are a different story, but it's still better to work towards a generic solution than trying to cook up some workaround that is bound to bite you in the ass later like a hungry piranha.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby ZZYZX » Sun Apr 02, 2017 12:36 am

...yet still no answer about what exactly does statusbar do that I can't.
You've been talking about it 3 months ago, you're talking about it now, but you don't specify what exactly is this advanced processing that people don't do in RenderOverlay that's done in statusbar.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: ZScript: Status Bar Questions

Postby Major Cooke » Sun Apr 02, 2017 12:48 am

I would like to know as well.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Sun Apr 02, 2017 2:21 am

ZZYZX wrote:...yet still no answer about what exactly does statusbar do that I can't.
You've been talking about it 3 months ago, you're talking about it now, but you don't specify what exactly is this advanced processing that people don't do in RenderOverlay that's done in statusbar.



There is no advanced processing. The problem with your render overlay was that it did not properly integrate with the rest of the HUD drawing and that it had no access to the current HUD state. It wasn't so much about what it cannot do but what it could not check. Having a HUD that doesn't obey user settings is bound to annoy those users.
The key part of the status bar code is that its draw functions automatically adjust to the user settings for UI scale and that the standard use cases allow calling them with far less parameters than the low level draw functions. Remember, this is supposed to replace SBARINFO, and that'd make explicitly specifying the scale size for each element exceedingly clumsy.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby ZZYZX » Sun Apr 02, 2017 3:01 am

Ok, thanks.

But anyway, I already have my own library to manage scaling automatically for all current Screen static methods, and I'll only need to make it support uiscale.
My main problem was that you told me at least twice that this way is wrong (in this thread) and I was like o_O why.

Although I personally don't like obeying uiscale much because uiscale can't even be fractional according to what I've seen — int only. As well as other explicit scale variables...
From my experience, for example, with 1280x1024 con_scale 2 looks too large while con_scale 1 too small.

Previous virtualwidth/virtualheight approach (custom scaling under messages options menu that was in GZDoom ~1.8 or so) would produce way better results even though it'd mean uneven scaling of rows/columns.

btw: how do I adjust the size of the regular (non-fullscreen) doom statusbar? Currently it's 1:1 and centered, which means it's really small.
hud_scale only works with fullscreen.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Sun Apr 02, 2017 3:39 am

ZZYZX wrote:Although I personally don't like obeying uiscale much because uiscale can't even be fractional according to what I've seen — int only. As well as other explicit scale variables...
From my experience, for example, with 1280x1024 con_scale 2 looks too large while con_scale 1 too small.


The point here is not precision but that this is a user setting. The reason for non-integer scales is that without texture filtering it tends to look quite bad at low scaling factors. Proper UI stretching to the 1.2 pixel ratio of 320x200 only looks acceptable, for example, if the actual screen is at least 4-5x as large as 320x200, that's why the existing code couldn't even deal with that.

In order to allow proper adherence to user settings I'll have to export the GetUIScale function to ZScript first, that's what all internal code is using now, with the proper override CVAR being specified - for HUDs that'd either be hud_scale or st_scale, depending on context.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby Nash » Sun Apr 02, 2017 5:23 am

Is it possible to retrieve only the (clean)scaled coordinates of a given set of numbers? There's something I'd like to draw but the built-in BaseStatusBar methods don't support it (DTA_Overlay) so it looks like I'm going to have to draw it manually...

I basically want to draw something with the benefits of the status bar methods, but not actually use the drawing portion of them, if that makes sense. o_O
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Sun Apr 02, 2017 5:31 am

Not at the moment but what can be added is a function that receives a rectangle in virtual status bar coordinates and then returns a rectangle in screen coordinates so that you can draw it with DTA_DestWidth and DTA_DestHeight.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby Major Cooke » Sun Apr 09, 2017 1:53 pm

That would actually be appreciated because right now, I'm still trying to figure out just how I should be handling the scaling and detection of resolutions.
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Sun Apr 09, 2017 2:12 pm

You shouldn't do that at all. You should set a default resolution and align everything to that, leaving the rest to the engine. I tried to mimic SBARINFO's approach here as good as was possible.
The more you fudge around the more likely there's problems if users start altering the scaling.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript: Status Bar Questions

Postby Major Cooke » Sun Apr 09, 2017 2:22 pm

Good to know. I'll keep that in mind.

One other question, if they aren't already, can the x and y coordinates be made to support floats much like you did the menus?
User avatar
Major Cooke
The road to Hell is paved in the carrion she leaves behind.
 
Joined: 28 Jan 2007

Re: ZScript: Status Bar Questions

Postby Graf Zahl » Sun Apr 09, 2017 3:16 pm

They are all Vector2's which are floats. For something that can get scaled by a factor of 6 and more this is a necessity.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests