Minetest  5.4.0
Hud Class Reference

#include <hud.h>

+ Collaboration diagram for Hud:

Public Member Functions

 Hud (gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player, Inventory *inventory)
 
 ~Hud ()
 
void drawHotbar (u16 playeritem)
 
void resizeHotbar ()
 
void drawCrosshair ()
 
void drawSelectionMesh ()
 
void updateSelectionMesh (const v3s16 &camera_offset)
 
std::vector< aabb3f > * getSelectionBoxes ()
 
void setSelectionPos (const v3f &pos, const v3s16 &camera_offset)
 
v3f getSelectionPos () const
 
void setSelectionMeshColor (const video::SColor &color)
 
void setSelectedFaceNormal (const v3f &face_normal)
 
bool hasElementOfType (HudElementType type)
 
void drawLuaElements (const v3s16 &camera_offset)
 

Public Attributes

video::IVideoDriver * driver
 
scene::ISceneManager * smgr
 
gui::IGUIEnvironment * guienv
 
Clientclient
 
LocalPlayerplayer
 
Inventoryinventory
 
ITextureSourcetsrc
 
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
 

Private Types

enum  { HIGHLIGHT_BOX , HIGHLIGHT_HALO , HIGHLIGHT_NONE }
 

Private Member Functions

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, u16 direction)
 
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)
 

Private Attributes

float m_hud_scaling
 
float m_scale_factor
 
v3s16 m_camera_offset
 
v2u32 m_screensize
 
v2s32 m_displaycenter
 
s32 m_hotbar_imagesize
 
s32 m_padding
 
video::SColor hbar_colors [4]
 
std::vector< aabb3fm_selection_boxes
 
std::vector< aabb3fm_halo_boxes
 
v3f m_selection_pos
 
v3f m_selection_pos_with_offset
 
scene::IMesh * m_selection_mesh = nullptr
 
video::SColor m_selection_mesh_color
 
v3f m_selected_face_normal
 
video::SMaterial m_selection_material
 
scene::SMeshBuffer m_rotation_mesh_buffer
 
enum Hud:: { ... }  m_mode
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
HIGHLIGHT_BOX 
HIGHLIGHT_HALO 
HIGHLIGHT_NONE 

Constructor & Destructor Documentation

◆ Hud()

◆ ~Hud()

Hud::~Hud ( )

References m_selection_mesh.

Member Function Documentation

◆ calculateScreenPos()

bool Hud::calculateScreenPos ( const v3s16 camera_offset,
HudElement e,
v2s32 pos 
)
private

References BS, RenderingEngine::get_scene_manager(), intToFloat(), m_screensize, and HudElement::world_pos.

Referenced by drawLuaElements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawCompassRotate()

void Hud::drawCompassRotate ( HudElement e,
video::ITexture *  texture,
const core::rect< s32 > &  rect,
int  way 
)
private

References driver, and m_rotation_mesh_buffer.

Referenced by drawLuaElements().

+ Here is the caller graph for this function:

◆ drawCompassTranslate()

void Hud::drawCompassTranslate ( HudElement e,
video::ITexture *  texture,
const core::rect< s32 > &  rect,
int  way 
)
private

References draw2DImageFilterScaled(), driver, and HudElement::scale.

Referenced by drawLuaElements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawCrosshair()

void Hud::drawCrosshair ( )

References crosshair_argb, CROSSHAIR_LINE_SIZE, driver, ITextureSource::getTexture(), m_displaycenter, OBJECT_CROSSHAIR_LINE_SIZE, pointing_at_object, tsrc, use_crosshair_image, and use_object_crosshair_image.

Referenced by RenderingCore::drawHUD().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawHotbar()

void Hud::drawHotbar ( u16  playeritem)

References drawItems(), g_settings, RenderingEngine::get_instance(), Settings::getFloat(), Inventory::getList(), RenderingEngine::getWindowSize(), HUD_FLAG_HOTBAR_VISIBLE, Player::hud_flags, Player::hud_hotbar_itemcount, inventory, m_displaycenter, m_hotbar_imagesize, m_padding, m_screensize, and player.

