This repository has been archived on 2025-06-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
LotoStatek/main.cpp
2024-12-10 20:20:05 +01:00

44 lines
1.3 KiB
C++

#include <iostream>
#include "SFML/Graphics.hpp"
#include "headers/Plansza.h"
int main()
{
std::clog << "Game started\n";
sf::Texture playerTexture, playerBulletTexture, playerRocketTexture;
if (!playerTexture.loadFromFile("../assets/ship/Dreadnought-Base.png") ||
!playerBulletTexture.loadFromFile("../assets/img/bullets/bullet_pink.png") ||
!playerRocketTexture.loadFromFile("../assets/img/rockets/Rocket_111.png")) {
std::cerr << "Failed to load player textures!" << std::endl;
return -1;
}
sf::RenderWindow mainWindow(sf::VideoMode(600, 800), "LotoStatek");
mainWindow.setVerticalSyncEnabled(true);
mainWindow.setFramerateLimit(60);
sf::Image icon;
icon.loadFromFile("../assets/img/icon/ikonka.png");
mainWindow.setIcon(128, 128, icon.getPixelsPtr());
Plansza plansza(mainWindow.getSize().y, mainWindow.getSize().x, &mainWindow,playerTexture, playerBulletTexture, playerRocketTexture);
while (mainWindow.isOpen()) {
mainWindow.clear();
// Tu są handlowane eventy
sf::Event event{};
while (mainWindow.pollEvent(event)) {
if(event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
mainWindow.close();
}
plansza.update();
mainWindow.display();
}
return 0;
}