Merge remote-tracking branch 'refs/remotes/origin/przeszkoda'

# Conflicts:
#	CMakeLists.txt
#	main.cpp
This commit is contained in:
2024-11-22 12:28:57 +01:00
18 changed files with 270 additions and 52 deletions
+1 -3
View File
@@ -31,9 +31,7 @@ public:
void updateBullets();
void setMovingSpeed(float speed) {
moving_speed = speed;
}
void setMovingSpeed(float speed);
protected:
sf::Sprite actorSprite;
+4 -4
View File
@@ -11,16 +11,16 @@ class Bullet {
};
public:
Bullet(float x, float y, sf::Texture &bulletTexture);
void update();
sf::Sprite& getSprite();
Bullet(float x, float y, sf::Texture &texture);
sf::Sprite &getSprite();
void setSpeed(float speed);
bool getStatus() const;
void update();
private:
sf::Sprite bulletSprite;
sf::Texture bulletTexture;
float bulletSpeed;
Position bulletPosition;
float bulletSpeed;
bool outOfBounds;
};
+30
View File
@@ -0,0 +1,30 @@
#ifndef LOTOSTATEK_METEOR_H
#define LOTOSTATEK_METEOR_H
#include "SFML/Graphics/Texture.hpp"
#include "SFML/Graphics/Sprite.hpp"
class Meteor {
struct Position {
int x;
int y;
};
public:
Meteor(float x, float y, sf::Texture &texture);
sf::Sprite &getSprite();
bool getStatus();
void update();
// ~Meteor();
private:
sf::Texture meteorTexture;
sf::Sprite meteorSprite;
Position meteorPosition;
float meteorRotationSpeed;
float meteorSpeed;
bool outOfBounds;
static unsigned int counter;
};
#endif //LOTOSTATEK_METEOR_H
+19 -3
View File
@@ -2,11 +2,27 @@
#define PLANSZA_H
#include "Meteor.h"
#include "RandomNumberGenerator.h"
#include "SFML/System/Clock.hpp"
class Plansza {
struct Size {
int height;
int width;
};
public:
Plansza(unsigned int windowHeight, unsigned int windowWidth);
void spawn_meteor();
Size getSize();
std::vector<Meteor> &getMeteors();
void update_meteors();
private:
std::vector<Meteor> meteors;
Size size;
sf::Texture meteorTexture1;
sf::Texture meteorTexture2;
sf::Clock spawnClock;
};
#endif //PLANSZA_H
+16
View File
@@ -0,0 +1,16 @@
#ifndef LOTOSTATEK_RANDOMNUMBERGENERATOR_H
#define LOTOSTATEK_RANDOMNUMBERGENERATOR_H
#include <random>
class RandomNumberGenerator {
public:
static int getRandomNumber(int min, int max) {
static std::random_device rd;
static std::mt19937 gen(rd());
static std::uniform_int_distribution<> dis(min, max);
return dis(gen);
}
};
#endif //LOTOSTATEK_RANDOMNUMBERGENERATOR_H