-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShip.h
63 lines (48 loc) · 1.17 KB
/
Ship.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// Ship.h
// battleeee
//
// Created by Ingy on 12/30/14.
// Copyright (c) 2014 Ingy. All rights reserved.
//
#ifndef __battleeee__Ship__
#define __battleeee__Ship__
#include <utility>
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
class Ship
{
public:
Ship();
Ship(int size);
Ship(Ship & rhs);
~Ship();
bool shipSunk();
// setters
void setSize(int);
void setPosition(int rowTop,int colTop,int rowBottom,int colBottom);
void setPosition(int rowTop,int colTop);
void setOrientation (bool horiz);
// getters
int getSize();
pair <pair<int,int>,pair<int,int>> getPosition() const;
// booleans
bool isH(); //is horizontal
bool operator = (Ship &);
void hitShip();
void drawShip(RenderWindow *, bool);
void unDrawn ();
private:
bool sunk;
bool horizontal;
int size, numberHits;
bool drawn;
// top.first = rowTop (y coordinate)
// top.second = colTop (x coordinate)
pair <int,int> top, bottom;
// Sprites and textures
Sprite shipSprite;
Texture textures[4];
};
#endif /* defined(__battleeee__Ship__) */