]> git.lizzy.rs Git - minetest.git/blobdiff - src/client/gameui.cpp
Add object visual type 'item' (#7870)
[minetest.git] / src / client / gameui.cpp
index 6f6d2c2a88dbae01ff4bd5b780f8e428aa67c1bd..1f433e49a261436dc01333a6626ebbcf118d67f3 100644 (file)
@@ -33,7 +33,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 inline static const char *yawToDirectionString(int yaw)
 {
-       static const char *direction[4] = {"N +Z", "W -X", "S -Z", "E +X"};
+       static const char *direction[4] =
+               {"North +Z", "West -X", "South -Z", "East +X"};
 
        yaw = wrapDegrees_0_360(yaw);
        yaw = (yaw + 45) % 360 / 90;
@@ -41,6 +42,14 @@ inline static const char *yawToDirectionString(int yaw)
        return direction[yaw];
 }
 
+GameUI::GameUI()
+{
+       if (guienv && guienv->getSkin())
+               m_statustext_initial_color = guienv->getSkin()->getColor(gui::EGDC_BUTTON_TEXT);
+       else
+               m_statustext_initial_color = video::SColor(255, 0, 0, 0);
+
+}
 void GameUI::init()
 {
        // First line of debug text
@@ -123,7 +132,7 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
 
                if (pointed_old.type == POINTEDTHING_NODE) {
                        ClientMap &map = client->getEnv().getClientMap();
-                       const INodeDefManager *nodedef = client->getNodeDefManager();
+                       const NodeDefManager *nodedef = client->getNodeDefManager();
                        MapNode n = map.getNodeNoEx(pointed_old.node_undersurface);
 
                        if (n.getContent() != CONTENT_IGNORE && nodedef->get(n).name != "unknown") {
@@ -169,16 +178,10 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
                        status_y - status_height, status_x + status_width, status_y));
 
                // Fade out
-               video::SColor initial_color(255, 0, 0, 0);
-
-               if (guienv->getSkin())
-                       initial_color = guienv->getSkin()->getColor(gui::EGDC_BUTTON_TEXT);
-
-               video::SColor final_color = initial_color;
+               video::SColor final_color = m_statustext_initial_color;
                final_color.setAlpha(0);
-               video::SColor fade_color = initial_color.getInterpolated_quadratic(
-                       initial_color, final_color,
-                       pow(m_statustext_time / statustext_time_max, 2.0f));
+               video::SColor fade_color = m_statustext_initial_color.getInterpolated_quadratic(
+                       m_statustext_initial_color, final_color, m_statustext_time / statustext_time_max);
                m_guitext_status->setOverrideColor(fade_color);
                m_guitext_status->enableOverrideColor(true);
        }
@@ -186,9 +189,7 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
 
 void GameUI::initFlags()
 {
-       memset(&m_flags, 0, sizeof(GameUI::Flags));
-       m_flags.show_chat = true;
-       m_flags.show_hud = true;
+       m_flags = GameUI::Flags();
        m_flags.show_debug = g_settings->getBool("show_debug");
 }
 
@@ -244,7 +245,7 @@ void GameUI::updateProfiler()
                if (w < 400)
                        w = 400;
 
-               unsigned text_height = g_fontengine->getTextHeight();
+               u32 text_height = g_fontengine->getTextHeight();
 
                core::position2di upper_left, lower_right;