style: window size & black background

This commit is contained in:
2024-01-08 11:43:17 +01:00
parent d227676285
commit c7c7c91818
5 changed files with 32 additions and 14 deletions
+10 -13
View File
@@ -1,28 +1,25 @@
#include <SFML/Graphics.hpp>
#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;