-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTank.cpp
41 lines (41 loc) · 818 Bytes
/
Tank.cpp
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
#include<SFML/Graphics.hpp>
#include <iostream>
#include "../Tank.h"
Tank::Tank()
{
x = 0.0f, y = 0.0f;
offsetX = 0.0f;
if (!tankTexture.loadFromFile("resources/tank.png"))
{
std::cout << "Couldn't load from file";
}
tankSprite.setTexture(tankTexture);
}
Tank::Tank(sf::Texture& tankText)
{
tankSprite.setTexture(tankText);
}
void Tank::setTexture(sf::Texture& tankText)
{
tankSprite.setTexture(tankText);
}
void Tank::setPosition(sf::Vector2f pos)
{
tankSprite.setPosition(sf::Vector2f(pos.x, pos.y));
}
sf::Vector2f Tank::getPosition()
{
return tankSprite.getPosition();
}
void Tank::setScale(sf::Vector2f scale)
{
return tankSprite.setScale(sf::Vector2f(scale.x, scale.y));
}
sf::Sprite& Tank::getAddress()
{
return tankSprite;
}
void Tank::draw(sf::RenderWindow& window)
{
window.draw(tankSprite);
}