diff --git a/CMakeLists.txt b/CMakeLists.txt index 10ceef7..99ca51a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,14 +19,20 @@ add_executable(LotoStatek main.cpp sources/Bullet.cpp headers/Meteor.h sources/Meteor.cpp - headers/RandomNumberGenerator.h) + headers/RandomNumberGenerator.h + headers/Projectile.h + sources/Projectile.cpp + headers/Rocket.h + sources/Rocket.cpp + headers/Size.h + headers/Position.h) if(WIN32) - set(SFML_ROOT "${CMAKE_SOURCE_DIR}/SFML") + set(SFML_ROOT "${CMAKE_SOURCE_DIR}/lib/SFML") # set(SFML_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/SFML/include") file(GLOB BINARY_DEP_DLLS "${SFML_INCLUDE_DIR}/../bin/*.dll") file(COPY ${BINARY_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR}) - include_directories("${CMAKE_SOURCE_DIR}/SFML/bin" "${CMAKE_SOURCE_DIR}/SFML/include" "${CMAKE_SOURCE_DIR}/SFML/lib/cmake/SFML") # dodane + include_directories("${CMAKE_SOURCE_DIR}/lib/SFML/bin" "${CMAKE_SOURCE_DIR}/lib/SFML/include" "${CMAKE_SOURCE_DIR}/lib/SFML/lib/cmake/SFML") # dodane set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules") # dodane find_package(SFML 2.6.2 COMPONENTS graphics window system audio REQUIRED) if(SFML_FOUND) @@ -34,9 +40,9 @@ if(WIN32) target_link_libraries(LotoStatek ${SFML_LIBRARIES}) endif() elseif(APPLE) - find_package(SFML 2.6.2 COMPONENTS graphics window system REQUIRED) + find_package(lib/SFML 2.6.2 COMPONENTS graphics window system REQUIRED) target_link_libraries(LotoStatek sfml-graphics sfml-window sfml-audio sfml-system) elseif(LINUX) - find_package(SFML 2.6.2 COMPONENTS graphics window system REQUIRED) + find_package(lib/SFML 2.6.2 COMPONENTS graphics window system REQUIRED) target_link_libraries(LotoStatek sfml-graphics sfml-window sfml-audio sfml-system) endif() \ No newline at end of file diff --git a/assets/img/space.png b/assets/img/background/background.png similarity index 100% rename from assets/img/space.png rename to assets/img/background/background.png diff --git a/assets/img/bullet_right.png b/assets/img/bullets/bullet_green.png similarity index 100% rename from assets/img/bullet_right.png rename to assets/img/bullets/bullet_green.png diff --git a/assets/img/bullet_left.png b/assets/img/bullets/bullet_pink.png similarity index 100% rename from assets/img/bullet_left.png rename to assets/img/bullets/bullet_pink.png diff --git a/assets/img/ikonka.png b/assets/img/icon/ikonka.png similarity index 100% rename from assets/img/ikonka.png rename to assets/img/icon/ikonka.png diff --git a/assets/img/meteor-1.png b/assets/img/meteors/meteor-1.png similarity index 100% rename from assets/img/meteor-1.png rename to assets/img/meteors/meteor-1.png diff --git a/assets/img/meteor-2.png b/assets/img/meteors/meteor-2.png similarity index 100% rename from assets/img/meteor-2.png rename to assets/img/meteors/meteor-2.png diff --git a/assets/img/Rocket_111.png b/assets/img/rockets/Rocket_111.png similarity index 100% rename from assets/img/Rocket_111.png rename to assets/img/rockets/Rocket_111.png diff --git a/assets/img/Rocket_115.png b/assets/img/rockets/Rocket_115.png similarity index 100% rename from assets/img/Rocket_115.png rename to assets/img/rockets/Rocket_115.png diff --git a/headers/Actor.h b/headers/Actor.h index 56b704a..7fc1ec6 100644 --- a/headers/Actor.h +++ b/headers/Actor.h @@ -4,11 +4,8 @@ #include "SFML/Graphics/Sprite.hpp" #include "SFML/Graphics/Texture.hpp" #include "Bullet.h" +#include "Position.h" -struct Position { - int x; - int y; -}; class Actor { public: diff --git a/headers/AudioManager.h b/headers/AudioManager.h index 96840a0..6d4e16e 100644 --- a/headers/AudioManager.h +++ b/headers/AudioManager.h @@ -7,6 +7,7 @@ class AudioManager { public: + AudioManager() = default; bool loadBackgroundMusic(const std::string& filePath); void playBackgroundMusic(float volume = 50.f, bool loop = true); void stopBackgroundMusic(); diff --git a/headers/Bullet.h b/headers/Bullet.h index 74d2539..d6bc301 100644 --- a/headers/Bullet.h +++ b/headers/Bullet.h @@ -1,27 +1,13 @@ #ifndef LOTOSTATEK_BULLET_H #define LOTOSTATEK_BULLET_H -#include "SFML/Graphics/Sprite.hpp" +#include "Projectile.h" #include "SFML/Graphics/Texture.hpp" -class Bullet { - struct Position { - int x; - int y; - }; - +class Bullet : public Projectile { public: - 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; - Position bulletPosition; - float bulletSpeed; - bool outOfBounds; + Bullet(float x, float y, sf::Texture &texture) : Projectile(x,y, texture) {}; + void update() override; }; diff --git a/headers/Meteor.h b/headers/Meteor.h index 8b42356..e283b82 100644 --- a/headers/Meteor.h +++ b/headers/Meteor.h @@ -3,13 +3,9 @@ #include "SFML/Graphics/Texture.hpp" #include "SFML/Graphics/Sprite.hpp" +#include "Position.h" class Meteor { - struct Position { - int x; - int y; - }; - public: Meteor(float x, float y, sf::Texture &texture); sf::Sprite &getSprite(); diff --git a/headers/Plansza.h b/headers/Plansza.h index 3aae063..0971823 100644 --- a/headers/Plansza.h +++ b/headers/Plansza.h @@ -1,28 +1,36 @@ #ifndef PLANSZA_H #define PLANSZA_H - #include "Meteor.h" #include "RandomNumberGenerator.h" #include "SFML/System/Clock.hpp" +#include "SFML/Graphics/RenderWindow.hpp" +#include "Size.h" + +#include "Player.h" +#include "Background.h" +#include "AudioManager.h" +#include "Meteor.h" +#include "Plansza.h" class Plansza { - struct Size { - int height; - int width; - }; public: - Plansza(unsigned int windowHeight, unsigned int windowWidth); - void spawn_meteor(); + Plansza(unsigned int windowHeight,unsigned int windowWidth, sf::RenderWindow *mainWindow); Size getSize(); std::vector &getMeteors(); + void spawn_meteor(); void update_meteors(); + void update(); private: - std::vector meteors; Size size; + Background background; + Player ship; + AudioManager audioManager; sf::Texture meteorTexture1; sf::Texture meteorTexture2; sf::Clock spawnClock; + std::vector meteors; + sf::RenderWindow *window; }; #endif //PLANSZA_H diff --git a/headers/Player.h b/headers/Player.h index 8138296..e6b4c01 100644 --- a/headers/Player.h +++ b/headers/Player.h @@ -4,6 +4,7 @@ #include #include "Actor.h" +#include "Rocket.h" class Player : public Actor { public: @@ -16,10 +17,12 @@ public: void moveRight() override; void moveUp() override; void moveDown() override; + std::vector& getRockets(); private: std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now(); - std::vector rightBullets; - + std::vector rockets; + sf::Texture rocketTexture; + sf::Texture bulletTexture; }; diff --git a/headers/Position.h b/headers/Position.h new file mode 100644 index 0000000..6f69670 --- /dev/null +++ b/headers/Position.h @@ -0,0 +1,9 @@ +#ifndef LOTOSTATEK_POSITION_H +#define LOTOSTATEK_POSITION_H + +struct Position { + int x; + int y; +}; + +#endif //LOTOSTATEK_POSITION_H diff --git a/headers/Projectile.h b/headers/Projectile.h new file mode 100644 index 0000000..74f4b0f --- /dev/null +++ b/headers/Projectile.h @@ -0,0 +1,23 @@ +#ifndef PROJECTILE_H +#define PROJECTILE_H + +#include +#include "Position.h" + +class Projectile { +public: + Projectile(float x, float y, sf::Texture &texture); + sf::Sprite &getSprite(); + void setSpeed(float speed); + bool isOutOfBounds() const; + virtual void update() = 0; +protected: + static sf::Texture texture; + sf::Sprite sprite; + Position position; + float speed; + bool outOfBounds; + ~Projectile() = default; +}; + +#endif //PROJECTILE_H diff --git a/headers/Rocket.h b/headers/Rocket.h new file mode 100644 index 0000000..37503f7 --- /dev/null +++ b/headers/Rocket.h @@ -0,0 +1,14 @@ +#ifndef ROCKET_H +#define ROCKET_H +#include "Projectile.h" + + +class Rocket : public Projectile{ +public: + Rocket(float x, float y, sf::Texture &texture) : Projectile(x,y, texture) {}; + void update() override; +}; + + + +#endif //ROCKET_H diff --git a/headers/Size.h b/headers/Size.h new file mode 100644 index 0000000..2b8842c --- /dev/null +++ b/headers/Size.h @@ -0,0 +1,9 @@ +#ifndef LOTOSTATEK_SIZE_H +#define LOTOSTATEK_SIZE_H + +struct Size { + int height; + int width; +}; + +#endif //LOTOSTATEK_SIZE_H diff --git a/SFML/bin/openal32.dll b/lib/SFML/bin/openal32.dll similarity index 100% rename from SFML/bin/openal32.dll rename to lib/SFML/bin/openal32.dll diff --git a/SFML/bin/sfml-audio-2.dll b/lib/SFML/bin/sfml-audio-2.dll similarity index 100% rename from SFML/bin/sfml-audio-2.dll rename to lib/SFML/bin/sfml-audio-2.dll diff --git a/SFML/bin/sfml-audio-d-2.dll b/lib/SFML/bin/sfml-audio-d-2.dll similarity index 100% rename from SFML/bin/sfml-audio-d-2.dll rename to lib/SFML/bin/sfml-audio-d-2.dll diff --git a/SFML/bin/sfml-graphics-2.dll b/lib/SFML/bin/sfml-graphics-2.dll similarity index 100% rename from SFML/bin/sfml-graphics-2.dll rename to lib/SFML/bin/sfml-graphics-2.dll diff --git a/SFML/bin/sfml-graphics-d-2.dll b/lib/SFML/bin/sfml-graphics-d-2.dll similarity index 100% rename from SFML/bin/sfml-graphics-d-2.dll rename to lib/SFML/bin/sfml-graphics-d-2.dll diff --git a/SFML/bin/sfml-network-2.dll b/lib/SFML/bin/sfml-network-2.dll similarity index 100% rename from SFML/bin/sfml-network-2.dll rename to lib/SFML/bin/sfml-network-2.dll diff --git a/SFML/bin/sfml-network-d-2.dll b/lib/SFML/bin/sfml-network-d-2.dll similarity index 100% rename from SFML/bin/sfml-network-d-2.dll rename to lib/SFML/bin/sfml-network-d-2.dll diff --git a/SFML/bin/sfml-system-2.dll b/lib/SFML/bin/sfml-system-2.dll similarity index 100% rename from SFML/bin/sfml-system-2.dll rename to lib/SFML/bin/sfml-system-2.dll diff --git a/SFML/bin/sfml-system-d-2.dll b/lib/SFML/bin/sfml-system-d-2.dll similarity index 100% rename from SFML/bin/sfml-system-d-2.dll rename to lib/SFML/bin/sfml-system-d-2.dll diff --git a/SFML/bin/sfml-window-2.dll b/lib/SFML/bin/sfml-window-2.dll similarity index 100% rename from SFML/bin/sfml-window-2.dll rename to lib/SFML/bin/sfml-window-2.dll diff --git a/SFML/bin/sfml-window-d-2.dll b/lib/SFML/bin/sfml-window-d-2.dll similarity index 100% rename from SFML/bin/sfml-window-d-2.dll rename to lib/SFML/bin/sfml-window-d-2.dll diff --git a/SFML/include/SFML/Audio.hpp b/lib/SFML/include/SFML/Audio.hpp similarity index 100% rename from SFML/include/SFML/Audio.hpp rename to lib/SFML/include/SFML/Audio.hpp diff --git a/SFML/include/SFML/Audio/AlResource.hpp b/lib/SFML/include/SFML/Audio/AlResource.hpp similarity index 100% rename from SFML/include/SFML/Audio/AlResource.hpp rename to lib/SFML/include/SFML/Audio/AlResource.hpp diff --git a/SFML/include/SFML/Audio/Export.hpp b/lib/SFML/include/SFML/Audio/Export.hpp similarity index 100% rename from SFML/include/SFML/Audio/Export.hpp rename to lib/SFML/include/SFML/Audio/Export.hpp diff --git a/SFML/include/SFML/Audio/InputSoundFile.hpp b/lib/SFML/include/SFML/Audio/InputSoundFile.hpp similarity index 100% rename from SFML/include/SFML/Audio/InputSoundFile.hpp rename to lib/SFML/include/SFML/Audio/InputSoundFile.hpp diff --git a/SFML/include/SFML/Audio/Listener.hpp b/lib/SFML/include/SFML/Audio/Listener.hpp similarity index 100% rename from SFML/include/SFML/Audio/Listener.hpp rename to lib/SFML/include/SFML/Audio/Listener.hpp diff --git a/SFML/include/SFML/Audio/Music.hpp b/lib/SFML/include/SFML/Audio/Music.hpp similarity index 100% rename from SFML/include/SFML/Audio/Music.hpp rename to lib/SFML/include/SFML/Audio/Music.hpp diff --git a/SFML/include/SFML/Audio/OutputSoundFile.hpp b/lib/SFML/include/SFML/Audio/OutputSoundFile.hpp similarity index 100% rename from SFML/include/SFML/Audio/OutputSoundFile.hpp rename to lib/SFML/include/SFML/Audio/OutputSoundFile.hpp diff --git a/SFML/include/SFML/Audio/Sound.hpp b/lib/SFML/include/SFML/Audio/Sound.hpp similarity index 100% rename from SFML/include/SFML/Audio/Sound.hpp rename to lib/SFML/include/SFML/Audio/Sound.hpp diff --git a/SFML/include/SFML/Audio/SoundBuffer.hpp b/lib/SFML/include/SFML/Audio/SoundBuffer.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundBuffer.hpp rename to lib/SFML/include/SFML/Audio/SoundBuffer.hpp diff --git a/SFML/include/SFML/Audio/SoundBufferRecorder.hpp b/lib/SFML/include/SFML/Audio/SoundBufferRecorder.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundBufferRecorder.hpp rename to lib/SFML/include/SFML/Audio/SoundBufferRecorder.hpp diff --git a/SFML/include/SFML/Audio/SoundFileFactory.hpp b/lib/SFML/include/SFML/Audio/SoundFileFactory.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundFileFactory.hpp rename to lib/SFML/include/SFML/Audio/SoundFileFactory.hpp diff --git a/SFML/include/SFML/Audio/SoundFileFactory.inl b/lib/SFML/include/SFML/Audio/SoundFileFactory.inl similarity index 100% rename from SFML/include/SFML/Audio/SoundFileFactory.inl rename to lib/SFML/include/SFML/Audio/SoundFileFactory.inl diff --git a/SFML/include/SFML/Audio/SoundFileReader.hpp b/lib/SFML/include/SFML/Audio/SoundFileReader.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundFileReader.hpp rename to lib/SFML/include/SFML/Audio/SoundFileReader.hpp diff --git a/SFML/include/SFML/Audio/SoundFileWriter.hpp b/lib/SFML/include/SFML/Audio/SoundFileWriter.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundFileWriter.hpp rename to lib/SFML/include/SFML/Audio/SoundFileWriter.hpp diff --git a/SFML/include/SFML/Audio/SoundRecorder.hpp b/lib/SFML/include/SFML/Audio/SoundRecorder.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundRecorder.hpp rename to lib/SFML/include/SFML/Audio/SoundRecorder.hpp diff --git a/SFML/include/SFML/Audio/SoundSource.hpp b/lib/SFML/include/SFML/Audio/SoundSource.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundSource.hpp rename to lib/SFML/include/SFML/Audio/SoundSource.hpp diff --git a/SFML/include/SFML/Audio/SoundStream.hpp b/lib/SFML/include/SFML/Audio/SoundStream.hpp similarity index 100% rename from SFML/include/SFML/Audio/SoundStream.hpp rename to lib/SFML/include/SFML/Audio/SoundStream.hpp diff --git a/SFML/include/SFML/Config.hpp b/lib/SFML/include/SFML/Config.hpp similarity index 100% rename from SFML/include/SFML/Config.hpp rename to lib/SFML/include/SFML/Config.hpp diff --git a/SFML/include/SFML/GpuPreference.hpp b/lib/SFML/include/SFML/GpuPreference.hpp similarity index 100% rename from SFML/include/SFML/GpuPreference.hpp rename to lib/SFML/include/SFML/GpuPreference.hpp diff --git a/SFML/include/SFML/Graphics.hpp b/lib/SFML/include/SFML/Graphics.hpp similarity index 100% rename from SFML/include/SFML/Graphics.hpp rename to lib/SFML/include/SFML/Graphics.hpp diff --git a/SFML/include/SFML/Graphics/BlendMode.hpp b/lib/SFML/include/SFML/Graphics/BlendMode.hpp similarity index 100% rename from SFML/include/SFML/Graphics/BlendMode.hpp rename to lib/SFML/include/SFML/Graphics/BlendMode.hpp diff --git a/SFML/include/SFML/Graphics/CircleShape.hpp b/lib/SFML/include/SFML/Graphics/CircleShape.hpp similarity index 100% rename from SFML/include/SFML/Graphics/CircleShape.hpp rename to lib/SFML/include/SFML/Graphics/CircleShape.hpp diff --git a/SFML/include/SFML/Graphics/Color.hpp b/lib/SFML/include/SFML/Graphics/Color.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Color.hpp rename to lib/SFML/include/SFML/Graphics/Color.hpp diff --git a/SFML/include/SFML/Graphics/ConvexShape.hpp b/lib/SFML/include/SFML/Graphics/ConvexShape.hpp similarity index 100% rename from SFML/include/SFML/Graphics/ConvexShape.hpp rename to lib/SFML/include/SFML/Graphics/ConvexShape.hpp diff --git a/SFML/include/SFML/Graphics/Drawable.hpp b/lib/SFML/include/SFML/Graphics/Drawable.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Drawable.hpp rename to lib/SFML/include/SFML/Graphics/Drawable.hpp diff --git a/SFML/include/SFML/Graphics/Export.hpp b/lib/SFML/include/SFML/Graphics/Export.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Export.hpp rename to lib/SFML/include/SFML/Graphics/Export.hpp diff --git a/SFML/include/SFML/Graphics/Font.hpp b/lib/SFML/include/SFML/Graphics/Font.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Font.hpp rename to lib/SFML/include/SFML/Graphics/Font.hpp diff --git a/SFML/include/SFML/Graphics/Glsl.hpp b/lib/SFML/include/SFML/Graphics/Glsl.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Glsl.hpp rename to lib/SFML/include/SFML/Graphics/Glsl.hpp diff --git a/SFML/include/SFML/Graphics/Glsl.inl b/lib/SFML/include/SFML/Graphics/Glsl.inl similarity index 100% rename from SFML/include/SFML/Graphics/Glsl.inl rename to lib/SFML/include/SFML/Graphics/Glsl.inl diff --git a/SFML/include/SFML/Graphics/Glyph.hpp b/lib/SFML/include/SFML/Graphics/Glyph.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Glyph.hpp rename to lib/SFML/include/SFML/Graphics/Glyph.hpp diff --git a/SFML/include/SFML/Graphics/Image.hpp b/lib/SFML/include/SFML/Graphics/Image.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Image.hpp rename to lib/SFML/include/SFML/Graphics/Image.hpp diff --git a/SFML/include/SFML/Graphics/PrimitiveType.hpp b/lib/SFML/include/SFML/Graphics/PrimitiveType.hpp similarity index 100% rename from SFML/include/SFML/Graphics/PrimitiveType.hpp rename to lib/SFML/include/SFML/Graphics/PrimitiveType.hpp diff --git a/SFML/include/SFML/Graphics/Rect.hpp b/lib/SFML/include/SFML/Graphics/Rect.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Rect.hpp rename to lib/SFML/include/SFML/Graphics/Rect.hpp diff --git a/SFML/include/SFML/Graphics/Rect.inl b/lib/SFML/include/SFML/Graphics/Rect.inl similarity index 100% rename from SFML/include/SFML/Graphics/Rect.inl rename to lib/SFML/include/SFML/Graphics/Rect.inl diff --git a/SFML/include/SFML/Graphics/RectangleShape.hpp b/lib/SFML/include/SFML/Graphics/RectangleShape.hpp similarity index 100% rename from SFML/include/SFML/Graphics/RectangleShape.hpp rename to lib/SFML/include/SFML/Graphics/RectangleShape.hpp diff --git a/SFML/include/SFML/Graphics/RenderStates.hpp b/lib/SFML/include/SFML/Graphics/RenderStates.hpp similarity index 100% rename from SFML/include/SFML/Graphics/RenderStates.hpp rename to lib/SFML/include/SFML/Graphics/RenderStates.hpp diff --git a/SFML/include/SFML/Graphics/RenderTarget.hpp b/lib/SFML/include/SFML/Graphics/RenderTarget.hpp similarity index 100% rename from SFML/include/SFML/Graphics/RenderTarget.hpp rename to lib/SFML/include/SFML/Graphics/RenderTarget.hpp diff --git a/SFML/include/SFML/Graphics/RenderTexture.hpp b/lib/SFML/include/SFML/Graphics/RenderTexture.hpp similarity index 100% rename from SFML/include/SFML/Graphics/RenderTexture.hpp rename to lib/SFML/include/SFML/Graphics/RenderTexture.hpp diff --git a/SFML/include/SFML/Graphics/RenderWindow.hpp b/lib/SFML/include/SFML/Graphics/RenderWindow.hpp similarity index 100% rename from SFML/include/SFML/Graphics/RenderWindow.hpp rename to lib/SFML/include/SFML/Graphics/RenderWindow.hpp diff --git a/SFML/include/SFML/Graphics/Shader.hpp b/lib/SFML/include/SFML/Graphics/Shader.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Shader.hpp rename to lib/SFML/include/SFML/Graphics/Shader.hpp diff --git a/SFML/include/SFML/Graphics/Shape.hpp b/lib/SFML/include/SFML/Graphics/Shape.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Shape.hpp rename to lib/SFML/include/SFML/Graphics/Shape.hpp diff --git a/SFML/include/SFML/Graphics/Sprite.hpp b/lib/SFML/include/SFML/Graphics/Sprite.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Sprite.hpp rename to lib/SFML/include/SFML/Graphics/Sprite.hpp diff --git a/SFML/include/SFML/Graphics/Text.hpp b/lib/SFML/include/SFML/Graphics/Text.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Text.hpp rename to lib/SFML/include/SFML/Graphics/Text.hpp diff --git a/SFML/include/SFML/Graphics/Texture.hpp b/lib/SFML/include/SFML/Graphics/Texture.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Texture.hpp rename to lib/SFML/include/SFML/Graphics/Texture.hpp diff --git a/SFML/include/SFML/Graphics/Transform.hpp b/lib/SFML/include/SFML/Graphics/Transform.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Transform.hpp rename to lib/SFML/include/SFML/Graphics/Transform.hpp diff --git a/SFML/include/SFML/Graphics/Transformable.hpp b/lib/SFML/include/SFML/Graphics/Transformable.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Transformable.hpp rename to lib/SFML/include/SFML/Graphics/Transformable.hpp diff --git a/SFML/include/SFML/Graphics/Vertex.hpp b/lib/SFML/include/SFML/Graphics/Vertex.hpp similarity index 100% rename from SFML/include/SFML/Graphics/Vertex.hpp rename to lib/SFML/include/SFML/Graphics/Vertex.hpp diff --git a/SFML/include/SFML/Graphics/VertexArray.hpp b/lib/SFML/include/SFML/Graphics/VertexArray.hpp similarity index 100% rename from SFML/include/SFML/Graphics/VertexArray.hpp rename to lib/SFML/include/SFML/Graphics/VertexArray.hpp diff --git a/SFML/include/SFML/Graphics/VertexBuffer.hpp b/lib/SFML/include/SFML/Graphics/VertexBuffer.hpp similarity index 100% rename from SFML/include/SFML/Graphics/VertexBuffer.hpp rename to lib/SFML/include/SFML/Graphics/VertexBuffer.hpp diff --git a/SFML/include/SFML/Graphics/View.hpp b/lib/SFML/include/SFML/Graphics/View.hpp similarity index 100% rename from SFML/include/SFML/Graphics/View.hpp rename to lib/SFML/include/SFML/Graphics/View.hpp diff --git a/SFML/include/SFML/Main.hpp b/lib/SFML/include/SFML/Main.hpp similarity index 100% rename from SFML/include/SFML/Main.hpp rename to lib/SFML/include/SFML/Main.hpp diff --git a/SFML/include/SFML/Network.hpp b/lib/SFML/include/SFML/Network.hpp similarity index 100% rename from SFML/include/SFML/Network.hpp rename to lib/SFML/include/SFML/Network.hpp diff --git a/SFML/include/SFML/Network/Export.hpp b/lib/SFML/include/SFML/Network/Export.hpp similarity index 100% rename from SFML/include/SFML/Network/Export.hpp rename to lib/SFML/include/SFML/Network/Export.hpp diff --git a/SFML/include/SFML/Network/Ftp.hpp b/lib/SFML/include/SFML/Network/Ftp.hpp similarity index 100% rename from SFML/include/SFML/Network/Ftp.hpp rename to lib/SFML/include/SFML/Network/Ftp.hpp diff --git a/SFML/include/SFML/Network/Http.hpp b/lib/SFML/include/SFML/Network/Http.hpp similarity index 100% rename from SFML/include/SFML/Network/Http.hpp rename to lib/SFML/include/SFML/Network/Http.hpp diff --git a/SFML/include/SFML/Network/IpAddress.hpp b/lib/SFML/include/SFML/Network/IpAddress.hpp similarity index 100% rename from SFML/include/SFML/Network/IpAddress.hpp rename to lib/SFML/include/SFML/Network/IpAddress.hpp diff --git a/SFML/include/SFML/Network/Packet.hpp b/lib/SFML/include/SFML/Network/Packet.hpp similarity index 100% rename from SFML/include/SFML/Network/Packet.hpp rename to lib/SFML/include/SFML/Network/Packet.hpp diff --git a/SFML/include/SFML/Network/Socket.hpp b/lib/SFML/include/SFML/Network/Socket.hpp similarity index 100% rename from SFML/include/SFML/Network/Socket.hpp rename to lib/SFML/include/SFML/Network/Socket.hpp diff --git a/SFML/include/SFML/Network/SocketHandle.hpp b/lib/SFML/include/SFML/Network/SocketHandle.hpp similarity index 100% rename from SFML/include/SFML/Network/SocketHandle.hpp rename to lib/SFML/include/SFML/Network/SocketHandle.hpp diff --git a/SFML/include/SFML/Network/SocketSelector.hpp b/lib/SFML/include/SFML/Network/SocketSelector.hpp similarity index 100% rename from SFML/include/SFML/Network/SocketSelector.hpp rename to lib/SFML/include/SFML/Network/SocketSelector.hpp diff --git a/SFML/include/SFML/Network/TcpListener.hpp b/lib/SFML/include/SFML/Network/TcpListener.hpp similarity index 100% rename from SFML/include/SFML/Network/TcpListener.hpp rename to lib/SFML/include/SFML/Network/TcpListener.hpp diff --git a/SFML/include/SFML/Network/TcpSocket.hpp b/lib/SFML/include/SFML/Network/TcpSocket.hpp similarity index 100% rename from SFML/include/SFML/Network/TcpSocket.hpp rename to lib/SFML/include/SFML/Network/TcpSocket.hpp diff --git a/SFML/include/SFML/Network/UdpSocket.hpp b/lib/SFML/include/SFML/Network/UdpSocket.hpp similarity index 100% rename from SFML/include/SFML/Network/UdpSocket.hpp rename to lib/SFML/include/SFML/Network/UdpSocket.hpp diff --git a/SFML/include/SFML/OpenGL.hpp b/lib/SFML/include/SFML/OpenGL.hpp similarity index 100% rename from SFML/include/SFML/OpenGL.hpp rename to lib/SFML/include/SFML/OpenGL.hpp diff --git a/SFML/include/SFML/System.hpp b/lib/SFML/include/SFML/System.hpp similarity index 100% rename from SFML/include/SFML/System.hpp rename to lib/SFML/include/SFML/System.hpp diff --git a/SFML/include/SFML/System/Clock.hpp b/lib/SFML/include/SFML/System/Clock.hpp similarity index 100% rename from SFML/include/SFML/System/Clock.hpp rename to lib/SFML/include/SFML/System/Clock.hpp diff --git a/SFML/include/SFML/System/Err.hpp b/lib/SFML/include/SFML/System/Err.hpp similarity index 100% rename from SFML/include/SFML/System/Err.hpp rename to lib/SFML/include/SFML/System/Err.hpp diff --git a/SFML/include/SFML/System/Export.hpp b/lib/SFML/include/SFML/System/Export.hpp similarity index 100% rename from SFML/include/SFML/System/Export.hpp rename to lib/SFML/include/SFML/System/Export.hpp diff --git a/SFML/include/SFML/System/FileInputStream.hpp b/lib/SFML/include/SFML/System/FileInputStream.hpp similarity index 100% rename from SFML/include/SFML/System/FileInputStream.hpp rename to lib/SFML/include/SFML/System/FileInputStream.hpp diff --git a/SFML/include/SFML/System/InputStream.hpp b/lib/SFML/include/SFML/System/InputStream.hpp similarity index 100% rename from SFML/include/SFML/System/InputStream.hpp rename to lib/SFML/include/SFML/System/InputStream.hpp diff --git a/SFML/include/SFML/System/Lock.hpp b/lib/SFML/include/SFML/System/Lock.hpp similarity index 100% rename from SFML/include/SFML/System/Lock.hpp rename to lib/SFML/include/SFML/System/Lock.hpp diff --git a/SFML/include/SFML/System/MemoryInputStream.hpp b/lib/SFML/include/SFML/System/MemoryInputStream.hpp similarity index 100% rename from SFML/include/SFML/System/MemoryInputStream.hpp rename to lib/SFML/include/SFML/System/MemoryInputStream.hpp diff --git a/SFML/include/SFML/System/Mutex.hpp b/lib/SFML/include/SFML/System/Mutex.hpp similarity index 100% rename from SFML/include/SFML/System/Mutex.hpp rename to lib/SFML/include/SFML/System/Mutex.hpp diff --git a/SFML/include/SFML/System/NativeActivity.hpp b/lib/SFML/include/SFML/System/NativeActivity.hpp similarity index 100% rename from SFML/include/SFML/System/NativeActivity.hpp rename to lib/SFML/include/SFML/System/NativeActivity.hpp diff --git a/SFML/include/SFML/System/NonCopyable.hpp b/lib/SFML/include/SFML/System/NonCopyable.hpp similarity index 100% rename from SFML/include/SFML/System/NonCopyable.hpp rename to lib/SFML/include/SFML/System/NonCopyable.hpp diff --git a/SFML/include/SFML/System/Sleep.hpp b/lib/SFML/include/SFML/System/Sleep.hpp similarity index 100% rename from SFML/include/SFML/System/Sleep.hpp rename to lib/SFML/include/SFML/System/Sleep.hpp diff --git a/SFML/include/SFML/System/String.hpp b/lib/SFML/include/SFML/System/String.hpp similarity index 100% rename from SFML/include/SFML/System/String.hpp rename to lib/SFML/include/SFML/System/String.hpp diff --git a/SFML/include/SFML/System/String.inl b/lib/SFML/include/SFML/System/String.inl similarity index 100% rename from SFML/include/SFML/System/String.inl rename to lib/SFML/include/SFML/System/String.inl diff --git a/SFML/include/SFML/System/Thread.hpp b/lib/SFML/include/SFML/System/Thread.hpp similarity index 100% rename from SFML/include/SFML/System/Thread.hpp rename to lib/SFML/include/SFML/System/Thread.hpp diff --git a/SFML/include/SFML/System/Thread.inl b/lib/SFML/include/SFML/System/Thread.inl similarity index 100% rename from SFML/include/SFML/System/Thread.inl rename to lib/SFML/include/SFML/System/Thread.inl diff --git a/SFML/include/SFML/System/ThreadLocal.hpp b/lib/SFML/include/SFML/System/ThreadLocal.hpp similarity index 100% rename from SFML/include/SFML/System/ThreadLocal.hpp rename to lib/SFML/include/SFML/System/ThreadLocal.hpp diff --git a/SFML/include/SFML/System/ThreadLocalPtr.hpp b/lib/SFML/include/SFML/System/ThreadLocalPtr.hpp similarity index 100% rename from SFML/include/SFML/System/ThreadLocalPtr.hpp rename to lib/SFML/include/SFML/System/ThreadLocalPtr.hpp diff --git a/SFML/include/SFML/System/ThreadLocalPtr.inl b/lib/SFML/include/SFML/System/ThreadLocalPtr.inl similarity index 100% rename from SFML/include/SFML/System/ThreadLocalPtr.inl rename to lib/SFML/include/SFML/System/ThreadLocalPtr.inl diff --git a/SFML/include/SFML/System/Time.hpp b/lib/SFML/include/SFML/System/Time.hpp similarity index 100% rename from SFML/include/SFML/System/Time.hpp rename to lib/SFML/include/SFML/System/Time.hpp diff --git a/SFML/include/SFML/System/Utf.hpp b/lib/SFML/include/SFML/System/Utf.hpp similarity index 100% rename from SFML/include/SFML/System/Utf.hpp rename to lib/SFML/include/SFML/System/Utf.hpp diff --git a/SFML/include/SFML/System/Utf.inl b/lib/SFML/include/SFML/System/Utf.inl similarity index 100% rename from SFML/include/SFML/System/Utf.inl rename to lib/SFML/include/SFML/System/Utf.inl diff --git a/SFML/include/SFML/System/Vector2.hpp b/lib/SFML/include/SFML/System/Vector2.hpp similarity index 100% rename from SFML/include/SFML/System/Vector2.hpp rename to lib/SFML/include/SFML/System/Vector2.hpp diff --git a/SFML/include/SFML/System/Vector2.inl b/lib/SFML/include/SFML/System/Vector2.inl similarity index 100% rename from SFML/include/SFML/System/Vector2.inl rename to lib/SFML/include/SFML/System/Vector2.inl diff --git a/SFML/include/SFML/System/Vector3.hpp b/lib/SFML/include/SFML/System/Vector3.hpp similarity index 100% rename from SFML/include/SFML/System/Vector3.hpp rename to lib/SFML/include/SFML/System/Vector3.hpp diff --git a/SFML/include/SFML/System/Vector3.inl b/lib/SFML/include/SFML/System/Vector3.inl similarity index 100% rename from SFML/include/SFML/System/Vector3.inl rename to lib/SFML/include/SFML/System/Vector3.inl diff --git a/SFML/include/SFML/Window.hpp b/lib/SFML/include/SFML/Window.hpp similarity index 100% rename from SFML/include/SFML/Window.hpp rename to lib/SFML/include/SFML/Window.hpp diff --git a/SFML/include/SFML/Window/Clipboard.hpp b/lib/SFML/include/SFML/Window/Clipboard.hpp similarity index 100% rename from SFML/include/SFML/Window/Clipboard.hpp rename to lib/SFML/include/SFML/Window/Clipboard.hpp diff --git a/SFML/include/SFML/Window/Context.hpp b/lib/SFML/include/SFML/Window/Context.hpp similarity index 100% rename from SFML/include/SFML/Window/Context.hpp rename to lib/SFML/include/SFML/Window/Context.hpp diff --git a/SFML/include/SFML/Window/ContextSettings.hpp b/lib/SFML/include/SFML/Window/ContextSettings.hpp similarity index 100% rename from SFML/include/SFML/Window/ContextSettings.hpp rename to lib/SFML/include/SFML/Window/ContextSettings.hpp diff --git a/SFML/include/SFML/Window/Cursor.hpp b/lib/SFML/include/SFML/Window/Cursor.hpp similarity index 100% rename from SFML/include/SFML/Window/Cursor.hpp rename to lib/SFML/include/SFML/Window/Cursor.hpp diff --git a/SFML/include/SFML/Window/Event.hpp b/lib/SFML/include/SFML/Window/Event.hpp similarity index 100% rename from SFML/include/SFML/Window/Event.hpp rename to lib/SFML/include/SFML/Window/Event.hpp diff --git a/SFML/include/SFML/Window/Export.hpp b/lib/SFML/include/SFML/Window/Export.hpp similarity index 100% rename from SFML/include/SFML/Window/Export.hpp rename to lib/SFML/include/SFML/Window/Export.hpp diff --git a/SFML/include/SFML/Window/GlResource.hpp b/lib/SFML/include/SFML/Window/GlResource.hpp similarity index 100% rename from SFML/include/SFML/Window/GlResource.hpp rename to lib/SFML/include/SFML/Window/GlResource.hpp diff --git a/SFML/include/SFML/Window/Joystick.hpp b/lib/SFML/include/SFML/Window/Joystick.hpp similarity index 100% rename from SFML/include/SFML/Window/Joystick.hpp rename to lib/SFML/include/SFML/Window/Joystick.hpp diff --git a/SFML/include/SFML/Window/Keyboard.hpp b/lib/SFML/include/SFML/Window/Keyboard.hpp similarity index 100% rename from SFML/include/SFML/Window/Keyboard.hpp rename to lib/SFML/include/SFML/Window/Keyboard.hpp diff --git a/SFML/include/SFML/Window/Mouse.hpp b/lib/SFML/include/SFML/Window/Mouse.hpp similarity index 100% rename from SFML/include/SFML/Window/Mouse.hpp rename to lib/SFML/include/SFML/Window/Mouse.hpp diff --git a/SFML/include/SFML/Window/Sensor.hpp b/lib/SFML/include/SFML/Window/Sensor.hpp similarity index 100% rename from SFML/include/SFML/Window/Sensor.hpp rename to lib/SFML/include/SFML/Window/Sensor.hpp diff --git a/SFML/include/SFML/Window/Touch.hpp b/lib/SFML/include/SFML/Window/Touch.hpp similarity index 100% rename from SFML/include/SFML/Window/Touch.hpp rename to lib/SFML/include/SFML/Window/Touch.hpp diff --git a/SFML/include/SFML/Window/VideoMode.hpp b/lib/SFML/include/SFML/Window/VideoMode.hpp similarity index 100% rename from SFML/include/SFML/Window/VideoMode.hpp rename to lib/SFML/include/SFML/Window/VideoMode.hpp diff --git a/SFML/include/SFML/Window/Vulkan.hpp b/lib/SFML/include/SFML/Window/Vulkan.hpp similarity index 100% rename from SFML/include/SFML/Window/Vulkan.hpp rename to lib/SFML/include/SFML/Window/Vulkan.hpp diff --git a/SFML/include/SFML/Window/Window.hpp b/lib/SFML/include/SFML/Window/Window.hpp similarity index 100% rename from SFML/include/SFML/Window/Window.hpp rename to lib/SFML/include/SFML/Window/Window.hpp diff --git a/SFML/include/SFML/Window/WindowBase.hpp b/lib/SFML/include/SFML/Window/WindowBase.hpp similarity index 100% rename from SFML/include/SFML/Window/WindowBase.hpp rename to lib/SFML/include/SFML/Window/WindowBase.hpp diff --git a/SFML/include/SFML/Window/WindowHandle.hpp b/lib/SFML/include/SFML/Window/WindowHandle.hpp similarity index 100% rename from SFML/include/SFML/Window/WindowHandle.hpp rename to lib/SFML/include/SFML/Window/WindowHandle.hpp diff --git a/SFML/include/SFML/Window/WindowStyle.hpp b/lib/SFML/include/SFML/Window/WindowStyle.hpp similarity index 100% rename from SFML/include/SFML/Window/WindowStyle.hpp rename to lib/SFML/include/SFML/Window/WindowStyle.hpp diff --git a/SFML/lib/cmake/SFML/SFMLConfig.cmake b/lib/SFML/lib/cmake/SFML/SFMLConfig.cmake similarity index 98% rename from SFML/lib/cmake/SFML/SFMLConfig.cmake rename to lib/SFML/lib/cmake/SFML/SFMLConfig.cmake index e9e218f..f2491d7 100644 --- a/SFML/lib/cmake/SFML/SFMLConfig.cmake +++ b/lib/SFML/lib/cmake/SFML/SFMLConfig.cmake @@ -64,7 +64,7 @@ if (NOT SFML_FIND_COMPONENTS) endif() set(FIND_SFML_PATHS - "${CMAKE_CURRENT_LIST_DIR}/../.." + "../.." ${SFML_ROOT} $ENV{SFML_ROOT} ~/Library/Frameworks @@ -114,7 +114,7 @@ if (EXISTS "${targets_config_file}") # Set SFML_FOUND to TRUE by default, may be overwritten by one of the includes below set(SFML_FOUND TRUE) include("${targets_config_file}") - include("${CMAKE_CURRENT_LIST_DIR}/SFMLConfigDependencies.cmake") + include("SFMLConfigDependencies.cmake") if (SFML_FOUND) foreach (component ${SFML_FIND_COMPONENTS}) diff --git a/SFML/lib/cmake/SFML/SFMLConfigDependencies.cmake b/lib/SFML/lib/cmake/SFML/SFMLConfigDependencies.cmake similarity index 100% rename from SFML/lib/cmake/SFML/SFMLConfigDependencies.cmake rename to lib/SFML/lib/cmake/SFML/SFMLConfigDependencies.cmake diff --git a/SFML/lib/cmake/SFML/SFMLConfigVersion.cmake b/lib/SFML/lib/cmake/SFML/SFMLConfigVersion.cmake similarity index 100% rename from SFML/lib/cmake/SFML/SFMLConfigVersion.cmake rename to lib/SFML/lib/cmake/SFML/SFMLConfigVersion.cmake diff --git a/SFML/lib/cmake/SFML/SFMLSharedTargets-debug.cmake b/lib/SFML/lib/cmake/SFML/SFMLSharedTargets-debug.cmake similarity index 100% rename from SFML/lib/cmake/SFML/SFMLSharedTargets-debug.cmake rename to lib/SFML/lib/cmake/SFML/SFMLSharedTargets-debug.cmake diff --git a/SFML/lib/cmake/SFML/SFMLSharedTargets-release.cmake b/lib/SFML/lib/cmake/SFML/SFMLSharedTargets-release.cmake similarity index 100% rename from SFML/lib/cmake/SFML/SFMLSharedTargets-release.cmake rename to lib/SFML/lib/cmake/SFML/SFMLSharedTargets-release.cmake diff --git a/SFML/lib/cmake/SFML/SFMLSharedTargets.cmake b/lib/SFML/lib/cmake/SFML/SFMLSharedTargets.cmake similarity index 98% rename from SFML/lib/cmake/SFML/SFMLSharedTargets.cmake rename to lib/SFML/lib/cmake/SFML/SFMLSharedTargets.cmake index 60df8ec..a42f5a8 100644 --- a/SFML/lib/cmake/SFML/SFMLSharedTargets.cmake +++ b/lib/SFML/lib/cmake/SFML/SFMLSharedTargets.cmake @@ -47,11 +47,11 @@ unset(_cmake_expected_targets) # Compute the installation prefix relative to this file. -get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "SFMLSharedTargets.cmake" PATH) get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -if(_IMPORT_PREFIX STREQUAL "/") +if(_IMPORT_PREFIX STREQUAL ".") set(_IMPORT_PREFIX "") endif() diff --git a/SFML/lib/cmake/SFML/SFMLStaticTargets-debug.cmake b/lib/SFML/lib/cmake/SFML/SFMLStaticTargets-debug.cmake similarity index 100% rename from SFML/lib/cmake/SFML/SFMLStaticTargets-debug.cmake rename to lib/SFML/lib/cmake/SFML/SFMLStaticTargets-debug.cmake diff --git a/SFML/lib/cmake/SFML/SFMLStaticTargets-release.cmake b/lib/SFML/lib/cmake/SFML/SFMLStaticTargets-release.cmake similarity index 100% rename from SFML/lib/cmake/SFML/SFMLStaticTargets-release.cmake rename to lib/SFML/lib/cmake/SFML/SFMLStaticTargets-release.cmake diff --git a/SFML/lib/cmake/SFML/SFMLStaticTargets.cmake b/lib/SFML/lib/cmake/SFML/SFMLStaticTargets.cmake similarity index 98% rename from SFML/lib/cmake/SFML/SFMLStaticTargets.cmake rename to lib/SFML/lib/cmake/SFML/SFMLStaticTargets.cmake index 81b37d7..6982e40 100644 --- a/SFML/lib/cmake/SFML/SFMLStaticTargets.cmake +++ b/lib/SFML/lib/cmake/SFML/SFMLStaticTargets.cmake @@ -47,11 +47,11 @@ unset(_cmake_expected_targets) # Compute the installation prefix relative to this file. -get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "SFMLStaticTargets.cmake" PATH) get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -if(_IMPORT_PREFIX STREQUAL "/") +if(_IMPORT_PREFIX STREQUAL ".") set(_IMPORT_PREFIX "") endif() diff --git a/SFML/lib/libFLAC.a b/lib/SFML/lib/libFLAC.a similarity index 100% rename from SFML/lib/libFLAC.a rename to lib/SFML/lib/libFLAC.a diff --git a/SFML/lib/libfreetype.a b/lib/SFML/lib/libfreetype.a similarity index 100% rename from SFML/lib/libfreetype.a rename to lib/SFML/lib/libfreetype.a diff --git a/SFML/lib/libogg.a b/lib/SFML/lib/libogg.a similarity index 100% rename from SFML/lib/libogg.a rename to lib/SFML/lib/libogg.a diff --git a/SFML/lib/libopenal32.a b/lib/SFML/lib/libopenal32.a similarity index 100% rename from SFML/lib/libopenal32.a rename to lib/SFML/lib/libopenal32.a diff --git a/SFML/lib/libsfml-audio-d.a b/lib/SFML/lib/libsfml-audio-d.a similarity index 100% rename from SFML/lib/libsfml-audio-d.a rename to lib/SFML/lib/libsfml-audio-d.a diff --git a/SFML/lib/libsfml-audio-s-d.a b/lib/SFML/lib/libsfml-audio-s-d.a similarity index 100% rename from SFML/lib/libsfml-audio-s-d.a rename to lib/SFML/lib/libsfml-audio-s-d.a diff --git a/SFML/lib/libsfml-audio-s.a b/lib/SFML/lib/libsfml-audio-s.a similarity index 100% rename from SFML/lib/libsfml-audio-s.a rename to lib/SFML/lib/libsfml-audio-s.a diff --git a/SFML/lib/libsfml-audio.a b/lib/SFML/lib/libsfml-audio.a similarity index 100% rename from SFML/lib/libsfml-audio.a rename to lib/SFML/lib/libsfml-audio.a diff --git a/SFML/lib/libsfml-graphics-d.a b/lib/SFML/lib/libsfml-graphics-d.a similarity index 100% rename from SFML/lib/libsfml-graphics-d.a rename to lib/SFML/lib/libsfml-graphics-d.a diff --git a/SFML/lib/libsfml-graphics-s-d.a b/lib/SFML/lib/libsfml-graphics-s-d.a similarity index 100% rename from SFML/lib/libsfml-graphics-s-d.a rename to lib/SFML/lib/libsfml-graphics-s-d.a diff --git a/SFML/lib/libsfml-graphics-s.a b/lib/SFML/lib/libsfml-graphics-s.a similarity index 100% rename from SFML/lib/libsfml-graphics-s.a rename to lib/SFML/lib/libsfml-graphics-s.a diff --git a/SFML/lib/libsfml-graphics.a b/lib/SFML/lib/libsfml-graphics.a similarity index 100% rename from SFML/lib/libsfml-graphics.a rename to lib/SFML/lib/libsfml-graphics.a diff --git a/SFML/lib/libsfml-main-d.a b/lib/SFML/lib/libsfml-main-d.a similarity index 100% rename from SFML/lib/libsfml-main-d.a rename to lib/SFML/lib/libsfml-main-d.a diff --git a/SFML/lib/libsfml-main.a b/lib/SFML/lib/libsfml-main.a similarity index 100% rename from SFML/lib/libsfml-main.a rename to lib/SFML/lib/libsfml-main.a diff --git a/SFML/lib/libsfml-network-d.a b/lib/SFML/lib/libsfml-network-d.a similarity index 100% rename from SFML/lib/libsfml-network-d.a rename to lib/SFML/lib/libsfml-network-d.a diff --git a/SFML/lib/libsfml-network-s-d.a b/lib/SFML/lib/libsfml-network-s-d.a similarity index 100% rename from SFML/lib/libsfml-network-s-d.a rename to lib/SFML/lib/libsfml-network-s-d.a diff --git a/SFML/lib/libsfml-network-s.a b/lib/SFML/lib/libsfml-network-s.a similarity index 100% rename from SFML/lib/libsfml-network-s.a rename to lib/SFML/lib/libsfml-network-s.a diff --git a/SFML/lib/libsfml-network.a b/lib/SFML/lib/libsfml-network.a similarity index 100% rename from SFML/lib/libsfml-network.a rename to lib/SFML/lib/libsfml-network.a diff --git a/SFML/lib/libsfml-system-d.a b/lib/SFML/lib/libsfml-system-d.a similarity index 100% rename from SFML/lib/libsfml-system-d.a rename to lib/SFML/lib/libsfml-system-d.a diff --git a/SFML/lib/libsfml-system-s-d.a b/lib/SFML/lib/libsfml-system-s-d.a similarity index 100% rename from SFML/lib/libsfml-system-s-d.a rename to lib/SFML/lib/libsfml-system-s-d.a diff --git a/SFML/lib/libsfml-system-s.a b/lib/SFML/lib/libsfml-system-s.a similarity index 100% rename from SFML/lib/libsfml-system-s.a rename to lib/SFML/lib/libsfml-system-s.a diff --git a/SFML/lib/libsfml-system.a b/lib/SFML/lib/libsfml-system.a similarity index 100% rename from SFML/lib/libsfml-system.a rename to lib/SFML/lib/libsfml-system.a diff --git a/SFML/lib/libsfml-window-d.a b/lib/SFML/lib/libsfml-window-d.a similarity index 100% rename from SFML/lib/libsfml-window-d.a rename to lib/SFML/lib/libsfml-window-d.a diff --git a/SFML/lib/libsfml-window-s-d.a b/lib/SFML/lib/libsfml-window-s-d.a similarity index 100% rename from SFML/lib/libsfml-window-s-d.a rename to lib/SFML/lib/libsfml-window-s-d.a diff --git a/SFML/lib/libsfml-window-s.a b/lib/SFML/lib/libsfml-window-s.a similarity index 100% rename from SFML/lib/libsfml-window-s.a rename to lib/SFML/lib/libsfml-window-s.a diff --git a/SFML/lib/libsfml-window.a b/lib/SFML/lib/libsfml-window.a similarity index 100% rename from SFML/lib/libsfml-window.a rename to lib/SFML/lib/libsfml-window.a diff --git a/SFML/lib/libvorbis.a b/lib/SFML/lib/libvorbis.a similarity index 100% rename from SFML/lib/libvorbis.a rename to lib/SFML/lib/libvorbis.a diff --git a/SFML/lib/libvorbisenc.a b/lib/SFML/lib/libvorbisenc.a similarity index 100% rename from SFML/lib/libvorbisenc.a rename to lib/SFML/lib/libvorbisenc.a diff --git a/SFML/lib/libvorbisfile.a b/lib/SFML/lib/libvorbisfile.a similarity index 100% rename from SFML/lib/libvorbisfile.a rename to lib/SFML/lib/libvorbisfile.a diff --git a/main.cpp b/main.cpp index dcf6de0..a794292 100644 --- a/main.cpp +++ b/main.cpp @@ -1,11 +1,6 @@ #include - #include "SFML/Graphics.hpp" -#include "headers/Player.h" -#include "headers/Bullet.h" -#include "headers/Background.h" -#include "headers/AudioManager.h" -#include "headers/Meteor.h" + #include "headers/Plansza.h" int main() @@ -14,37 +9,16 @@ int main() sf::RenderWindow mainWindow(sf::VideoMode(600, 800), "LotoStatek"); mainWindow.setVerticalSyncEnabled(true); mainWindow.setFramerateLimit(60); + sf::Image icon; - icon.loadFromFile("../assets/img/ikonka.png"); + icon.loadFromFile("../assets/img/icon/ikonka.png"); mainWindow.setIcon(128, 128, icon.getPixelsPtr()); - Plansza plansza(mainWindow.getSize().y, mainWindow.getSize().x); - Background background("../assets/img/space.png", 2.0f); //tutaj predkosc tla, mozna zwiekszyc jak za wolno - - - AudioManager audioManager; - if (!audioManager.loadBackgroundMusic("../assets/music/background.ogg")) { - return -1; - } - audioManager.playBackgroundMusic(); - - audioManager.loadSoundEffect("shoot", "../assets/sounds/shoot.ogg"); - audioManager.loadSoundEffect("shoot_alt", "../assets/sounds/shoot_alt.ogg"); - audioManager.loadSoundEffect("fail", "../assets/sounds/fail.mp3"); - audioManager.loadSoundEffect("explosion", "../assets/sounds/explosion.mp3"); - - // TODO: Przenieść tworzenie statku wewnątrz klasy Plansza - Player ship(mainWindow.getSize().x / 2, mainWindow.getSize().y - 100, "../assets/ship/Dreadnought-Base.png"); // tworzenie statku - ship.setMovingSpeed(8); - ship.setFirerate(200); + Plansza plansza(mainWindow.getSize().y, mainWindow.getSize().x, &mainWindow); while (mainWindow.isOpen()) { mainWindow.clear(); - // tło - background.update(); - background.draw(mainWindow); - // Tu są handlowane eventy sf::Event event{}; while (mainWindow.pollEvent(event)) { @@ -52,113 +26,7 @@ int main() mainWindow.close(); } - // poruszanie się statkiem - if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)) { - if(ship.getPosition().x > 50) { - ship.moveLeft(); - } - } - if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)) { - if(ship.getPosition().y > 80) { - ship.moveUp(); - } - } - if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) { - if(ship.getPosition().y < 720) { - ship.moveDown(); - } - } - if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) { - if(ship.getPosition().x < 550) { - ship.moveRight(); - } - } - - // TODO: Przerobić tak aby strzelanie odbywało się bez użycia warunku zewnętrzenego - // Ale w tym przypadku trzeba będzie przenieść obiekt dźwięku wewnątrz klasy Bullet - // strzelanie ze statku - if(event.type == sf::Event::MouseButtonPressed) { - if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { - ship.shoot(); - audioManager.playSoundEffect("shoot", 70.f); // Odtworzenie dźwięku wystrzału - } - if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) { - ship.alternate_shoot(); - audioManager.playSoundEffect("shoot_alt", 70.f); // Odtworzenie dźwięku dla alternatywnego strzału - } - } - - // generowanie nowego meteoru - plansza.spawn_meteor(); - - - // utrzymanie meteorów i pocisków w ruchu - for (auto& meteor : plansza.getMeteors()) { - meteor.update(); - mainWindow.draw(meteor.getSprite()); - } - - for (auto& bullet : ship.getBullets()) { - bullet.update(); - mainWindow.draw(bullet.getSprite()); - } - - // Sprawdzenie czy meteory i pociski są poza granicami ekranu - plansza.update_meteors(); - ship.updateBullets(); - - mainWindow.draw(ship.getSprite()); - - // trochę dziwny sposób ale jednak działa - for (auto& meteor : plansza.getMeteors()) { - if(ship.getSprite().getGlobalBounds().intersects(meteor.getSprite().getGlobalBounds())) { - std::cout << "You lost the game!\n"; - sf::RenderWindow errorWindow(sf::VideoMode(350, 200), "The end"); - sf::Font font; - if (!font.loadFromFile("../assets/fonts/arial.ttf")) { - std::cerr << "Error loading font\n"; - return -1; - } - sf::Text text("Your ship is destroyed!", font, 24); - text.setFillColor(sf::Color::Red); - text.setPosition(50, 80); - - // zatrzymanie muzyki i odtworzenie dźwięku przegranej - audioManager.playSoundEffect("fail", 70.f); - audioManager.stopBackgroundMusic(); - while (errorWindow.isOpen()) { - sf::Event event; - while (errorWindow.pollEvent(event)) { - if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { - errorWindow.close(); - mainWindow.close(); - exit(-2); - } - } - errorWindow.clear(); - errorWindow.draw(text); - errorWindow.display(); - } - } - } - - for (auto meteorIt = plansza.getMeteors().begin(); meteorIt != plansza.getMeteors().end(); ) { - bool meteorHit = false; - for (auto bulletIt = ship.getBullets().begin(); bulletIt != ship.getBullets().end(); ) { - if (meteorIt->getSprite().getGlobalBounds().intersects(bulletIt->getSprite().getGlobalBounds())) { - audioManager.playSoundEffect("explosion"); - bulletIt = ship.getBullets().erase(bulletIt); - meteorIt = plansza.getMeteors().erase(meteorIt); - meteorHit = true; - break; - } else { - ++bulletIt; - } - } - if (!meteorHit) { - ++meteorIt; - } - } + plansza.update(); mainWindow.display(); } diff --git a/sources/Actor.cpp b/sources/Actor.cpp index ae74aff..2170a24 100644 --- a/sources/Actor.cpp +++ b/sources/Actor.cpp @@ -12,8 +12,8 @@ void Actor::loadTexture(std::string path) { actorTexture.loadFromFile(path); actorSprite.setTexture(actorTexture); - bulletTextureLeft.loadFromFile("../assets/img/bullet_left.png"); - bulletTextureRight.loadFromFile("../assets/img/Rocket_111.png"); + bulletTextureLeft.loadFromFile("../assets/img/bullets/bullet_pink.png"); + bulletTextureRight.loadFromFile("../assets/img/rockets/Rocket_111.png"); } sf::Sprite &Actor::getSprite() { @@ -24,17 +24,13 @@ Position Actor::getPosition() { return {position.x, position.y}; } -void Actor::shoot() { - bullets.emplace_back(float(position.x) + actorSprite.getGlobalBounds().width / 2, position.y, bulletTextureLeft); -} - std::vector &Actor::getBullets() { return bullets; } void Actor::updateBullets() { for (auto& bullet : bullets) { - if(bullet.getStatus()) { + if(bullet.isOutOfBounds()) { bullets.erase(bullets.begin()); } } diff --git a/sources/Bullet.cpp b/sources/Bullet.cpp index dc9f8a6..17ff7a2 100644 --- a/sources/Bullet.cpp +++ b/sources/Bullet.cpp @@ -1,33 +1,9 @@ -#include #include "../headers/Bullet.h" -Bullet::Bullet(float x, float y, sf::Texture &texture) { - bulletPosition.x = x; - bulletPosition.y = y; - outOfBounds = false; - bulletTexture = texture; - bulletSprite.setTexture(texture); - bulletSprite.setOrigin(bulletSprite.getLocalBounds().width/2, bulletSprite.getLocalBounds().height/2); - bulletSprite.setPosition(x, y); - bulletSpeed = -10.0f; -} - -void Bullet::setSpeed(float speed) { - bulletSpeed = speed; -} - -sf::Sprite &Bullet::getSprite() { - return bulletSprite; -} - void Bullet::update() { - bulletSprite.move(0.0f, bulletSpeed); - bulletPosition.y += int(bulletSpeed); - if(bulletPosition.y < -100) { + sprite.move(0.0f, speed); + position.y += int(speed); + if(position.y < -100) { outOfBounds = true; } -} - -bool Bullet::getStatus() const { - return outOfBounds; -} +} \ No newline at end of file diff --git a/sources/Plansza.cpp b/sources/Plansza.cpp index 3aeda76..90acec2 100644 --- a/sources/Plansza.cpp +++ b/sources/Plansza.cpp @@ -2,14 +2,164 @@ #include #include "../headers/Plansza.h" -Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth) { - size.height = windowHeight; - size.width = windowWidth; - meteorTexture1.loadFromFile("../assets/img/meteor-1.png"); - meteorTexture2.loadFromFile("../assets/img/meteor-2.png"); +Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::RenderWindow *mainWindow) +: background("../assets/img/background/background.png", 2.0f), +ship(static_cast(mainWindow->getSize().x) / 2, static_cast(mainWindow->getSize().y) - 100, "../assets/ship/Dreadnought-Base.png") +{ + + window = mainWindow; + size.height = static_cast(windowHeight); + size.width = static_cast(windowWidth); + + ship.setMovingSpeed(8); + ship.setFirerate(200); + + audioManager.loadBackgroundMusic("../assets/music/background.ogg"); + audioManager.playBackgroundMusic(); + + audioManager.loadSoundEffect("shoot", "../assets/sounds/shoot.ogg"); + audioManager.loadSoundEffect("shoot_alt", "../assets/sounds/shoot_alt.ogg"); + audioManager.loadSoundEffect("fail", "../assets/sounds/fail.mp3"); + + meteorTexture1.loadFromFile("../assets/img/meteors/meteor-1.png"); + meteorTexture2.loadFromFile("../assets/img/meteors/meteor-2.png"); spawnClock.restart(); } + +void Plansza::update() { +// tło + background.update(); + background.draw(*window); + + // poruszanie się statkiem + if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)) { + if(ship.getPosition().x > 50) { + ship.moveLeft(); + } + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)) { + if(ship.getPosition().y > 80) { + ship.moveUp(); + } + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) { + if(ship.getPosition().y < 720) { + ship.moveDown(); + } + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) { + if(ship.getPosition().x < 550) { + ship.moveRight(); + } + } + + // TODO: Przenieść obiekt dźwięku wewnątrz klasy Bullet + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + ship.shoot(); + audioManager.playSoundEffect("shoot", 70.f); // Odtworzenie dźwięku wystrzału + } + if (sf::Mouse::isButtonPressed(sf::Mouse::Right)) { + ship.alternate_shoot(); + audioManager.playSoundEffect("shoot_alt", 70.f); // Odtworzenie dźwięku dla alternatywnego strzału + } + + // generowanie nowego meteoru + spawn_meteor(); + + + // utrzymanie meteorów i pocisków w ruchu + for (auto& meteor : getMeteors()) { + meteor.update(); + window->draw(meteor.getSprite()); + } + + for (auto& bullet : ship.getBullets()) { + bullet.update(); + window->draw(bullet.getSprite()); + } + + for (auto& rocket : ship.getRockets()) { + rocket.update(); + window->draw(rocket.getSprite()); + } + + // Sprawdzenie czy meteory i pociski są poza granicami ekranu + update_meteors(); + ship.updateBullets(); + + window->draw(ship.getSprite()); + + // trochę dziwny sposób ale jednak działa + for (auto& meteor : getMeteors()) { + if(ship.getSprite().getGlobalBounds().intersects(meteor.getSprite().getGlobalBounds())) { + std::cout << "You lost the game!\n"; + sf::RenderWindow errorWindow(sf::VideoMode(350, 200), "The end"); + sf::Font font; + if (!font.loadFromFile("../assets/fonts/arial.ttf")) { + std::cerr << "Error loading font\n"; + exit(-500); + } + sf::Text text("Your ship is destroyed!", font, 24); + text.setFillColor(sf::Color::Red); + text.setPosition(50, 80); + + // zatrzymanie muzyki i odtworzenie dźwięku przegranej + audioManager.playSoundEffect("fail", 70.f); + audioManager.stopBackgroundMusic(); + sf::Event event{}; + while (errorWindow.isOpen()) { + while (errorWindow.pollEvent(event)) { + if (event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { + errorWindow.close(); + window->close(); + exit(-2); + } + } + errorWindow.clear(); + errorWindow.draw(text); + errorWindow.display(); + } + } + } + + for (auto meteorIt = getMeteors().begin(); meteorIt != getMeteors().end(); ) { + bool meteorHit = false; + for (auto rocketIt = ship.getBullets().begin(); rocketIt != ship.getBullets().end(); ) { + if (meteorIt->getSprite().getGlobalBounds().intersects(rocketIt->getSprite().getGlobalBounds())) { + ship.getBullets().erase(rocketIt); + meteorIt = getMeteors().erase(meteorIt); + meteorHit = true; + break; + } else { + ++rocketIt; + } + } + if (!meteorHit) { + ++meteorIt; + } + } + + for (auto meteorIt = getMeteors().begin(); meteorIt != getMeteors().end(); ) { + bool meteorHit = false; + for (auto rocketIt = ship.getRockets().begin(); rocketIt != ship.getRockets().end(); ) { + if (meteorIt->getSprite().getGlobalBounds().intersects(rocketIt->getSprite().getGlobalBounds())) { + ship.getRockets().erase(rocketIt); + meteorIt = getMeteors().erase(meteorIt); + meteorHit = true; + break; + } else { + ++rocketIt; + } + } + if (!meteorHit) { + ++meteorIt; + } + } +} + +// Meteor-related niżej + void Plansza::spawn_meteor() { if (spawnClock.getElapsedTime().asSeconds() > rand() % 10 + 1) { // randomowy spawn meteorytów od 10 do 1 sekundy if (meteors.size() < 5) { // jeśli jest mniej niż 5 meteorów na planszy @@ -23,14 +173,6 @@ void Plansza::spawn_meteor() { } } -Plansza::Size Plansza::getSize() { - return size; -} - -std::vector &Plansza::getMeteors() { - return meteors; -} - void Plansza::update_meteors() { // usuwanie meteorów które wyleciały poza ekran for (auto& meteor : meteors) { @@ -39,3 +181,14 @@ void Plansza::update_meteors() { } } } + +Size Plansza::getSize() { + return size; +} + +std::vector &Plansza::getMeteors() { + return meteors; +} + + + diff --git a/sources/Player.cpp b/sources/Player.cpp index 058fb29..91117cf 100644 --- a/sources/Player.cpp +++ b/sources/Player.cpp @@ -1,20 +1,23 @@ #include "../headers/Player.h" +#include "../headers/Bullet.h" -Player::Player(int x, int y, std::string path) : Actor(x, y, path) {}; +Player::Player(int x, int y, std::string path) : Actor(x, y, path) { + bulletTexture.loadFromFile("../assets/img/bullets/bullet_pink.png"); + rocketTexture.loadFromFile("../assets/img/rockets/Rocket_111.png"); +}; void Player::shoot() { auto now = std::chrono::steady_clock::now(); if (std::chrono::duration_cast(now - lastShotTime).count() >= firerate) { - bullets.emplace_back(position.x, position.y, bulletTextureLeft); + bullets.emplace_back(position.x, position.y, bulletTexture); lastShotTime = now; } } -// TODO: Czy strzał prawym musi mieć osobną tablicę z pociskami? void Player::alternate_shoot() { auto now = std::chrono::steady_clock::now(); if (std::chrono::duration_cast(now - lastShotTime).count() >= firerate) { - bullets.emplace_back(position.x, position.y, bulletTextureRight).getSprite().scale(1.5f, 1.5f); + rockets.emplace_back(position.x, position.y, rocketTexture).getSprite().scale(1.5f, 1.5f); lastShotTime = now; } } @@ -45,4 +48,8 @@ void Player::moveUp() { void Player::moveDown() { move(0.0f, moving_speed); position.y += static_cast(moving_speed); -} \ No newline at end of file +} + +std::vector &Player::getRockets() { + return rockets; +} diff --git a/sources/Projectile.cpp b/sources/Projectile.cpp new file mode 100644 index 0000000..ba26080 --- /dev/null +++ b/sources/Projectile.cpp @@ -0,0 +1,23 @@ +#include "../headers/Projectile.h" + +Projectile::Projectile(float x, float y, sf::Texture &texture) { + position.x = x; + position.y = y; + outOfBounds = false; + sprite.setTexture(texture); + sprite.setOrigin(sprite.getLocalBounds().width/2, sprite.getLocalBounds().height/2); + sprite.setPosition(x, y); + speed = -10.0f; +} + +sf::Sprite &Projectile::getSprite() { + return sprite; +} + +void Projectile::setSpeed(float speed) { + this->speed = speed; +} + +bool Projectile::isOutOfBounds() const { + return outOfBounds; +} diff --git a/sources/Rocket.cpp b/sources/Rocket.cpp new file mode 100644 index 0000000..a5ae223 --- /dev/null +++ b/sources/Rocket.cpp @@ -0,0 +1,9 @@ +#include "../headers/Rocket.h" + +void Rocket::update() { + sprite.move(0.0f, speed); + position.y += int(speed); + if(position.y < -100) { + outOfBounds = true; + } +} \ No newline at end of file