-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHealthBar.h
More file actions
42 lines (34 loc) · 723 Bytes
/
Copy pathHealthBar.h
File metadata and controls
42 lines (34 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <vector>
#include <iostream>
using namespace std;
using namespace sf;
enum HeartID
{
Full,
Half,
Empty
};
class HealthBar
{
private:
int value, max;
Texture backgroundBarTexture;
RectangleShape bar;
Sprite backgroundBar;
Texture heartTexture;
map<HeartID, IntRect> heartTextureRect;
Sprite heart;
Font font;
Text text;
public:
HealthBar();
HealthBar(int _value, int _max);
void setHealthBar(int _value, int _max);
void setPlayerHealthBar(int _value, int _max);
void Draw(RenderWindow& gameWindow, int _value, FloatRect entityGlobalBounds);
void Draw(RenderWindow& gameWindow, int _value);
};