-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (52 loc) · 1.6 KB
/
main.cpp
File metadata and controls
57 lines (52 loc) · 1.6 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
#include<bits/stdc++.h>
using namespace std;
#include<chrono>
#include<fstream>
#include<SFML/Graphics.hpp>
#include "constants.cpp"
#include "map.cpp"
#include "player.cpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(WIDTH,HEIGHT),"NoName");
sf::RenderWindow window2(sf::VideoMode(WIDTH,HEIGHT),"3D");
window.setFramerateLimit(FRAMERATE);
window2.setFramerateLimit(FRAMERATE);
Map map;
Player p(400,400-205,0,5,5,&map);
while(window.isOpen()){
sf::Event event;
while(window.pollEvent(event)){
if(event.type==sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){
window.close();
window2.close();
}
}
sf::Event event2;
while(window2.pollEvent(event2)){
if(event2.type==sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){
window.close();
window2.close();
}
}
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
p.turnACW();
}if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
p.turnCW();
}if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
p.moveF();
}if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
p.moveB();
}
window.clear();
window2.clear();
// p.draw(window2);
map.draw(window);
p.castRays(window,window2);
// p.castRays(window2);
// map.draw(window2);
p.draw(window);
window.display();
window2.display();
}
}