-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHUDDisplay.cpp
More file actions
35 lines (33 loc) · 888 Bytes
/
HUDDisplay.cpp
File metadata and controls
35 lines (33 loc) · 888 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
#include "HUDDisplay.h"
#include "renderContext.h"
#include "gameData.h"
void HUDDisplay::draw() const {
HUD->draw(getX(), getY(), getScale());
}
void HUDDisplay::update(Uint32 ticks) {
life_span += ticks;
}
int HUDDisplay::getScaledWidth() const {
return getScale() * HUD->getWidth();
}
int HUDDisplay::getScaledHeight() const {
return getScale() * HUD->getHeight();
}
const Image* HUDDisplay::getImage() const {
return HUD;
}
const SDL_Surface* HUDDisplay::getSurface() const {
return HUD->getSurface();
}
HUDDisplay::HUDDisplay(const std::string& HUD_image) :
Drawable(HUD_image, Vector2f(0, 0), Vector2f(0, 0), 1.0),
humanHasBow(false),
AIHasBow(false),
HUD( ImageFactory::getInstance().getImage(HUD_image) ),
life_span(0) {
humanBow = new Item("Bow", 289, 15, 1);
AIBow = new Item("Bow", 672, 15, 1);
}
HUDDisplay::~HUDDisplay() {
delete HUD;
}