Zmiana sposobu tworzenia gracza.

Użyto singleton pattern.
Zmieniono konstruktor klasy Plansza
This commit is contained in:
2024-12-13 13:36:41 +01:00
parent 3f4a937257
commit 8b4b25747e
7 changed files with 139 additions and 142 deletions

View File

@@ -3,16 +3,8 @@
#include "headers/Plansza.h"
int main()
{
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);
@@ -22,8 +14,7 @@ int main()
mainWindow.setIcon(128, 128, icon.getPixelsPtr());
Plansza plansza(mainWindow.getSize().y, mainWindow.getSize().x, &mainWindow,playerTexture, playerBulletTexture, playerRocketTexture);
Plansza plansza(mainWindow.getSize().y, mainWindow.getSize().x, &mainWindow);
while (mainWindow.isOpen()) {
mainWindow.clear();
@@ -31,7 +22,7 @@ int main()
// Tu są handlowane eventy
sf::Event event{};
while (mainWindow.pollEvent(event)) {
if(event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
mainWindow.close();
}