mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com> Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
ff6dcfea82
commit
038da00e79
38 changed files with 84 additions and 94 deletions
|
@ -411,7 +411,7 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
|
|||
case HUD_ELEM_WAYPOINT: {
|
||||
if (!calculateScreenPos(camera_offset, e, &pos))
|
||||
break;
|
||||
v3f p_pos = player->getPosition() / BS;
|
||||
|
||||
pos += v2s32(e->offset.X, e->offset.Y);
|
||||
video::SColor color(255, (e->number >> 16) & 0xFF,
|
||||
(e->number >> 8) & 0xFF,
|
||||
|
@ -429,6 +429,7 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
|
|||
font->draw(text.c_str(), bounds + v2s32((e->align.X - 1.0) * bounds.getWidth() / 2, 0), color);
|
||||
if (draw_precision) {
|
||||
std::ostringstream os;
|
||||
v3f p_pos = player->getPosition() / BS;
|
||||
float distance = std::floor(precision * p_pos.getDistanceFrom(e->world_pos)) / precision;
|
||||
os << distance << unit;
|
||||
text = unescape_translate(utf8_to_wide(os.str()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue