by Jimmy » Fri Sep 21, 2012 11:33 am
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)
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.
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.
If this is at all feasible, I think it should be a separate function altogether, like [b]SetHudWindow[/b] 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 [i]window's[/i] size, rather than the [i]screen's[/i] size.
So you'd have something like:
[b]void SetHudWindow(int x-start, int x-end, int y-start, int y-end)[/b]
or alternatively:
[b]void SetHudWindow(int x-start, int x-size, int y-start, int y-size)[/b]
[code]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.[/code]
I wonder if FDARI could bring forward his opinion/hypothesis on this. :P 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.