#include "hud.h"
#include "settings.h"
#include "util/numeric.h"
+#include "util/string.h"
#include "log.h"
#include "gamedef.h"
#include "itemdef.h"
s32 width = (itemcount - inv_offset) * (m_hotbar_imagesize + m_padding * 2);
if (direction == HUD_DIR_TOP_BOTTOM || direction == HUD_DIR_BOTTOM_TOP) {
- width = m_hotbar_imagesize + m_padding * 2;
- height = (itemcount - inv_offset) * (m_hotbar_imagesize + m_padding * 2);
+ s32 tmp = height;
+ height = width;
+ width = tmp;
}
// Position of upper left corner of bar
- v2s32 pos = upperleftpos + screen_offset;
- pos *= m_hud_scaling * porting::getDisplayDensity();
+ v2s32 pos = screen_offset;
+ pos.X *= m_hud_scaling * porting::getDisplayDensity();
+ pos.Y *= m_hud_scaling * porting::getDisplayDensity();
+ pos += upperleftpos;
+ // Store hotbar_image in member variable, used by drawItem()
if (hotbar_image != player->hotbar_image) {
hotbar_image = player->hotbar_image;
if (hotbar_image != "")
use_hotbar_image = false;
}
+ // Store hotbar_selected_image in member variable, used by drawItem()
if (hotbar_selected_image != player->hotbar_selected_image) {
hotbar_selected_image = player->hotbar_selected_image;
if (hotbar_selected_image != "")
use_hotbar_selected_image = false;
}
- /* draw customized item background */
+ // draw customized item background
if (use_hotbar_image) {
core::rect<s32> imgrect2(-m_padding/2, -m_padding/2,
width+m_padding/2, height+m_padding/2);
NULL, hbar_colors, true);
}
+ // Draw items
+ core::rect<s32> imgrect(0, 0, m_hotbar_imagesize, m_hotbar_imagesize);
for (s32 i = inv_offset; i < itemcount && (size_t)i < mainlist->getSize(); i++) {
- v2s32 steppos;
s32 fullimglen = m_hotbar_imagesize + m_padding * 2;
- core::rect<s32> imgrect(0, 0, m_hotbar_imagesize, m_hotbar_imagesize);
-
+ v2s32 steppos;
switch (direction) {
case HUD_DIR_RIGHT_LEFT:
steppos = v2s32(-(m_padding + (i - inv_offset) * fullimglen), m_padding);
(e->number >> 8) & 0xFF,
(e->number >> 0) & 0xFF);
core::rect<s32> size(0, 0, e->scale.X, text_height * e->scale.Y);
- std::wstring text = utf8_to_wide(e->text);
+ std::wstring text = unescape_enriched(utf8_to_wide(e->text));
core::dimension2d<u32> textsize = font->getDimension(text.c_str());
v2s32 offset((e->align.X - 1.0) * (textsize.Width / 2),
(e->align.Y - 1.0) * (textsize.Height / 2));
(e->number >> 8) & 0xFF,
(e->number >> 0) & 0xFF);
core::rect<s32> size(0, 0, 200, 2 * text_height);
- std::wstring text = utf8_to_wide(e->name);
+ std::wstring text = unescape_enriched(utf8_to_wide(e->name));
font->draw(text.c_str(), size + pos, color);
std::ostringstream os;
os << distance << e->text;
- text = utf8_to_wide(os.str());
+ text = unescape_enriched(utf8_to_wide(os.str()));
pos.Y += text_height;
font->draw(text.c_str(), size + pos, color);
break; }
video::SMaterial oldmaterial = driver->getMaterial2D();
driver->setMaterial(m_selection_material);
setMeshColor(m_selection_mesh, m_selection_mesh_color);
+ video::SColor face_color(0,
+ MYMIN(255, m_selection_mesh_color.getRed() * 1.5),
+ MYMIN(255, m_selection_mesh_color.getGreen() * 1.5),
+ MYMIN(255, m_selection_mesh_color.getBlue() * 1.5));
+ setMeshColorByNormal(m_selection_mesh, m_selected_face_normal,
+ face_color);
scene::IMesh* mesh = cloneMesh(m_selection_mesh);
translateMesh(mesh, m_selection_pos_with_offset);
u32 mc = m_selection_mesh->getMeshBufferCount();