diff --git a/Space-Invader.vcxproj b/Space-Invader.vcxproj index 6a9c377..c6b558c 100644 --- a/Space-Invader.vcxproj +++ b/Space-Invader.vcxproj @@ -135,6 +135,9 @@ + + + diff --git a/Space-Invader.vcxproj.filters b/Space-Invader.vcxproj.filters index fe92929..b066ff9 100644 --- a/Space-Invader.vcxproj.filters +++ b/Space-Invader.vcxproj.filters @@ -22,4 +22,9 @@ Fichiers sources + + + Fichiers d%27en-tête + + \ No newline at end of file diff --git a/Space-Invader.vcxproj.user b/Space-Invader.vcxproj.user index 88a5509..5df420f 100644 --- a/Space-Invader.vcxproj.user +++ b/Space-Invader.vcxproj.user @@ -1,4 +1,6 @@  - + + false + \ No newline at end of file diff --git a/main.cpp b/main.cpp index ad420c7..ff13e89 100644 --- a/main.cpp +++ b/main.cpp @@ -1,28 +1,25 @@ -#include +#include "main.h"; int main() { - sf::RenderWindow window(sf::VideoMode(1024, 800), "Space Invader", sf::Style::Titlebar | sf::Style::Close); + RenderWindow window(VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT), "Space Invader", Style::Titlebar | Style::Close); + window.setFramerateLimit(60); + window.setVerticalSyncEnabled(true); while (window.isOpen()) { - sf::Event event; + Event event; while (window.pollEvent(event)) { - if (event.type == sf::Event::Closed) + if (event.type == Event::Closed) { window.close(); } - else if (event.type == sf::Event::KeyPressed) - { - if (event.key.code == sf::Keyboard::Escape) - { - window.close(); - } - } - } - // Update here + window.clear(Color::Black); + + window.display(); + } } return 0; diff --git a/main.h b/main.h new file mode 100644 index 0000000..5f6aa9a --- /dev/null +++ b/main.h @@ -0,0 +1,11 @@ +#pragma once + +#include +#include +#include + +using namespace std; +using namespace sf; + +const int SCREEN_WIDTH = 1024; +const int SCREEN_HEIGHT = 1024; \ No newline at end of file