Skip to content

Commit 6c096bb

Browse files
committed
1 parent 6cab3b0 commit 6c096bb

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/graphics/stk_text_billboard.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ STKTextBillboard::STKTextBillboard(const video::SColor& color_top,
2929
ISceneNode* parent, ISceneManager* mgr,
3030
s32 id,
3131
const core::vector3df& position,
32-
const core::vector3df& size)
32+
const core::vector3df& scale)
3333
: ISceneNode(parent, mgr, id, position,
34-
core::vector3df(0.0f, 0.0f, 0.0f), size)
34+
core::vector3df(0.0f, 0.0f, 0.0f), scale)
3535
{
3636
using namespace SP;
3737
m_color_top = color_top;
@@ -52,6 +52,12 @@ STKTextBillboard::STKTextBillboard(const video::SColor& color_top,
5252
static_assert(sizeof(GLTB) == 20, "Wrong compiler padding");
5353
} // STKTextBillboard
5454

55+
// ----------------------------------------------------------------------------
56+
float STKTextBillboard::getDefaultScale(FontWithFace* face)
57+
{
58+
return 1.0f / (float)face->getDPI();
59+
} // getDefaultScale
60+
5561
// ----------------------------------------------------------------------------
5662
void STKTextBillboard::updateAbsolutePosition()
5763
{
@@ -92,7 +98,7 @@ void STKTextBillboard::init(const core::stringw& text, FontWithFace* face)
9298
face->drawText(text, core::rect<s32>(0, 0, size.Width, size.Height),
9399
video::SColor(255,255,255,255), false, false, NULL, NULL, this);
94100

95-
const float scale = 0.02f;
101+
const float scale = getDefaultScale(face);
96102
float max_x = 0;
97103
float min_y = 0;
98104
float max_y = 0;
@@ -262,7 +268,7 @@ void STKTextBillboard::initLegacy(const core::stringw& text, FontWithFace* face)
262268
face->drawText(text, core::rect<s32>(0, 0, size.Width, size.Height),
263269
video::SColor(255,255,255,255), false, false, NULL, NULL, this);
264270

265-
const float scale = 0.02f;
271+
const float scale = getDefaultScale(face);
266272
float max_x = 0;
267273
float min_y = 0;
268274
float max_y = 0;

src/graphics/stk_text_billboard.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ class STKTextBillboard : public ISceneNode, public NoCopy,
8383

8484
core::aabbox3df m_bbox;
8585

86+
// ------------------------------------------------------------------------
87+
float getDefaultScale(FontWithFace* face);
8688
public:
8789
// ------------------------------------------------------------------------
8890
STKTextBillboard(const video::SColor& color_top,
8991
const video::SColor& color_bottom, ISceneNode* parent,
9092
ISceneManager* mgr, s32 id,
9193
const core::vector3df& position,
92-
const core::vector3df& size);
94+
const core::vector3df& scale = core::vector3df(1, 1, 1));
9395
// ------------------------------------------------------------------------
9496
~STKTextBillboard()
9597
{

src/karts/kart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3446,7 +3446,7 @@ void Kart::setOnScreenText(const core::stringw& text)
34463446
GUIEngine::getSkin()->getColor("font::top"),
34473447
getNode(), irr_driver->getSceneManager(), -1,
34483448
core::vector3df(0.0f, 1.5f, 0.0f),
3449-
core::vector3df(0.35f, 0.35f, 0.35f));
3449+
core::vector3df(0.5f, 0.5f, 0.5f));
34503450
if (CVS->isGLSL())
34513451
tb->init(text, bold_face);
34523452
else

0 commit comments

Comments
 (0)