Auto resizing Text object

For questions about using Classic.

Post » Tue Nov 23, 2010 9:31 pm

Evening guys its me your favorite "H'n'S" section spammer! i am firing my lazzers again!

So, in many games you propable seen ToolTips. You know, when you hover your mouse over an weapon, item, spell, skills ect it gives you its brief description and its stats. But diffrent objects have diffrent infromation amount. Item Shovel with absolutly no use in game will have just the name and maybe weight, when a "Legendery Brutal Battle Axe of Indescribeble Doom +14 made by Chuck Norris" will not only have a very long name, but wall of text of stats, buffs, description and other juicy stuff which fanatical gamers love to see/read.

my problem is so the text object would adjuct its size depending on how much actual text is displayed. i know about the "newline" expression but in my case its off topic as i want to attach a nice graphic background for the tooltip and link its size with the size of text object.

now how can this be done?

i know that i can just make diffrent ToolTip objects for diffrent ToolTip types, like big one for weapons which has many stats and text, smaller for shields, and dfirrent for devices. is there a way to LOCK text object width or heigh and force it to expand to remaining direction?

i am also aware that instead of "text object" based ToolTips i can just use pre-made images - but you know, one TextObject + one image + couple of variables will always weight less then any other two images. and the diffrence is perhaps small when we're talking 10 tool tips. but imagine 1000 tooltips. thats 1k pre-made images. even if they would be 1kb each thats 1000 times more then what would weight TextObject based ToolTips. Not talking about the amount of work. with Text you just change the text and the rest is done by the engine. with images you need to insert the text, adjuct the size by auto, save it, import it to Construct (even as a frame not object) and then remember WHICH frame was the ToolTip for that blasted Bannana Space Thrusters
Posts: 568
Reputation: 6,089

Post » Thu Nov 25, 2010 2:20 pm

Maybe you can cook something with this :

Returns the number of characters in the string.

Check the number of characters in the tooltip text and then adjust the text object's size and frame size?
You'd probably have to know the width and height of the police you're using though.

aaah i don't know i'm just a noob ^^:

Edit : Or maybe you can try to do it the html/css way : make small images for the corners (or just one since you can rotate it), and one for the frame itself that would be stretched or repeated until it fits the size of the tooltip. Because if you use 1 image only it would be blurred. And then add a Tiled Background.
Posts: 91
Reputation: 1,057

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests