HudMessage cutoff feature and auto word wrap

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: HudMessage cutoff feature and auto word wrap

Re: HudMessage cutoff feature and auto word wrap

by randi » Sat Nov 10, 2012 4:48 pm

My bad. It's supposed to be the width it wraps text to. (Normally it wraps it to the width of the screen.) My only excuse is, as I said, I had to do quite a bit of work to the patch.

Re: HudMessage cutoff feature and auto word wrap

by Gez » Sat Nov 10, 2012 3:44 am

I was looking at the code trying to figure out if wrapwidth is a boolean meaning to wrap on the width; or an integer giving a width at which to wrap, and I don't understand how this works at all. It seems not to be actually referenced in code anywhere. It's assigned, and it's serialized, but I don't see any "SomeFunctionWhichUseWrapWidthAsParameter(WrapWidth)" call or "if (WrapWidth)". :?

I mean, except the obvious:

Code: Select all

					if (WrapWidth != 0)
					{
						msg->SetWrapWidth(WrapWidth);
					}

Code: Select all

	void SetWrapWidth(int wrap)
	{
		WrapWidth = wrap;
		ResetText(SourceText);
	}
But that doesn't help since nothing else happens with it afterwards. It's not referenced in ResetText, for example; which instead uses HUDWidth and/or ClipWidth and/or SCREENWIDTH.

Searching for all references specifically to DHUDMessage::WrapWidth gives only these results:

Code: Select all

	WrapWidth = 0;
	arc << WrapWidth;
	ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0;
	WrapWidth = wrap;
	int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth;	// in HUD coords
assignation, serialization, assignation, assignation, definition. Never actual use.

Re: HudMessage cutoff feature and auto word wrap

by Xaser » Fri Nov 09, 2012 9:30 pm

randi wrote:I think this was a communication error due to English as a second language. It did wrap words; the only reason it didn't in that screenshot was because there were no space characters for line breaks, so it had to break at character boundaries instead.
Oh! Well, that's perfect, then. :D

Kudos to all involved.

Re: HudMessage cutoff feature and auto word wrap

by randi » Fri Nov 09, 2012 9:22 pm

There was a surprising amount of work left to do to make this useable, but added for r3960. (Well, that commit message got formatted poorly. Oh well.)
Xaser wrote:its use for text is pretty limited because it doesn't wrap words.
I think this was a communication error due to English as a second language. It did wrap words; the only reason it didn't in that screenshot was because there were no space characters for line breaks, so it had to break at character boundaries instead.

Re: HudMessage cutoff feature and auto word wrap

by FDARI » Thu Oct 18, 2012 4:30 am

The strife-menu (dialogue, I mean) breaks between words properly doesn't it? It might not be reusable, but I think functions for breaking text into lines exists. Perhaps, with or without tweaking, it can be extended to provide breaking on words in hudmessages.

Re: HudMessage cutoff feature and auto word wrap

by Project Shadowcat » Tue Oct 16, 2012 4:07 am

Jimmy wrote:How difficult would it be to add that? It's the only thing stopping this already quite useful feature from being "complete", and isn't it (I hate to use the "j-word") a case of telling the script where the space closest to the border of the cutoff box is, and wrapping the text at that point, instead of at whichever character crosses over the border?

I have no idea what I'm saying.
I do.

Re: HudMessage cutoff feature and auto word wrap

by Jimmy » Mon Oct 15, 2012 11:30 pm

How difficult would it be to add that? It's the only thing stopping this already quite useful feature from being "complete", and isn't it (I hate to use the "j-word") a case of telling the script where the space closest to the border of the cutoff box is, and wrapping the text at that point, instead of at whichever character crosses over the border?

I have no idea what I'm saying.

Re: HudMessage cutoff feature and auto word wrap

by Xaser » Mon Oct 15, 2012 5:30 pm

As nice as this will be for some things (say, a font of icons or somesuch), its use for text is pretty limited because it doesn't wrap words. Not that I'd oppose adding this, of course -- the "wrap" bool can be extended to a flags parameter later on that specifies the wrap type if someone's brave enough to code in word wrapping.

Re: HudMessage cutoff feature and auto word wrap

by Edward-san » Sun Oct 14, 2012 1:37 pm

it wraps only symbols
so if I get it correctly, it's not possible, right now, to distinguish between a letter and a space?

Re: HudMessage cutoff feature and auto word wrap

by Nash » Sun Oct 14, 2012 6:15 am

There's always a period of slow activity with ZDoom development because Randy is busy with other things... don't worry about it, if your submission is good and code is clean, it will be adapted eventually. :)

Re: HudMessage cutoff feature and auto word wrap

by cybermind » Fri Oct 12, 2012 10:01 am

I wonder if this will be added to trunk, because i've already started to make a mod based on this feature.

Re: HudMessage cutoff feature and auto word wrap

by cybermind » Mon Sep 24, 2012 11:00 pm

No, it wraps only symbols, when they have reached the right border of the window

Re: HudMessage cutoff feature and auto word wrap

by Jimmy » Mon Sep 24, 2012 1:50 pm

Ooh, that's sweet. :D Does it wrap individual words correctly as well (your screenshot only shows strings with underscores instead of proper spaces)?

Re: HudMessage cutoff feature

by cybermind » Mon Sep 24, 2012 8:20 am

I've made word wrap, patches are reuploaded

Re: HudMessage cutoff feature

by Jimmy » Sun Sep 23, 2012 12:56 pm

I don't think it was his intention to make text wrap within one of these windows, but I for one would definitely get some mileage out of such a feature.

Top