-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiphone.cpp
56 lines (45 loc) · 1.33 KB
/
iphone.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*!\file iphone.cpp
*
* \brief Contains Iphone image and location.
*
* \author Chad Martin
*
* A Iphone image and location of where to paint.
*/
#include "iphone.h"
/*! \brief Class Constructor - loads image, moves to specified location.
* Precondition: A new instance of game was created.
* Postcondition: A new Iphone image is loaded and ready to be painted.*/
Iphone::Iphone()
{
image.load("iphoneFrame.png");
rect = image.rect();
setPosition(); // Sets the location of the Iphone
}
/*! \brief Class Destructor - Does Nothing*/
Iphone::~Iphone()
{
}
/*! \brief Sets the location of the Iphone.
* Precondition: A Iphone object was created.
* Postcondition: Location is set for the Iphone.*/
void Iphone::setPosition()
{
rect.moveTo(0,0); // moves the iphone to the upper right corner of the screen
}
/*! \brief Returns rect of Iphone.
* Precondition: Instance of Game called a paint event.
* Postcondition: The Qrect of the Iphone is returned.
* \return The rect of Iphone.*/
QRect Iphone::getRect()
{
return rect; //returns The rect of Iphone
}
/*! \brief Returns image of Iphone.
* Precondition: Instance of Game called a paint event.
* Postcondition: The image of the Iphone will be painted on the screen.
* \return Image of Iphone.*/
QImage & Iphone::getImage()
{
return image; //return Image of Iphone
}