forked from ManalHasan/OOP-Project-Manal-Moiz-Naaseh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainmenu.cpp
46 lines (38 loc) · 786 Bytes
/
Mainmenu.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
#include "MainMenu.hpp"
MainMenu::MainMenu()
{
isClicked = false;
}
//loading the image of background
void MainMenu::Initialize(SDL_Renderer* ren)
{
menuBackground.CreateTexture("image/Main.png", ren);
}
//checking whether start game option is selected or not
int MainMenu::EventHandling(SDL_Event& e)
{
SDL_PollEvent(&e);
if (e.type == SDL_QUIT)
{
return -1;
}
else if (e.type == SDL_MOUSEBUTTONDOWN && e.motion.x > 285 && e.motion.x < 510 && e.motion.y > 430 && e.motion.y < 505)
{
isClicked = true;
}
return 0;
}
void MainMenu::Render(SDL_Renderer* ren)
{
menuBackground.Render(ren);
}
//accessor
bool MainMenu::getClicked()
{
return isClicked;
}
//destructor
MainMenu::~MainMenu()
{
isClicked = false;
}