If we show less of it, it defeats the point of having a long name to start with.
The stone axe could be addressed by putting axe on a second line and is quite easy to do as it has a space in the middle.
function ReplaceSubString( thisString$ , thisOld$ , thisNew$ ) thisLen = len( thisOld$ ) thisStart = FindSubString( thisString$ , thisOld$ , 1 ) while thisStart > 0 thisString$ = left( thisString$ , thisStart - 1 ) + thisNew$ + right( thisString$ , len( thisString$ ) - (thisStart + thisLen - 1) ) thisStart = FindSubString( thisString$ , thisOld$ , 1 ) endwhile endfunction thisString$This utility function replaces all occurences of one string with another. The logic is fairly straight forward.
- It uses FindSubString() to check if the old string exists.
- If so, the main string is split into three, with the old string being the middle piece.
- The string is re-built with the left piece, the new string and the right piece.
- It repeats until the old string is no longer found.
In the SetPanelSprite() function, replace the following code.
setTextString( thisNameText , ObjectName( thisObject ) ) setTextString( thisShadText , ObjectName( thisObject ) )With this new version.
thisString$ = ReplaceSubString( ObjectName( thisObject ) , " " , chr(10) ) setTextString( thisNameText , thisString$ ) setTextString( thisShadText , thisString$ )Which passes the object name through the new ReplaceSubString() function, swapping any space for character code 10 - which is a line-feed.
Now any name containing a space will be split into multiple lines.
The stone axe text looks a good size now, but we don't know what size that is. To find out, we can add a bit of code to hijack the routine, putting the text size above the name temporarily.
Before the first setTextY() line, add the following code.
// Add Text Size to Name temporarily thisString$ = str(getTextSize( thisNameText ),2) + chr(10) + thisString$ setTextString( thisNameText , thisString$ ) setTextString( thisShadText , thisString$ ) // End of Additional CodeWhich now gives us values for each piece of text indicating it's size, any less than 24.00 have been scaled down.
Since this code comes after the resize code, the values do go outside the icon area.
Looking at the results, I think a size of 18 would probably produce a better start size.
thisSize# = IconSize() * 0.28125What do you think?
We can improve visibility on this in a number of ways.
- Adjust the panel background
- Adjust the name and shadow colours
- design the icons with a standard background behind the name.
No comments:
Post a Comment