B
B
BonBon Slick2020-12-30 14:42:51
Game development
BonBon Slick, 2020-12-30 14:42:51

Responsive text size?

In css, you can do this in many ways, the easiest is to set the size in EM or REM, you can also use % with calc().
As I understand it, under the hood there is a calculation of the scale of the text, can I have the formula please?)

TTFConfig labelConfig;
  labelConfig.fontFilePath = "fonts/Marker Felt.ttf";
  labelConfig.fontSize = 15;
  thisSessionScoreLabel = Label::createWithTTF(
    labelConfig,
    std::to_string(thisSessionScore),
    TextHAlignment::CENTER,
    visibleSize.height * 15
  );

UDP. By far the most open answer I've found

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question