[ACS] HudMessage width and height parameter
Moderator: GZDoom Developers
[ACS] HudMessage width and height parameter
I wonder if HudMessage could have additional parameters "Width" and "Height" to restrict drawing area into box, so everything that has gone out of this area will be cut off. This should apply with same behaviour to letters (cut off the last letter or last line) and images set by SetFont (just cut off from right and bottom).
So there could be realised some type of "windows", where all elements which have gone out out of window borders, are cut off, and the content could be displayed properly
So there could be realised some type of "windows", where all elements which have gone out out of window borders, are cut off, and the content could be displayed properly
Re: [ACS] HudMessage width and height parameter
If this is at all feasible, I think it should be a separate function altogether, like SetHudWindow or something. It would use the parameters of the previously set SetHudSize as the "window" for the next hudmessage to be drawn in. It would probably have to alter the behavior of the x and y parameters of all the following HudMessages, though - drawing them in a position relative to the window's size, rather than the screen's size.
So you'd have something like:
void SetHudWindow(int x-start, int x-end, int y-start, int y-end)
or alternatively:
void SetHudWindow(int x-start, int x-size, int y-start, int y-size)
I wonder if FDARI could bring forward his opinion/hypothesis on this.
Something like this I think would be incredibly useful, especially for things like dialogue boxes in which the text is a pain to align on multiple lines.
So you'd have something like:
void SetHudWindow(int x-start, int x-end, int y-start, int y-end)
or alternatively:
void SetHudWindow(int x-start, int x-size, int y-start, int y-size)
Code: Select all
SetHudSize(640, 480, 1);
SetHudWindow(160, 320, 300, 396); // This would create a window at [x: 160, y: 300] that is 160px wide and 96px tall.
HudMessage(s:"This is a test hudmessage that should contain text which wraps within the confines of the specified window.";
HUDMSG_PLAIN, 0, CR_RED, 80.4, 8.0, 10.0); // See below note for new x and y coordinate usage.
// x: Using 80.4 for "x" positions it in the middle of the 160px-wide window and center-aligns the text.
// y: Using 8.0 for "y" positions it 8px from the top of the window and top-aligns the text.

Re: [ACS] HudMessage width and height parameter
Your window defining style is good too, although mostly the primary goal of this feature is to cut off the extra information,which is outside of drawing box, so the last letter in line crossing the right border of window ,or last line which crosses the bottom border will be just shown incomlete. So the auto word wrap should be an option of that windowJimmy wrote:Code: Select all
SetHudSize(640, 480, 1); SetHudWindow(160, 320, 300, 396); // This would create a window at [x: 160, y: 300] that is 160px wide and 96px tall. HudMessage(s:"This is a test hudmessage that should contain text which wraps within the confines of the specified window."; HUDMSG_PLAIN, 0, CR_RED, 80.4, 8.0, 10.0); // See below note for new x and y coordinate usage. // x: Using 80.4 for "x" positions it in the middle of the 160px-wide window and center-aligns the text. // y: Using 8.0 for "y" positions it 8px from the top of the window and top-aligns the text.
Re: [ACS] HudMessage width and height parameter
That seems counterintuitive. Under what circumstances would you need to cut off a hudmessage mid-character? 

Re: [ACS] HudMessage width and height parameter
I'm developing this: http://forum.zdoom.org/viewtopic.php?f=19&t=29564 and the cutoff is needed for such elements as list box widget, because they are showing only small "window" of overall "page", and it's need to display only those elements, which are fit into display part of list box, the rest of information should be just cut by the borders of list box.
Re: [ACS] HudMessage width and height parameter
How about using graphics with alpha to do the masking instead? Then you can make the "cutoff" any shape and size.
Re: [ACS] HudMessage width and height parameter
I think this is a bad method, because the content inside display window is completely random(the system don't know, what graphic or text will be used by modder), and so we couldn't use any situation-specific methods, everything should be absolutely generic
Re: [ACS] HudMessage width and height parameter
I have no idea, you can share any example.Nash wrote:How about using graphics with alpha to do the masking instead? Then you can make the "cutoff" any shape and size.
- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: [ACS] HudMessage width and height parameter
What example? Why did you bump this thread from nearly one year ago?Brendon77 wrote:I have no idea, you can share any example.Nash wrote:How about using graphics with alpha to do the masking instead? Then you can make the "cutoff" any shape and size.
Re: [ACS] HudMessage width and height parameter
BTW this can be closed as [Added]...