Referenced by RenderingCore::drawHUD().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawItem()

void Hud::drawItem ( const ItemStack item,
const core::rect< s32 > &  rect,
bool  selected 
)
private

References draw2DImageFilterScaled(), drawItemStack(), driver, g_fontengine, FontEngine::getFont(), ITextureSource::getTexture(), hbar_colors, hotbar_selected_image, IT_ROT_NONE, IT_ROT_SELECTED, m_padding, tsrc, use_hotbar_image, and use_hotbar_selected_image.

Referenced by drawItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawItems()

void Hud::drawItems ( v2s32  upperleftpos,
v2s32  screen_offset,
s32  itemcount,
s32  inv_offset,
InventoryList mainlist,
u16  selectitem,
u16  direction 
)
private

References draw2DImageFilterScaled(), drawItem(), driver, g_touchscreengui, InventoryList::getItem(), ITextureSource::getTexture(), hbar_colors, hotbar_image, LocalPlayer::hotbar_image, hotbar_selected_image, LocalPlayer::hotbar_selected_image, HUD_DIR_BOTTOM_TOP, HUD_DIR_RIGHT_LEFT, HUD_DIR_TOP_BOTTOM, m_hotbar_imagesize, m_padding, m_scale_factor, player, TouchScreenGUI::registerHudItem(), TouchScreenGUI::resetHud(), tsrc, use_hotbar_image, and use_hotbar_selected_image.

Referenced by drawHotbar(), and drawLuaElements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawLuaElements()

◆ drawSelectionMesh()

void Hud::drawSelectionMesh ( )

References cloneMesh(), driver, HIGHLIGHT_BOX, HIGHLIGHT_HALO, m_mode, m_selected_face_normal, m_selection_boxes, m_selection_material, m_selection_mesh, m_selection_mesh_color, m_selection_pos_with_offset, MYMIN, selectionbox_argb, setMeshColor(), setMeshColorByNormal(), and translateMesh().

Referenced by RenderingCore::draw3D().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawStatbar()

void Hud::drawStatbar ( v2s32  pos,
u16  corner,
u16  drawdir,
const std::string &  texture,
const std::string &  bgtexture,
s32  count,
s32  maxcount,
v2s32  offset,
v2s32  size = v2s32() 
)
private

References draw2DImageFilterScaled(), driver, ITextureSource::getTexture(), HUD_CORNER_LOWER, HUD_DIR_BOTTOM_TOP, HUD_DIR_RIGHT_LEFT, HUD_DIR_TOP_BOTTOM, m_scale_factor, p(), and tsrc.

Referenced by drawLuaElements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectionBoxes()

std::vector<aabb3f>* Hud::getSelectionBoxes ( )
inline

References m_selection_boxes.

Referenced by Game::updatePointedThing().

+ Here is the caller graph for this function:

◆ getSelectionPos()

v3f Hud::getSelectionPos ( ) const
inline

References m_selection_pos.

Referenced by Game::updatePointedThing().

+ Here is the caller graph for this function:

◆ hasElementOfType()

bool Hud::hasElementOfType ( HudElementType  type)

References Player::getHud(), LocalPlayer::maxHudId(), player, and HudElement::type.

Referenced by Game::toggleMinimap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resizeHotbar()

void Hud::resizeHotbar ( )

References RenderingEngine::get_instance(), RenderingEngine::getDisplayDensity(), RenderingEngine::getWindowSize(), HOTBAR_IMAGE_SIZE, m_displaycenter, m_hotbar_imagesize, m_hud_scaling, m_padding, and m_screensize.

Referenced by RenderingCoreSideBySide::resetEye(), and Game::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSelectedFaceNormal()

void Hud::setSelectedFaceNormal ( const v3f face_normal)
inline

References m_selected_face_normal.

Referenced by Game::updatePointedThing().

+ Here is the caller graph for this function:

◆ setSelectionMeshColor()

void Hud::setSelectionMeshColor ( const video::SColor &  color)
inline

