How do I create responsive text?

Not favoritedFavorited Favorited 0 favourites
  • 6 posts
From the Asset Store
This kit will show you how to position GUI elements based on screen size
  • Here's what I want.

    the more text is written inside the selected text element, the larger the text element will be, this will only happen 1 time when the game starts, it will not be dynamic

    My goal is to set the automatic width in various languages

    I want to make the text element as wide as the content of the text

  • You can use CSS styling to achieve this. You can for example change the look when the text is overflowing (going past the object size) But you can also just make it simple and for example count the letters and change the width of the text object based on how many letters are in the text object

  • Is there a course content about this? I don't know much how to do it in construct3

  • CSS means using HTML object instead of Text, which is not a good choice in many games.

    fanusgames Here is a demo:

    dropbox.com/scl/fi/qne4sezq4tnml8vb2pbrw/TextAutoSize.c3p

    Make sure the height of the text box is big enough to fit two lines of text at max size, otherwise TextHeight expression won't work.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • CSS means using HTML object instead of Text, which is not a good choice in many games.

    fanusgames Here is a demo:

    https://www.dropbox.com/scl/fi/qne4sezq4tnml8vb2pbrw/TextAutoSize.c3p?rlkey=1740darvr86bq71io58rnv7z8&st=55fffmkv&dl=0

    Make sure the height of the text box is big enough to fit two lines of text at max size, otherwise TextHeight expression won't work.

    Why is it not a good idea ? Im using js and html objects for things like drop down menus etc, ofc might impact performance if there is alot of html elements but i havent noticed yet.

  • Why is it not a good idea ? Im using js and html objects for things like drop down menus etc, ofc might impact performance if there is alot of html elements but i havent noticed yet.

    I have a bias against using HTML objects since the days of Construct 2 - there were tons of issues with them back then. But I admit that almost all of those problems have been fixed now. Still, I remain a bit skeptical :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)