]> git.lizzy.rs Git - minetest.git/blobdiff - src/client/hud.h
Fix player sprite visibility in first person
[minetest.git] / src / client / hud.h
index 693d2adee18aad258804fbff691d1100ab46979e..d46545d71823df2d72276f2c153bcbf5669dd3f6 100644 (file)
@@ -18,8 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef CLIENT_HUD_HEADER
-#define CLIENT_HUD_HEADER
+#pragma once
 
 #include <vector>
 #include <IGUIFont.h>
@@ -46,12 +45,16 @@ class Hud
 
        video::SColor crosshair_argb;
        video::SColor selectionbox_argb;
+
        bool use_crosshair_image = false;
+       bool use_object_crosshair_image = false;
        std::string hotbar_image = "";
        bool use_hotbar_image = false;
        std::string hotbar_selected_image = "";
        bool use_hotbar_selected_image = false;
 
+       bool pointing_at_object = false;
+
        Hud(gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player,
                        Inventory *inventory);
        ~Hud();
@@ -78,11 +81,15 @@ class Hud
                m_selected_face_normal = face_normal;
        }
 
+       bool hasElementOfType(HudElementType type);
+
        void drawLuaElements(const v3s16 &camera_offset);
 
 private:
-       void drawStatbar(v2s32 pos, u16 corner, u16 drawdir, const std::string &texture,
-                       s32 count, v2s32 offset, v2s32 size = v2s32());
+       bool calculateScreenPos(const v3s16 &camera_offset, HudElement *e, v2s32 *pos);
+       void drawStatbar(v2s32 pos, u16 corner, u16 drawdir,
+                       const std::string &texture, const std::string& bgtexture,
+                       s32 count, s32 maxcount, v2s32 offset, v2s32 size = v2s32());
 
        void drawItems(v2s32 upperleftpos, v2s32 screen_offset, s32 itemcount,
                        s32 inv_offset, InventoryList *mainlist, u16 selectitem,
@@ -90,7 +97,14 @@ class Hud
 
        void drawItem(const ItemStack &item, const core::rect<s32> &rect, bool selected);
 
+       void drawCompassTranslate(HudElement *e, video::ITexture *texture,
+                       const core::rect<s32> &rect, int way);
+
+       void drawCompassRotate(HudElement *e, video::ITexture *texture,
+                       const core::rect<s32> &rect, int way);
+
        float m_hud_scaling; // cached minetest setting
+       float m_scale_factor;
        v3s16 m_camera_offset;
        v2u32 m_screensize;
        v2s32 m_displaycenter;
@@ -109,6 +123,8 @@ class Hud
 
        video::SMaterial m_selection_material;
 
+       scene::SMeshBuffer m_rotation_mesh_buffer;
+
        enum
        {
                HIGHLIGHT_BOX,
@@ -122,6 +138,7 @@ enum ItemRotationKind
        IT_ROT_SELECTED,
        IT_ROT_HOVERED,
        IT_ROT_DRAGGED,
+       IT_ROT_OTHER,
        IT_ROT_NONE, // Must be last, also serves as number
 };
 
@@ -133,4 +150,14 @@ void drawItemStack(video::IVideoDriver *driver,
                Client *client,
                ItemRotationKind rotation_kind);
 
-#endif
+void drawItemStack(
+               video::IVideoDriver *driver,
+               gui::IGUIFont *font,
+               const ItemStack &item,
+               const core::rect<s32> &rect,
+               const core::rect<s32> *clip,
+               Client *client,
+               ItemRotationKind rotation_kind,
+               const v3s16 &angle,
+               const v3s16 &rotation_speed);
+