-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (36 loc) · 1019 Bytes
/
main.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
#include <SFML/Graphics.hpp>
#include "Player.h"
#include "Player.cpp"
#include "Platform.h"
int main()
{
Vector2f resolution;
resolution.x = VideoMode::getDesktopMode().width;
resolution.y = VideoMode::getDesktopMode().height;
sf::RenderWindow window(sf::VideoMode(resolution.x, resolution.y), "platformer");
Player player(0,500,80,80,resolution);
Platform plat(300,500,200,50);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
if(Keyboard::isKeyPressed(Keyboard::Escape))
{
window.close();
}
if(event.type==Event::KeyReleased)
{
player.isJumping=false;
}
}
player.updatePlayer(plat);
window.clear();
window.draw(player.getShape());
window.draw(plat.getShape());
window.display();
}
return 0;
}