hud.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. Minetest
  3. Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
  4. Copyright (C) 2017 red-001 <red-001@outlook.ie>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU Lesser General Public License as published by
  7. the Free Software Foundation; either version 2.1 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public License along
  14. with this program; if not, write to the Free Software Foundation, Inc.,
  15. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  16. */
  17. #ifndef HUD_HEADER
  18. #define HUD_HEADER
  19. #include "irrlichttypes_extrabloated.h"
  20. #include <string>
  21. #include "common/c_types.h"
  22. #define HUD_DIR_LEFT_RIGHT 0
  23. #define HUD_DIR_RIGHT_LEFT 1
  24. #define HUD_DIR_TOP_BOTTOM 2
  25. #define HUD_DIR_BOTTOM_TOP 3
  26. #define HUD_CORNER_UPPER 0
  27. #define HUD_CORNER_LOWER 1
  28. #define HUD_CORNER_CENTER 2
  29. // Note that these visibility flags do not determine if the hud items are
  30. // actually drawn, but rather, whether to draw the item should the rest
  31. // of the game state permit it.
  32. #define HUD_FLAG_HOTBAR_VISIBLE (1 << 0)
  33. #define HUD_FLAG_HEALTHBAR_VISIBLE (1 << 1)
  34. #define HUD_FLAG_CROSSHAIR_VISIBLE (1 << 2)
  35. #define HUD_FLAG_WIELDITEM_VISIBLE (1 << 3)
  36. #define HUD_FLAG_BREATHBAR_VISIBLE (1 << 4)
  37. #define HUD_FLAG_MINIMAP_VISIBLE (1 << 5)
  38. #define HUD_FLAG_MINIMAP_RADAR_VISIBLE (1 << 6)
  39. #define HUD_PARAM_HOTBAR_ITEMCOUNT 1
  40. #define HUD_PARAM_HOTBAR_IMAGE 2
  41. #define HUD_PARAM_HOTBAR_SELECTED_IMAGE 3
  42. #define HUD_HOTBAR_ITEMCOUNT_DEFAULT 8
  43. #define HUD_HOTBAR_ITEMCOUNT_MAX 23
  44. #define HOTBAR_IMAGE_SIZE 48
  45. enum HudElementType {
  46. HUD_ELEM_IMAGE = 0,
  47. HUD_ELEM_TEXT = 1,
  48. HUD_ELEM_STATBAR = 2,
  49. HUD_ELEM_INVENTORY = 3,
  50. HUD_ELEM_WAYPOINT = 4,
  51. };
  52. enum HudElementStat {
  53. HUD_STAT_POS = 0,
  54. HUD_STAT_NAME,
  55. HUD_STAT_SCALE,
  56. HUD_STAT_TEXT,
  57. HUD_STAT_NUMBER,
  58. HUD_STAT_ITEM,
  59. HUD_STAT_DIR,
  60. HUD_STAT_ALIGN,
  61. HUD_STAT_OFFSET,
  62. HUD_STAT_WORLD_POS,
  63. HUD_STAT_SIZE
  64. };
  65. struct HudElement {
  66. HudElementType type;
  67. v2f pos;
  68. std::string name;
  69. v2f scale;
  70. std::string text;
  71. u32 number;
  72. u32 item;
  73. u32 dir;
  74. v2f align;
  75. v2f offset;
  76. v3f world_pos;
  77. v2s32 size;
  78. };
  79. extern const EnumString es_HudElementType[];
  80. extern const EnumString es_HudElementStat[];
  81. extern const EnumString es_HudBuiltinElement[];
  82. #endif