-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.cpp
More file actions
31 lines (26 loc) · 713 Bytes
/
Copy pathGUI.cpp
File metadata and controls
31 lines (26 loc) · 713 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
#include "GUI.h"
GUI::GUI(float hight)
{
this -> Hight = hight;
HPbar.setFillColor(Color(255, 51, 51, 255));
BgHp.setSize(Vector2f(100 * 2, hight));
BgHp.setFillColor(Color(102, 102, 255, 255));
BgHp.setOutlineThickness(2.0f);
BgHp.setOutlineColor(Color::Black);
}
GUI::~GUI()
{
}
void GUI::Draw(RenderWindow& window)
{
window.draw(BgHp);
window.draw(HPbar);
}
void GUI::Update(float Long, Vector2f view, Vector2f pos)
{
HPbar.setPosition(view.x + pos.x, view.y + pos.y);
if (Long > 0) HPbar.setSize(Vector2f(Long * (float)2, Hight));
else HPbar.setSize(Vector2f(0, 20));
BgHp.setPosition(view.x + pos.x, view.y + pos.y);
BgHp.setSize(Vector2f(100 * 2, Hight));
}