TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 02 Feb 2017 03:04 PM |
how does the chat move the white characers over just enough to fit the name, and then with text wrapping move the rest down?
i was thinking they just have 2 textlabels, one for the name and then one for the text and then the one with the text is just a rectangle where the text is pushed over a bit with whitespace based on the name labels's text bounds. how do i do this with text wrapping?
maybe im over complicating this
imgur . com /PY9Iw0K
|
|
|
| Report Abuse |
|
|
Zekleon
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 340 |
|
|
| 02 Feb 2017 03:13 PM |
| They have a math formula that sizes the name box according to the number of letters in the name and size of letters etc. Then they create another box placing it just next to it. I think that's what happens anyway. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 02 Feb 2017 03:17 PM |
if they place it next to the text then it won't go under the name. how do they get the text under the name?
do they just replace the beginning of the message with whitespace or something
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 02 Feb 2017 03:18 PM |
didnt see anything on github on how they do it
|
|
|
| Report Abuse |
|
|
17248
|
  |
| Joined: 20 Jan 2016 |
| Total Posts: 1 |
|
|
| 02 Feb 2017 03:18 PM |
put text in 1st line
while no more characters left while textboundsx>width subtract character put it on next line end increment line end |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2017 04:01 PM |
on the new chat it just uses spaces until it is infront of the player label thing( im guessing using repeat until textbounds = player name textbounds but thats probably bad )
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 03 Feb 2017 05:07 AM |
Seems strange to do it like that. I looked at this ugly code but it gave me nothing
function Util.GetStringTextBounds(text, font, fontSize, sizeBounds) -- If no sizeBounds are specified use some huge number sizeBounds = sizeBounds or false if not TextSizeCache[text] then TextSizeCache[text] = {} end if not TextSizeCache[text][font] then TextSizeCache[text][font] = {} end if not TextSizeCache[text][font][sizeBounds] then TextSizeCache[text][font][sizeBounds] = {} end if not TextSizeCache[text][font][sizeBounds][fontSize] then testLabel.Text = text testLabel.Font = font testLabel.FontSize = fontSize if sizeBounds then testLabel.TextWrapped = true; testLabel.Size = sizeBounds else testLabel.TextWrapped = false; end TextSizeCache[text][font][sizeBounds][fontSize] = testLabel.TextBounds end return TextSizeCache[text][font][sizeBounds][fontSize] end
|
|
|
| Report Abuse |
|
|