Text clipping overlay and returning a character's height.

Started by Phemar, Wed 05/06/2013 11:48:12

Previous topic - Next topic

Phemar

Does anyone know if there's a way to check if text is clipping an overlay's width?

That is, if the text is spreading onto the next line.

What I'm trying to do is design a custom speech system that is closer to the actual way LucasArt's speech worked. If two characters are having a conversation, the text is normally displayed at the same y coordinate for both characters, and that would be the y coordinate of whichever character is taller.

So in order for this to work I need to be able to check whether an overlay is taking up one, two or three rows. I hope I'm making sense.

It would also be nice to be able to return a character's height, for offsetting the overlay and whatnot. This isn't the biggest issue right now since I can always manually set each character's height on game_start.

Khris

You can use GetTextHeight/Width.
As for a character's height, get their current Viewframe*, then use Game.SpriteHeight[Viewframe.Graphic].

Phemar

Thanks Khris, works perfectly. Didn't know about the GetTextHeight function.

Snarky

Quote from: Khris on Wed 05/06/2013 13:05:34
You can use GetTextHeight/Width.
As for a character's height, get their current Viewframe*, then use Game.SpriteHeight[Viewframe.Graphic].

Will this work with scaling, though? I suspect you might have to multiply it by Room.GetScalingAt(x,y)/100.

SMF spam blocked by CleanTalk