References m_selection_mesh_color.

Referenced by Game::updatePointedThing().

+ Here is the caller graph for this function:

◆ setSelectionPos()

void Hud::setSelectionPos ( const v3f pos,
const v3s16 camera_offset 
)

References BS, intToFloat(), m_camera_offset, m_selection_pos, and m_selection_pos_with_offset.

Referenced by Game::updatePointedThing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSelectionMesh()

void Hud::updateSelectionMesh ( const v3s16 camera_offset)

References convertNodeboxesToMesh(), HIGHLIGHT_HALO, m_camera_offset, m_halo_boxes, m_mode, m_selection_boxes, and m_selection_mesh.

Referenced by Game::processPlayerInteraction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ client

Client* Hud::client

Referenced by Hud().

◆ crosshair_argb

video::SColor Hud::crosshair_argb

Referenced by Hud(), and drawCrosshair().

◆ driver

◆ guienv

gui::IGUIEnvironment* Hud::guienv

Referenced by Hud().

◆ hbar_colors

video::SColor Hud::hbar_colors[4]
private

Referenced by Hud(), drawItem(), and drawItems().

◆ hotbar_image

std::string Hud::hotbar_image = ""

Referenced by drawItems().

◆ hotbar_selected_image

std::string Hud::hotbar_selected_image = ""

Referenced by drawItem(), and drawItems().

◆ inventory

Inventory* Hud::inventory

Referenced by Hud(), drawHotbar(), and drawLuaElements().

◆ m_camera_offset

v3s16 Hud::m_camera_offset
private

◆ m_displaycenter

v2s32 Hud::m_displaycenter
private

◆ m_halo_boxes

std::vector<aabb3f> Hud::m_halo_boxes
private

Referenced by Hud(), and updateSelectionMesh().

◆ m_hotbar_imagesize

s32 Hud::m_hotbar_imagesize
private

◆ m_hud_scaling

float Hud::m_hud_scaling
private

Referenced by Hud(), drawLuaElements(), and resizeHotbar().

◆ 

enum { ... } Hud::m_mode

◆ m_padding

s32 Hud::m_padding
private

◆ m_rotation_mesh_buffer

scene::SMeshBuffer Hud::m_rotation_mesh_buffer
private

Referenced by Hud(), and drawCompassRotate().

◆ m_scale_factor

float Hud::m_scale_factor
private

◆ m_screensize

v2u32 Hud::m_screensize
private

◆ m_selected_face_normal

v3f Hud::m_selected_face_normal
private

◆ m_selection_boxes

std::vector<aabb3f> Hud::m_selection_boxes
private

◆ m_selection_material

video::SMaterial Hud::m_selection_material
private

Referenced by Hud(), and drawSelectionMesh().

◆ m_selection_mesh

scene::IMesh* Hud::m_selection_mesh = nullptr
private

◆ m_selection_mesh_color

video::SColor Hud::m_selection_mesh_color
private

◆ m_selection_pos

v3f Hud::m_selection_pos
private

Referenced by getSelectionPos(), and setSelectionPos().

◆ m_selection_pos_with_offset

v3f Hud::m_selection_pos_with_offset
private

◆ player

◆ pointing_at_object

bool Hud::pointing_at_object = false

◆ selectionbox_argb

video::SColor Hud::selectionbox_argb

Referenced by Hud(), and drawSelectionMesh().

◆ smgr

scene::ISceneManager* Hud::smgr

◆ tsrc

◆ use_crosshair_image

bool Hud::use_crosshair_image = false

Referenced by Hud(), and drawCrosshair().

◆ use_hotbar_image

bool Hud::use_hotbar_image = false

Referenced by drawItem(), and drawItems().

◆ use_hotbar_selected_image

bool Hud::use_hotbar_selected_image = false

Referenced by drawItem(), and drawItems().

◆ use_object_crosshair_image

bool Hud::use_object_crosshair_image = false

Referenced by Hud(), and drawCrosshair().


The documentation for this class was generated from the following files: