-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
72 lines (64 loc) · 1.38 KB
/
main.cpp
File metadata and controls
72 lines (64 loc) · 1.38 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// GROUP C
// Chase Huante, Shaochen Ren, Gregory Pytak, Keerthi Thummati, Ankur Prajapati
#include <SFML/Graphics.hpp>
#include<iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include "Sudoku.h"
#include "Menu.h"
#include "Tetris.h"
using namespace std;
int main() {
// open up UI window
sf::RenderWindow window(sf::VideoMode(400, 600), "Game-Pack");
Menu menu(window.getSize().x, window.getSize().y);
Texture t1;
t1.loadFromFile("images/menuBackground.jpg");
Sprite background(t1);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
switch (event.type)
{
case sf::Event::KeyReleased:
switch (event.key.code)
{
case sf::Keyboard::Up:
menu.moveUp();
break;
case sf::Keyboard::Down:
menu.moveDown();
break;
case sf::Keyboard::Return:
switch (menu.getPressedItem())
{
// case 0 to call Tetris.h and open tetris
case 0:
TETRIS();
break;
// case 0 to call Tetris.h and open tetris
case 1:
SUDOKU();
break;
// case 2 for EXIT
case 2:
window.close();
break;
}
break;
}
break;
case sf::Event::Closed:
window.close();
break;
}
}
window.clear();
window.draw(background);
menu.draw(window);
window.display();
}
}