forked from ManalHasan/OOP-Project-Manal-Moiz-Naaseh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEndWindow.cpp
More file actions
53 lines (41 loc) · 1.04 KB
/
EndWindow.cpp
File metadata and controls
53 lines (41 loc) · 1.04 KB
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
#include "EndWindow.hpp"
//initializing restart as false, so that when restart is clicked it becomes true
EndWindow::EndWindow():restart{false}{}
//Loading Game over window
void EndWindow::Initialize(SDL_Renderer* ren)
{
endBackground.CreateTexture("image/EndGame.png", ren);
}
//Checking whether restart is pressed or not, by tracing its coordinates
int EndWindow::EventHandling(SDL_Event& w)
{
SDL_PollEvent(&w);
if (w.type == SDL_QUIT)
{
return -1;
}
//if restart clicked
else if (w.type == SDL_MOUSEBUTTONDOWN && w.motion.x > 250 && w.motion.x < 550 && w.motion.y > 450 && w.motion.y < 530)
{
restart = true;
}
return 0;
}
//Rendering the end window
void EndWindow::Render(SDL_Renderer* ren)
{
endBackground.Render(ren);
}
//accessor of whether restart clicked or not
bool EndWindow::getRestart() const
{
return restart;
}
//mutator to change restart to another bool value
void EndWindow::setRestart(const bool s){
restart=s;
}
EndWindow::~EndWindow()
{
restart = false;
}