HUD.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // ----------------------------------------------------------------
  2. // From Game Programming in C++ by Sanjay Madhav
  3. // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
  4. //
  5. // Released under the BSD License
  6. // See LICENSE in root directory for full details.
  7. // ----------------------------------------------------------------
  8. #pragma once
  9. #include "UIScreen.h"
  10. #include <vector>
  11. class HUD : public UIScreen
  12. {
  13. public:
  14. // (Lower draw order corresponds with further back)
  15. HUD(class Game* game);
  16. ~HUD();
  17. void Update(float deltaTime) override;
  18. void Draw(class Shader* shader) override;
  19. void AddTargetComponent(class TargetComponent* tc);
  20. void RemoveTargetComponent(class TargetComponent* tc);
  21. protected:
  22. void UpdateCrosshair(float deltaTime);
  23. void UpdateRadar(float deltaTime);
  24. class Texture* mHealthBar;
  25. class Texture* mRadar;
  26. class Texture* mCrosshair;
  27. class Texture* mCrosshairEnemy;
  28. class Texture* mBlipTex;
  29. class Texture* mRadarArrow;
  30. // All the target components in the game
  31. std::vector<class TargetComponent*> mTargetComps;
  32. // 2D offsets of blips relative to radar
  33. std::vector<Vector2> mBlips;
  34. // Adjust range of radar and radius
  35. float mRadarRange;
  36. float mRadarRadius;
  37. // Whether the crosshair targets an enemy
  38. bool mTargetEnemy;
  39. };