diff --git a/sem2/KochetovDI/GameDino/GameDino.sln b/sem2/KochetovDI/GameDino/GameDino.sln new file mode 100644 index 00000000..5d0587dd --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameDino", "GameDino\GameDino.vcxproj", "{1CED1EC8-5130-4370-B1AB-2F0B099156E2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Элементы решения", "Элементы решения", "{E7DEA7D1-0936-42AB-A96F-9B231B4FCD36}" + ProjectSection(SolutionItems) = preProject + TextFile1.txt = TextFile1.txt + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Debug|x64.ActiveCfg = Debug|x64 + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Debug|x64.Build.0 = Debug|x64 + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Debug|x86.ActiveCfg = Debug|Win32 + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Debug|x86.Build.0 = Debug|Win32 + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Release|x64.ActiveCfg = Release|x64 + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Release|x64.Build.0 = Release|x64 + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Release|x86.ActiveCfg = Release|Win32 + {1CED1EC8-5130-4370-B1AB-2F0B099156E2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6207DF43-6DF3-4DBC-9A30-1778CFCDBC6A} + EndGlobalSection +EndGlobal diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.log b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.log new file mode 100644 index 00000000..a2815c0d --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.log @@ -0,0 +1,49 @@ + GameDino.cpp +C:\Study\C++\2_semestr\CPP_Projects\GameDino\GameDino\GameDino.cpp(38,35): warning C4244: =: преобразование "double" в "int", возможна потеря данных +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::String::String(class std::basic_string,class std::allocator > const &,class std::locale const &)" (__imp_??0String@sf@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVlocale@3@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static bool __cdecl sf::Keyboard::isKeyPressed(enum sf::Keyboard::Key)" (__imp_?isKeyPressed@Keyboard@sf@@SA_NW4Key@12@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static bool __cdecl sf::Mouse::isButtonPressed(enum sf::Mouse::Button)" (__imp_?isButtonPressed@Mouse@sf@@SA_NW4Button@12@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static class sf::Vector2 __cdecl sf::Mouse::getPosition(class sf::WindowBase const &)" (__imp_?getPosition@Mouse@sf@@SA?AV?$Vector2@H@2@ABVWindowBase@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) в функции _main. +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: bool __thiscall sf::WindowBase::isOpen(void)const " (__imp_?isOpen@WindowBase@sf@@QBE_NXZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: bool __thiscall sf::WindowBase::pollEvent(class sf::Event &)" (__imp_?pollEvent@WindowBase@sf@@QAE_NAAVEvent@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Window::setFramerateLimit(unsigned int)" (__imp_?setFramerateLimit@Window@sf@@QAEXI@Z) в функции _main. +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Transformable::setPosition(float,float)" (__imp_?setPosition@Transformable@sf@@QAEXMM@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Shape::setFillColor(class sf::Color const &)" (__imp_?setFillColor@Shape@sf@@QAEXABVColor@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: class sf::Rect __thiscall sf::Shape::getGlobalBounds(void)const " (__imp_?getGlobalBounds@Shape@sf@@QBE?AV?$Rect@M@2@XZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Texture::Texture(void)" (__imp_??0Texture@sf@@QAE@XZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Texture::Texture(class sf::Texture const &)" (__imp_??0Texture@sf@@QAE@ABV01@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Texture::~Texture(void)" (__imp_??1Texture@sf@@QAE@XZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: bool __thiscall sf::Texture::loadFromFile(class std::basic_string,class std::allocator > const &,class sf::Rect const &)" (__imp_?loadFromFile@Texture@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$Rect@H@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Font::Font(void)" (__imp_??0Font@sf@@QAE@XZ) в функции "void __cdecl menu(class sf::Event &,class sf::RenderWindow &,int &,int &,int &,int &,int &)" (?menu@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAH2222@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Font::~Font(void)" (__imp_??1Font@sf@@QAE@XZ) в функции "void __cdecl menu(class sf::Event &,class sf::RenderWindow &,int &,int &,int &,int &,int &)" (?menu@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAH2222@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: bool __thiscall sf::Font::loadFromFile(class std::basic_string,class std::allocator > const &)" (__imp_?loadFromFile@Font@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) в функции "void __cdecl menu(class sf::Event &,class sf::RenderWindow &,int &,int &,int &,int &,int &)" (?menu@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAH2222@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::RectangleShape::RectangleShape(class sf::Vector2 const &)" (__imp_??0RectangleShape@sf@@QAE@ABV?$Vector2@M@1@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: virtual __thiscall sf::RectangleShape::~RectangleShape(void)" (__imp_??1RectangleShape@sf@@UAE@XZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (__imp_?clear@RenderTarget@sf@@QAEXABVColor@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: class sf::Vector2 __thiscall sf::RenderTarget::mapPixelToCoords(class sf::Vector2 const &)const " (__imp_?mapPixelToCoords@RenderTarget@sf@@QBE?AV?$Vector2@M@2@ABV?$Vector2@H@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::RenderTarget::draw(class sf::Drawable const &,class sf::RenderStates const &)" (__imp_?draw@RenderTarget@sf@@QAEXABVDrawable@2@ABVRenderStates@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABVString@1@IABUContextSettings@1@@Z) в функции _main. +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) в функции _main. +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(class sf::Texture const &)" (__imp_??0Sprite@sf@@QAE@ABVTexture@1@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Sprite::setColor(class sf::Color const &)" (__imp_?setColor@Sprite@sf@@QAEXABVColor@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: class sf::Rect __thiscall sf::Sprite::getGlobalBounds(void)const " (__imp_?getGlobalBounds@Sprite@sf@@QBE?AV?$Rect@M@2@XZ) в функции "void __cdecl handleShop(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Text &,class sf::Text &,int &,int &,int &,int &)" (?handleShop@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVText@2@3AAH444@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: __thiscall sf::Text::Text(class sf::String const &,class sf::Font const &,unsigned int)" (__imp_??0Text@sf@@QAE@ABVString@1@ABVFont@1@I@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Text::setString(class sf::String const &)" (__imp_?setString@Text@sf@@QAEXABVString@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Text::setStyle(unsigned int)" (__imp_?setStyle@Text@sf@@QAEXI@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: void __thiscall sf::Text::setFillColor(class sf::Color const &)" (__imp_?setFillColor@Text@sf@@QAEXABVColor@2@@Z) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: virtual __thiscall sf::Text::~Text(void)" (__imp_??1Text@sf@@UAE@XZ) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static class sf::RenderStates const sf::RenderStates::Default" (__imp_?Default@RenderStates@sf@@2V12@B) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static class sf::Color const sf::Color::White" (__imp_?White@Color@sf@@2V12@B) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static class sf::Color const sf::Color::Red" (__imp_?Red@Color@sf@@2V12@B) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static class sf::Color const sf::Color::Green" (__imp_?Green@Color@sf@@2V12@B) в функции "void __cdecl handleFight(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Texture &,class sf::Texture &,class sf::Text &,class sf::Text &,int &,int &,int &)" (?handleFight@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVTexture@2@3AAVText@2@4AAH55@Z). +GameDino.obj : error LNK2019: ссылка на неразрешенный внешний символ "__declspec(dllimport) public: static class sf::Color const sf::Color::Blue" (__imp_?Blue@Color@sf@@2V12@B) в функции "void __cdecl handleShop(class sf::Event &,class sf::RenderWindow &,class sf::Font &,class sf::Text &,class sf::Text &,int &,int &,int &,int &)" (?handleShop@@YAXAAVEvent@sf@@AAVRenderWindow@2@AAVFont@2@AAVText@2@3AAH444@Z). +C:\Study\C++\2_semestr\CPP_Projects\GameDino\\lib\sfml-system-d.lib : warning LNK4272: тип компьютера библиотеки "x64" конфликтует с типом целевого компьютера "x86" +C:\Study\C++\2_semestr\CPP_Projects\GameDino\\lib\sfml-window-d.lib : warning LNK4272: тип компьютера библиотеки "x64" конфликтует с типом целевого компьютера "x86" +C:\Study\C++\2_semestr\CPP_Projects\GameDino\\lib\sfml-graphics-d.lib : warning LNK4272: тип компьютера библиотеки "x64" конфликтует с типом целевого компьютера "x86" +C:\Study\C++\2_semestr\CPP_Projects\GameDino\Debug\GameDino.exe : fatal error LNK1120: неразрешенных внешних элементов: 43 diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.obj b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.obj new file mode 100644 index 00000000..6e40df6e Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.obj differ diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.command.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.command.1.tlog new file mode 100644 index 00000000..39983760 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.command.1.tlog differ diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.read.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.read.1.tlog new file mode 100644 index 00000000..a6f725c2 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.read.1.tlog differ diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.write.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.write.1.tlog new file mode 100644 index 00000000..410c61fd Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/CL.write.1.tlog differ diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/GameDino.lastbuildstate b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/GameDino.lastbuildstate new file mode 100644 index 00000000..52f912c1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/GameDino.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0: +Debug|Win32|C:\Study\C++\2_semestr\CPP_Projects\GameDino\| diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-cvtres.read.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-cvtres.read.1.tlog new file mode 100644 index 00000000..46b134b1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-cvtres.read.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-cvtres.write.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-cvtres.write.1.tlog new file mode 100644 index 00000000..46b134b1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-cvtres.write.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-rc.read.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-rc.read.1.tlog new file mode 100644 index 00000000..46b134b1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-rc.read.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-rc.write.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-rc.write.1.tlog new file mode 100644 index 00000000..46b134b1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link-rc.write.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.command.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.command.1.tlog new file mode 100644 index 00000000..46b134b1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.command.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.read.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.read.1.tlog new file mode 100644 index 00000000..46b134b1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.read.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.write.1.tlog b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.write.1.tlog new file mode 100644 index 00000000..46b134b1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/link.write.1.tlog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/unsuccessfulbuild b/sem2/KochetovDI/GameDino/GameDino/Debug/GameDino.tlog/unsuccessfulbuild new file mode 100644 index 00000000..e69de29b diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/vc143.idb b/sem2/KochetovDI/GameDino/GameDino/Debug/vc143.idb new file mode 100644 index 00000000..d696c56f Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/Debug/vc143.idb differ diff --git a/sem2/KochetovDI/GameDino/GameDino/Debug/vc143.pdb b/sem2/KochetovDI/GameDino/GameDino/Debug/vc143.pdb new file mode 100644 index 00000000..9fcc280f Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/Debug/vc143.pdb differ diff --git a/sem2/KochetovDI/GameDino/GameDino/GameDino.cpp b/sem2/KochetovDI/GameDino/GameDino/GameDino.cpp new file mode 100644 index 00000000..f3a46df1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/GameDino.cpp @@ -0,0 +1,63 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include +#include "menu.h" +#include "handleFight.h" + +int main() { + int coinsEarned = 0, coinsUser = 0, cntUserTyrannosaurus = 0, cntUserStegosaurus = 0, cntUserTriceratops = 0; + + sf::RenderWindow window(sf::VideoMode(1200, 800), "Dinosaurs Battlesauce"); + window.setFramerateLimit(144); + sf::Event event; + + // Чтение количества монет из файла + std::ifstream inCoins("coins.txt"); + if (inCoins.is_open()) { + std::string line; + while (std::getline(inCoins, line)) { + coinsUser = std::stoi(line); + } + } + inCoins.close(); + + std::ifstream inDinos("userDinoInventory.txt"); + + // Чтение количества динозавров + if (inDinos.is_open()) { + // Читаем по одному числу из каждой строки + inDinos >> cntUserTyrannosaurus; + inDinos >> cntUserStegosaurus; + inDinos >> cntUserTriceratops; + } + inDinos.close(); + + //Вызов меню + menu(event, window, coinsEarned, coinsUser, cntUserTyrannosaurus, cntUserStegosaurus, cntUserTriceratops); + + std::ofstream outCoins("coins.txt"); + if (outCoins.is_open()) { + outCoins << coinsUser << std::endl; + } + outCoins.close(); + + // Открываем файл заново для записи (режим перезаписи) + std::ofstream outDinos("userDinoInventory.txt"); + if (outDinos.is_open()) { + // Записываем новые числа в файл построчно + outDinos << cntUserTyrannosaurus << std::endl; + outDinos << cntUserStegosaurus << std::endl; + outDinos << cntUserTriceratops << std::endl; + } + outDinos.close(); + + return 0; +} \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj b/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj new file mode 100644 index 00000000..683cd4ce --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj @@ -0,0 +1,153 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {1ced1ec8-5130-4370-b1ab-2f0b099156e2} + GameDino + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\lib;%(AdditionalLibraryDirectories) + sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + + + Console + true + true + true + $(SolutionDir)\lib;%(AdditionalLibraryDirectories) + sfml-system.lib;sfml-window.lib;sfml-graphics.lib + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\lib;%(AdditionalLibraryDirectories) + sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + + + Console + true + true + true + $(SolutionDir)\lib;%(AdditionalLibraryDirectories) + sfml-system.lib;sfml-window.lib;sfml-graphics.lib + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj.filters b/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj.filters new file mode 100644 index 00000000..c9c10576 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + + + Исходные файлы + + + Исходные файлы + + + Исходные файлы + + + Исходные файлы + + + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj.user b/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/GameDino.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/Riotun2.ttf b/sem2/KochetovDI/GameDino/GameDino/Riotun2.ttf new file mode 100644 index 00000000..aa0f07a2 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/Riotun2.ttf differ diff --git a/sem2/KochetovDI/GameDino/GameDino/coins.txt b/sem2/KochetovDI/GameDino/GameDino/coins.txt new file mode 100644 index 00000000..a8c5937b --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/coins.txt @@ -0,0 +1 @@ +1745 diff --git a/sem2/KochetovDI/GameDino/GameDino/handleFight.h b/sem2/KochetovDI/GameDino/GameDino/handleFight.h new file mode 100644 index 00000000..eecafa51 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/handleFight.h @@ -0,0 +1,525 @@ +#pragma once + +#include +#include +#include +#include + + +enum Dinosaurus { Tyrannosaurus = 1, Stegosaurus = 2, Triceratops = 3}; +int damageValue; + +class Dino { +protected: + int strength = std::rand() % 5 + 1; + int agility = std::rand() % 5 + 1; + int intelligence = std::rand() % 5 + 1; +public: + virtual double damage() = 0; +}; + +class DinoTyrannosaurus : public Dino { +public: + double damage() override { + damageValue = damageValue + strength * 0.5; + return damageValue; + } +}; + +class DinoStegosaurus : public Dino { +public: + double damage() override { + damageValue = damageValue + agility * 0.3; + return damageValue; + } +}; + +class DinoTriceratops : public Dino { +public: + double damage() override { + damageValue = damageValue + intelligence * 0.2; + return damageValue; + } +}; + +class Player { +public: + double damage(Dino* dino) { + return dino->damage(); // return results of method damage() + } +}; + +enum Terrain { Plane, River, Mountain }; +Terrain getRandomTerrain() { + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> distrib(0, 2); + + return static_cast(distrib(gen)); +} + +void loadingTexture(int& cntSelected, int& pickNum, sf::Texture& selectedDino1Texture, \ + sf::Texture& selectedDino2Texture, sf::Texture& selectedDino3Texture) { + if (cntSelected == 0) { + if (pickNum == 1) { + selectedDino1Texture.loadFromFile("images/TyrannosaurusFightUser.png"); + } + else if (pickNum == 2) { + selectedDino1Texture.loadFromFile("images/StegosaurusFightUser.png"); + } + else if (pickNum == 3) { + selectedDino1Texture.loadFromFile("images/TriceratopsFightUser.png"); + } + } + if (cntSelected == 1) { + if (pickNum == 1) { + selectedDino2Texture.loadFromFile("images/TyrannosaurusFightUser.png"); + } + else if (pickNum == 2) { + selectedDino2Texture.loadFromFile("images/StegosaurusFightUser.png"); + } + else if (pickNum == 3) { + selectedDino2Texture.loadFromFile("images/TriceratopsFightUser.png"); + } + } + if (cntSelected == 2) { + if (pickNum == 1) { + selectedDino3Texture.loadFromFile("images/TyrannosaurusFightUser.png"); + } + else if (pickNum == 2) { + selectedDino3Texture.loadFromFile("images/StegosaurusFightUser.png"); + } + else if (pickNum == 3) { + selectedDino3Texture.loadFromFile("images/TriceratopsFightUser.png"); + } + } +} + +void loadingTextureBot(int& i, int pullBot[3], sf::Texture& botDino1Texture, sf::Texture& botDino2Texture, sf::Texture& botDino3Texture) { + if (pullBot[i] == 1) { + if (i == 0) { + botDino1Texture.loadFromFile("images/TyrannosaurusFightBot.png"); + } + if (i == 1) { + botDino2Texture.loadFromFile("images/TyrannosaurusFightBot.png"); + } + if (i == 2) { + botDino3Texture.loadFromFile("images/TyrannosaurusFightBot.png"); + } + } + if (pullBot[i] == 2) { + if (i == 0) { + botDino1Texture.loadFromFile("images/StegosaurusFightBot.png"); + } + if (i == 1) { + botDino2Texture.loadFromFile("images/StegosaurusFightBot.png"); + } + if (i == 2) { + botDino3Texture.loadFromFile("images/StegosaurusFightBot.png"); + } + } + if (pullBot[i] == 3) { + if (i == 0) { + botDino1Texture.loadFromFile("images/TriceratopsFightBot.png"); + } + if (i == 1) { + botDino2Texture.loadFromFile("images/TriceratopsFightBot.png"); + } + if (i == 2) { + botDino3Texture.loadFromFile("images/TriceratopsFightBot.png"); + } + } + +} + + +void actionFight(sf::Event& event, sf::RenderWindow& window, sf::Font& font, sf::Sprite& terrainSprite, \ + sf::Sprite& nameTerrainSprite, sf::Text& balance, sf::Text& earnedBalance, \ + std::string& pullUser, Terrain& randomTerrain, int& coinsUser, int& coinsEarned, \ + int& cntUserTyrannosaurus, int& cntUserStegosaurus, int& cntUserTriceratops) { + + bool mousePressed = false; + bool flagBreak = false; + int wasAttacked = 0; + int dinoUser, dinoBot, userAttack, botAttack, userDinoHealth, botDinoHealth; + std::string dinoBot1, dinoBot2, dinoBot3, pullBot; + sf::Texture dinoUserTexture, dinoBotTexture; + + sf::Text damageTaken("", font, 50);// . , , ( );// ( ) + damageTaken.setStyle(sf::Text::Bold);// + damageTaken.setFillColor(sf::Color::Black); + sf::Text damageGiven("", font, 50);// . , , ( );// ( ) + damageGiven.setStyle(sf::Text::Bold);// + damageGiven.setFillColor(sf::Color::Black); + sf::Text userDinoHealthText("", font, 20);// . , , ( );// ( ) + userDinoHealthText.setStyle(sf::Text::Bold);// + userDinoHealthText.setFillColor(sf::Color::Black); + sf::Text botDinoHealthText("", font, 20);// . , , ( );// ( ) + botDinoHealthText.setStyle(sf::Text::Bold);// + botDinoHealthText.setFillColor(sf::Color::Black); + sf::Text fightFinallyText("", font, 80);// . , , ( );// ( ) + fightFinallyText.setStyle(sf::Text::Bold);// + fightFinallyText.setFillColor(sf::Color::Black); + fightFinallyText.setPosition(470, 400); + + // + userDinoHealth = 100; + botDinoHealth = 100; + Player player; + DinoTyrannosaurus dinoTyrannosaurus; + DinoStegosaurus dinoStegosaurus; + DinoTriceratops dinoTriceratops; + + std::srand(static_cast(std::time(nullptr))); + + dinoBot1 = std::to_string(std::rand() % 3 + 1); + dinoBot2 = std::to_string(std::rand() % 3 + 1); + dinoBot3 = std::to_string(std::rand() % 3 + 1); + pullBot = dinoBot1 + dinoBot2 + dinoBot3; + + + while (window.isOpen() && !sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) { + window.close(); + } + } + if (pullUser.length() == 0) { fightFinallyText.setString("YOU LOSE"); fightFinallyText.setFillColor(sf::Color::Red); flagBreak = true; } + if (pullBot.length() == 0) { fightFinallyText.setString("YOU WON"); fightFinallyText.setFillColor(sf::Color::Green); flagBreak = true; } + + window.clear(); + dinoUser = pullUser[0] - '0'; + dinoBot = pullBot[0] - '0'; + + // + sf::RectangleShape userDinoHealthIndicator(sf::Vector2f(4 * userDinoHealth, 20)); + userDinoHealthIndicator.setFillColor(sf::Color::Green); + userDinoHealthIndicator.setPosition(100, 300); + sf::RectangleShape botDinoHealthIndicator(sf::Vector2f(4 * botDinoHealth, 20)); + botDinoHealthIndicator.setFillColor(sf::Color::Green); + botDinoHealthIndicator.setPosition(700, 300); + + // + switch (dinoUser) { + case Dinosaurus::Tyrannosaurus: + userAttack = player.damage(&dinoTyrannosaurus); + break; + case Dinosaurus::Stegosaurus: + userAttack = player.damage(&dinoStegosaurus); + break; + case Dinosaurus::Triceratops: + userAttack = player.damage(&dinoTriceratops); + break; + } + + switch (dinoUser) { + case Dinosaurus::Tyrannosaurus: + dinoUserTexture.loadFromFile("images/TyrannosaurusFightUser.png"); + break; + case Dinosaurus::Stegosaurus: + dinoUserTexture.loadFromFile("images/StegosaurusFightUser.png"); + break; + case Dinosaurus::Triceratops: + dinoUserTexture.loadFromFile("images/TriceratopsFightUser.png"); + break; + } + switch (dinoBot) { + case Dinosaurus::Tyrannosaurus: + dinoBotTexture.loadFromFile("images/TyrannosaurusFightBot.png"); + break; + case Dinosaurus::Stegosaurus: + dinoBotTexture.loadFromFile("images/StegosaurusFightBot.png"); + break; + case Dinosaurus::Triceratops: + dinoBotTexture.loadFromFile("images/TriceratopsFightBot.png"); + break; + } + + sf::Sprite dinoUserSprite(dinoUserTexture), dinoBotSprite(dinoBotTexture); + dinoUserSprite.setPosition(100, 300); + dinoBotSprite.setPosition(800, 300); + dinoUserSprite.setRotation(0); + dinoBotSprite.setRotation(0); + // + sf::Vector2i mousePos = sf::Mouse::getPosition(window); + sf::Vector2f worldPos = window.mapPixelToCoords(mousePos); + wasAttacked = 0; + if (dinoBotSprite.getGlobalBounds().contains(worldPos)) { + wasAttacked = 1; + } + + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + if (wasAttacked == 1 && !mousePressed) { + mousePressed = true; + dinoUserSprite.move(200, 0); + Sleep(100); + dinoUserSprite.setRotation(30); + dinoBotSprite.setColor(sf::Color::Magenta); + if ((randomTerrain == Terrain::Plane && dinoUser == 1) || (randomTerrain == Terrain::River && dinoUser == 2) || (randomTerrain == Terrain::Mountain && dinoUser == 3)) { + botDinoHealth -= (userAttack * 2) % 30; + } + else { + botDinoHealth -= (userAttack) % 20; + } + Sleep(100); + botAttack = std::rand() % 10 + 5; + userDinoHealth -= botAttack; + dinoBotSprite.move(-200, 0); + Sleep(100); + dinoBotSprite.setRotation(-30); + dinoUserSprite.setColor(sf::Color::Magenta); + } + } + else { + mousePressed = false; // , + } + if (userDinoHealth < 0) { userDinoHealth = 0; } + if (botDinoHealth < 0) { botDinoHealth = 0; } + // + userDinoHealthText.setString(std::to_string(userDinoHealth)); + botDinoHealthText.setString(std::to_string(botDinoHealth)); + userDinoHealthText.setPosition(100, 300); + botDinoHealthText.setPosition(700, 300); + // , + window.draw(terrainSprite); + window.draw(nameTerrainSprite); + window.draw(userDinoHealthIndicator); + window.draw(botDinoHealthIndicator); + window.draw(userDinoHealthText); + window.draw(botDinoHealthText); + + if (userDinoHealth <= 0) { + dinoUserSprite.setPosition(100, 300); + dinoUserSprite.setRotation(0); + dinoUserSprite.setColor(sf::Color::Red); + // erase - delete symbols from the line + // begin - pointer to the start of massive + dinoUserSprite.setRotation(-90); + pullUser.erase(pullUser.begin()); + if (!pullUser.length() == 0) { + userDinoHealth = 100; + } + Sleep(100); + } + if (botDinoHealth <= 0) { + dinoBotSprite.setPosition(800, 300); + dinoBotSprite.setRotation(0); + dinoBotSprite.setColor(sf::Color::Red); + dinoBotSprite.setRotation(90); + pullBot.erase(pullBot.begin()); + coinsEarned = coinsEarned + (std::rand() % 10 + 10); + coinsUser = coinsUser + coinsEarned; + if (!pullBot.length() == 0) { + botDinoHealth = 100; + } + Sleep(100); + } + window.draw(dinoUserSprite); + window.draw(dinoBotSprite); + window.draw(fightFinallyText); + // + balance.setString("Balance: " + std::to_string(coinsUser)); + earnedBalance.setString("Earned coins: " + std::to_string(coinsEarned)); + window.draw(balance); + window.draw(earnedBalance); + + window.display(); + Sleep(100); + if (flagBreak) { + if (pullUser.length() != 0) { + for (int k = 0; k < pullUser.length(); ++k) { + if (pullUser[k] == '1') { + cntUserTyrannosaurus++; + } + else if (pullUser[k] == '2') { + cntUserStegosaurus++; + } + else if (pullUser[k] == '3') { + cntUserTriceratops++; + } + } + } + break; + + } + } +} + +void handleFight(sf::Event& event, sf::RenderWindow& window, sf::Font& font,\ + sf::Texture& terrainTexture, sf::Texture& nameTerrain, \ + sf::Text& balance, sf::Text& earnedBalance, int& cntUserTyrannosaurus, \ + int& cntUserStegosaurus, int& cntUserTriceratops, int& coinsUser, \ + int& coinsEarned) { + Terrain randomTerrain = getRandomTerrain(); + std::string pullUser; + int pickNum = 0, cntSelected = 0; + bool mousePressed = false; + + sf::Texture selectedDino1Texture, selectedDino2Texture, selectedDino3Texture; + + // + sf::RectangleShape select1(sf::Vector2f(50, 50)); + select1.setFillColor(sf::Color::White); + select1.setPosition(400, 210); + sf::RectangleShape select2(sf::Vector2f(50, 50)); + select2.setFillColor(sf::Color::White); + select2.setPosition(400, 310); + sf::RectangleShape select3(sf::Vector2f(50, 50)); + select3.setFillColor(sf::Color::White); + select3.setPosition(400, 410); + sf::RectangleShape buttonFight(sf::Vector2f(150, 60)); + buttonFight.setFillColor(sf::Color::White); + buttonFight.setPosition(1050, 740); + + // + sf::Text cntUserTyrannosaurusText("", font, 50);// . , , ( );// ( ) + cntUserTyrannosaurusText.setStyle(sf::Text::Bold);// + sf::Text cntUserStegosaurusText("", font, 50);// . , , ( );// ( ) + cntUserStegosaurusText.setStyle(sf::Text::Bold);// + sf::Text cntUserTriceratopsText("", font, 50);// . , , ( );// ( ) + cntUserTriceratopsText.setStyle(sf::Text::Bold);// + // + sf::Text userPull("YOUR PULL", font, 80);// . , , ( );// ( ) + userPull.setFillColor(sf::Color::Green); + userPull.setStyle(sf::Text::Bold);// + sf::Text buttonFightText("Fight!", font, 60);// . , , ( );// ( ) + buttonFightText.setFillColor(sf::Color::Black); + buttonFightText.setStyle(sf::Text::Bold); + + cntUserTyrannosaurusText.setPosition(20, 200); + cntUserStegosaurusText.setPosition(20, 300); + cntUserTriceratopsText.setPosition(20, 400); + userPull.setPosition(800, 20); + buttonFightText.setPosition(1070, 730); + + while (window.isOpen() && !sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) { + window.close(); + } + } + // + switch (randomTerrain) { + case Terrain::Plane: + terrainTexture.loadFromFile("images/plane.png"); + nameTerrain.loadFromFile("images/name-plain.png"); + break; + case Terrain::River: + terrainTexture.loadFromFile("images/river.png"); + nameTerrain.loadFromFile("images/name-river.png"); + break; + case Terrain::Mountain: + terrainTexture.loadFromFile("images/mountain.png"); + nameTerrain.loadFromFile("images/name-mountain.png"); + } + // + sf::Sprite terrainSprite(terrainTexture), nameTerrainSprite(nameTerrain); + nameTerrainSprite.setPosition(550, 10); + nameTerrainSprite.setColor(sf::Color::White); + + // + select1.setFillColor(sf::Color::White); + select2.setFillColor(sf::Color::White); + select3.setFillColor(sf::Color::White); + buttonFight.setFillColor(sf::Color::White); + + window.clear(); + window.draw(terrainSprite); + window.draw(nameTerrainSprite); + window.draw(balance); + window.draw(earnedBalance); + + // + sf::Vector2i mousePos = sf::Mouse::getPosition(window); + sf::Vector2f worldPos = window.mapPixelToCoords(mousePos); + pickNum = 0; + if (select1.getGlobalBounds().contains(worldPos)) { + pickNum = 1; + } + if (select2.getGlobalBounds().contains(worldPos)) { + pickNum = 2; + } + if (select3.getGlobalBounds().contains(worldPos)) { + pickNum = 3; + } + if (buttonFight.getGlobalBounds().contains(worldPos)) { + buttonFight.setFillColor(sf::Color::Blue); + pickNum = 4; + } + + // + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + + if (pickNum == 1 && !mousePressed) { + if (cntUserTyrannosaurus > 0 && cntSelected < 3) { + select1.setFillColor(sf::Color::Green); + loadingTexture(cntSelected, pickNum, selectedDino1Texture, selectedDino2Texture, selectedDino3Texture); + cntUserTyrannosaurus--; + pullUser += "1"; + cntSelected++; + mousePressed = true; + } + else { select1.setFillColor(sf::Color::Red); } + } + if (pickNum == 2 && !mousePressed) { + if (cntUserStegosaurus > 0 && cntSelected < 3) { + select2.setFillColor(sf::Color::Green); + loadingTexture(cntSelected, pickNum, selectedDino1Texture, selectedDino2Texture, selectedDino3Texture); + cntUserStegosaurus--; + pullUser += "2"; + cntSelected++; + mousePressed = true; + } + else { select2.setFillColor(sf::Color::Red); } + } + if (pickNum == 3 && !mousePressed) { + if (cntUserTriceratops > 0 && cntSelected < 3) { + select3.setFillColor(sf::Color::Green); + loadingTexture(cntSelected, pickNum, selectedDino1Texture, selectedDino2Texture, selectedDino3Texture); + cntUserTriceratops--; + pullUser += "3"; + cntSelected++; + mousePressed = true; + } + else { select3.setFillColor(sf::Color::Red); } + } + + } + else { + mousePressed = false; // , + } + // + cntUserTyrannosaurusText.setString("Tyrannosaurus: " + std::to_string(cntUserTyrannosaurus)); + cntUserStegosaurusText.setString("Stegosaurus: " + std::to_string(cntUserStegosaurus)); + cntUserTriceratopsText.setString("Triceratops: " + std::to_string(cntUserTriceratops)); + // + sf::Sprite selectedDino1(selectedDino1Texture), selectedDino2(selectedDino2Texture), selectedDino3(selectedDino3Texture); + selectedDino1.setPosition(800, 100); + selectedDino2.setPosition(800, 300); + selectedDino3.setPosition(800, 500); + // + window.draw(cntUserTyrannosaurusText); + window.draw(cntUserStegosaurusText); + window.draw(cntUserTriceratopsText); + window.draw(userPull); + window.draw(select1); + window.draw(select2); + window.draw(select3); + window.draw(buttonFight); + window.draw(buttonFightText); + window.draw(selectedDino1); + window.draw(selectedDino2); + window.draw(selectedDino3); + + window.display(); + + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + if (pickNum == 4) { + actionFight(event, window, font, terrainSprite, \ + nameTerrainSprite, balance, earnedBalance, pullUser, randomTerrain, \ + coinsUser, coinsEarned, cntUserTyrannosaurus, \ + cntUserStegosaurus, cntUserTriceratops); while (!sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) && window.isOpen()); + } + } + } +} \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/handleInventory.h b/sem2/KochetovDI/GameDino/GameDino/handleInventory.h new file mode 100644 index 00000000..6e950343 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/handleInventory.h @@ -0,0 +1,56 @@ +#pragma once + +void handleInventory(sf::Event& event, sf::RenderWindow& window, sf::Font& font, sf::Text& balance, \ + sf::Text& earnedBalance, int& cntUserTyrannosaurus, int& cntUserStegosaurus, \ + int& cntUserTriceratops) +{ + sf::Texture shopBackground, nameTyrannosaurusTexture, nameStegosaurusTexture, nameTriceraptorTexture, \ + TyrannosaurusTexture, StegosaurusTexture, TriceratopsTexture; + shopBackground.loadFromFile("images/shop.png"); + TyrannosaurusTexture.loadFromFile("images/shop-Tyrannosaurus-compressed.png"); + StegosaurusTexture.loadFromFile("images/shop-Stegosaurus-compressed.png"); + TriceratopsTexture.loadFromFile("images/shop-Triceratops-compressed.png"); + sf::Sprite shopBg(shopBackground), Tyrannosaurus(TyrannosaurusTexture), Stegosaurus(StegosaurusTexture), Triceratops(TriceratopsTexture); + + Tyrannosaurus.setPosition(50, 110); + Stegosaurus.setPosition(50, 360); + Triceratops.setPosition(50, 610); + + // + sf::Text cntUserTyrannosaurusText("", font, 100);// . , , ( );// ( ) + cntUserTyrannosaurusText.setStyle(sf::Text::Bold);// + sf::Text cntUserStegosaurusText("", font, 100);// . , , ( );// ( ) + cntUserStegosaurusText.setStyle(sf::Text::Bold);// + sf::Text cntUserTriceratopsText("", font, 100);// . , , ( );// ( ) + cntUserTriceratopsText.setStyle(sf::Text::Bold);// + + cntUserTyrannosaurusText.setPosition(400, 110); + cntUserStegosaurusText.setPosition(400, 360); + cntUserTriceratopsText.setPosition(400, 610); + + while (window.isOpen() && !sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) { + window.close(); + } + } + window.clear(); + + + window.draw(shopBg); + window.draw(Tyrannosaurus); + window.draw(Stegosaurus); + window.draw(Triceratops); + + // + cntUserTyrannosaurusText.setString("Tyrannosaurus: " + std::to_string(cntUserTyrannosaurus)); + cntUserStegosaurusText.setString("Stegosaurus: " + std::to_string(cntUserStegosaurus)); + cntUserTriceratopsText.setString("Triceratops: " + std::to_string(cntUserTriceratops)); + window.draw(cntUserTyrannosaurusText); + window.draw(cntUserStegosaurusText); + window.draw(cntUserTriceratopsText); + window.display(); + + + } +} \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/handleShop.h b/sem2/KochetovDI/GameDino/GameDino/handleShop.h new file mode 100644 index 00000000..62a9325c --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/handleShop.h @@ -0,0 +1,129 @@ +#pragma once + +void handleShop(sf::Event& event, sf::RenderWindow& window, sf::Font& font, sf::Text& balance,\ + sf::Text& earnedBalance, int& coinsUser, int& cntUserTyrannosaurus, int& cntUserStegosaurus, \ + int& cntUserTriceratops) +{ + // + sf::Texture shopBackground, nameTyrannosaurusTexture, nameStegosaurusTexture, nameTriceratopsTexture, \ + TyrannosaurusTexture, StegosaurusTexture, TriceraptorTexture; + shopBackground.loadFromFile("images/shop.png"); + nameTyrannosaurusTexture.loadFromFile("images/shop-nameTyrannosaurus.png"); + nameStegosaurusTexture.loadFromFile("images/shop-nameStegosaurus.png"); + nameTriceratopsTexture.loadFromFile("images/shop-nameTriceratops.png"); + TyrannosaurusTexture.loadFromFile("images/shop-Tyrannosaurus-compressed.png"); + StegosaurusTexture.loadFromFile("images/shop-Stegosaurus-compressed.png"); + TriceraptorTexture.loadFromFile("images/shop-Triceratops-compressed.png"); + sf::Sprite shopBg(shopBackground), nameTyrannosaurus(nameTyrannosaurusTexture), nameStegosaurus(nameStegosaurusTexture), nameTriceratops(nameTriceratopsTexture), \ + Tyrannosaurus(TyrannosaurusTexture), Stegosaurus(StegosaurusTexture), Triceratops(TriceraptorTexture); + + // + sf::Text cntUserTyrannosaurusText("", font, 70);// . , , ( );// ( ) + cntUserTyrannosaurusText.setStyle(sf::Text::Bold);// + sf::Text cntUserStegosaurusText("", font, 70);// . , , ( );// ( ) + cntUserStegosaurusText.setStyle(sf::Text::Bold);// + sf::Text cntUserTriceratopsText("", font, 70);// . , , ( );// ( ) + cntUserTriceratopsText.setStyle(sf::Text::Bold);// + + // + int pickNum = 0; + bool mousePressed = false; + nameTyrannosaurus.setPosition(600, 50); + Tyrannosaurus.setPosition(750, 110); + nameStegosaurus.setPosition(600, 300); + Stegosaurus.setPosition(750, 360); + nameTriceratops.setPosition(600, 550); + Triceratops.setPosition(750, 610); + cntUserTyrannosaurusText.setPosition(50, 200); + cntUserStegosaurusText.setPosition(50, 300); + cntUserTriceratopsText.setPosition(50, 400); + + while (window.isOpen() && !sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { + while (window.pollEvent(event)) { + if (event.type == sf::Event::Closed) { + window.close(); + } + } + + nameTyrannosaurus.setColor(sf::Color::White); + nameStegosaurus.setColor(sf::Color::White); + nameTriceratops.setColor(sf::Color::White); + window.clear(); + + // + sf::Vector2i mousePos = sf::Mouse::getPosition(window); + sf::Vector2f worldPos = window.mapPixelToCoords(mousePos); + pickNum = 0; + + if (nameTyrannosaurus.getGlobalBounds().contains(worldPos)) { + nameTyrannosaurus.setColor(sf::Color::Blue); + pickNum = 1; + } + if (nameStegosaurus.getGlobalBounds().contains(worldPos)) { + nameStegosaurus.setColor(sf::Color::Blue); + pickNum = 2; + } + if (nameTriceratops.getGlobalBounds().contains(worldPos)) { + nameTriceratops.setColor(sf::Color::Blue); + pickNum = 3; + } + + // + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { + if (pickNum == 1 && !mousePressed) { + if (coinsUser >= 20) { + nameTyrannosaurus.setColor(sf::Color::Green); + cntUserTyrannosaurus++; + coinsUser -= 20; + mousePressed = true; + } + else { nameTyrannosaurus.setColor(sf::Color::Red); } + } + if (pickNum == 2 && !mousePressed) { + if (coinsUser >= 15) { + nameStegosaurus.setColor(sf::Color::Green); + cntUserStegosaurus++; + coinsUser -= 15; + mousePressed = true; + } + else { nameStegosaurus.setColor(sf::Color::Red); } + } + if (pickNum == 3 && !mousePressed) { + if (coinsUser >= 10) { + nameTriceratops.setColor(sf::Color::Green); + cntUserTriceratops++; + coinsUser -= 10; + mousePressed = true; + } + else { nameTriceratops.setColor(sf::Color::Red); } + } + } + else { + mousePressed = false; // , + } + // + balance.setString("Balance: " + std::to_string(coinsUser)); + // + cntUserTyrannosaurusText.setString("Tyrannosaurus: " + std::to_string(cntUserTyrannosaurus)); + cntUserStegosaurusText.setString("Stegosaurus: " + std::to_string(cntUserStegosaurus)); + cntUserTriceratopsText.setString("Triceratops: " + std::to_string(cntUserTriceratops)); + + window.draw(shopBg); + window.draw(nameTyrannosaurus); + window.draw(Tyrannosaurus); + window.draw(nameStegosaurus); + window.draw(Stegosaurus); + window.draw(nameTriceratops); + window.draw(Triceratops); + window.draw(balance); + window.draw(earnedBalance); + + // + window.draw(cntUserTyrannosaurusText); + window.draw(cntUserStegosaurusText); + window.draw(cntUserTriceratopsText); + window.display(); + + + } +} \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/images/StegosaurusFightBot.png b/sem2/KochetovDI/GameDino/GameDino/images/StegosaurusFightBot.png new file mode 100644 index 00000000..7881719a Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/StegosaurusFightBot.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/StegosaurusFightUser.png b/sem2/KochetovDI/GameDino/GameDino/images/StegosaurusFightUser.png new file mode 100644 index 00000000..0c8de1b7 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/StegosaurusFightUser.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/TriceratopsFightBot.png b/sem2/KochetovDI/GameDino/GameDino/images/TriceratopsFightBot.png new file mode 100644 index 00000000..735fa82a Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/TriceratopsFightBot.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/TriceratopsFightUser.png b/sem2/KochetovDI/GameDino/GameDino/images/TriceratopsFightUser.png new file mode 100644 index 00000000..d4de8203 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/TriceratopsFightUser.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/TyrannosaurusFightBot.png b/sem2/KochetovDI/GameDino/GameDino/images/TyrannosaurusFightBot.png new file mode 100644 index 00000000..554529cb Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/TyrannosaurusFightBot.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/TyrannosaurusFightUser.png b/sem2/KochetovDI/GameDino/GameDino/images/TyrannosaurusFightUser.png new file mode 100644 index 00000000..074811a2 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/TyrannosaurusFightUser.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/menu-background.png b/sem2/KochetovDI/GameDino/GameDino/images/menu-background.png new file mode 100644 index 00000000..53020655 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/menu-background.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/mountain.png b/sem2/KochetovDI/GameDino/GameDino/images/mountain.png new file mode 100644 index 00000000..e33b0aa7 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/mountain.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/my-Exit.png b/sem2/KochetovDI/GameDino/GameDino/images/my-Exit.png new file mode 100644 index 00000000..473e4972 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/my-Exit.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/my-Fight.png b/sem2/KochetovDI/GameDino/GameDino/images/my-Fight.png new file mode 100644 index 00000000..683ab497 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/my-Fight.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/my-Inventory.png b/sem2/KochetovDI/GameDino/GameDino/images/my-Inventory.png new file mode 100644 index 00000000..f7dd2a76 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/my-Inventory.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/my-Shop.png b/sem2/KochetovDI/GameDino/GameDino/images/my-Shop.png new file mode 100644 index 00000000..4bf01393 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/my-Shop.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/name-mountain.png b/sem2/KochetovDI/GameDino/GameDino/images/name-mountain.png new file mode 100644 index 00000000..336c1a8f Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/name-mountain.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/name-plain.png b/sem2/KochetovDI/GameDino/GameDino/images/name-plain.png new file mode 100644 index 00000000..2253072d Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/name-plain.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/name-river.png b/sem2/KochetovDI/GameDino/GameDino/images/name-river.png new file mode 100644 index 00000000..d4dde0a0 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/name-river.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/plane.png b/sem2/KochetovDI/GameDino/GameDino/images/plane.png new file mode 100644 index 00000000..503659ae Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/plane.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/river.png b/sem2/KochetovDI/GameDino/GameDino/images/river.png new file mode 100644 index 00000000..fa7bdb26 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/river.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-Stegosaurus-compressed.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-Stegosaurus-compressed.png new file mode 100644 index 00000000..bc497987 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-Stegosaurus-compressed.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-Stegosaurus.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-Stegosaurus.png new file mode 100644 index 00000000..000af415 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-Stegosaurus.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-Triceratops-compressed.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-Triceratops-compressed.png new file mode 100644 index 00000000..67b2c11f Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-Triceratops-compressed.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-Triceratops.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-Triceratops.png new file mode 100644 index 00000000..723115e2 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-Triceratops.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-Tyrannosaurus-compressed.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-Tyrannosaurus-compressed.png new file mode 100644 index 00000000..55044e3f Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-Tyrannosaurus-compressed.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-Tyrannosaurus.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-Tyrannosaurus.png new file mode 100644 index 00000000..aa52456c Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-Tyrannosaurus.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-nameStegosaurus.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-nameStegosaurus.png new file mode 100644 index 00000000..0c6c40fa Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-nameStegosaurus.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-nameTriceratops.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-nameTriceratops.png new file mode 100644 index 00000000..1951a105 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-nameTriceratops.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop-nameTyrannosaurus.png b/sem2/KochetovDI/GameDino/GameDino/images/shop-nameTyrannosaurus.png new file mode 100644 index 00000000..824b54b2 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop-nameTyrannosaurus.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/images/shop.png b/sem2/KochetovDI/GameDino/GameDino/images/shop.png new file mode 100644 index 00000000..bd07aa93 Binary files /dev/null and b/sem2/KochetovDI/GameDino/GameDino/images/shop.png differ diff --git a/sem2/KochetovDI/GameDino/GameDino/menu.h b/sem2/KochetovDI/GameDino/GameDino/menu.h new file mode 100644 index 00000000..1386e3a3 --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/menu.h @@ -0,0 +1,95 @@ +#pragma once + +#include +#include +#include + +#include "handleFight.h" +#include "handleShop.h" +#include "handleInventory.h" + +void menu(sf::Event& event, sf::RenderWindow& window, int& coinsEarned,\ + int& coinsUser, int& cntUserTyrannosaurus, int& cntUserStegosaurus, \ + int& cntUserTriceraptor) +{ + // + sf::Texture menuExit, menuFight, menuShop, menuInventory, terrainTexture, menuBackground, nameTerrain; + menuExit.loadFromFile("images/my-Exit.png"); + menuFight.loadFromFile("images/my-Fight.png"); + menuShop.loadFromFile("images/my-Shop.png"); + menuInventory.loadFromFile("images/my-Inventory.png"); + menuBackground.loadFromFile("images/menu-background.png"); + sf::Sprite menu1(menuExit), menu2(menuFight), menu3(menuShop), menu4(menuInventory), menuBg(menuBackground); + int menuNum = 0; + menu1.setPosition(10, 50); + menu2.setPosition(10, 100); + menu3.setPosition(10, 150); + menu4.setPosition(10, 200); + menuBg.setPosition(220, 0); + + // , + sf::Font font; + font.loadFromFile("Riotun2.ttf"); + sf::Text balance("", font, 30);// . , , ( );// ( ) + balance.setStyle(sf::Text::Bold);// + sf::Text earnedBalance("", font, 30);// . , , ( );// ( ) + earnedBalance.setStyle(sf::Text::Bold);// + + ///////////////////////////////////////////////// + while (window.isOpen()) { + while (window.pollEvent(event)) + { + + // + balance.setString("Balance: " + std::to_string(coinsUser)); + balance.setPosition(5, 720); + earnedBalance.setString("Earned coins: " + std::to_string(coinsEarned)); + earnedBalance.setPosition(5, 750); + + menu1.setColor(sf::Color::White); + menu2.setColor(sf::Color::White); + menu3.setColor(sf::Color::White); + menu4.setColor(sf::Color::White); + menuNum = 0; + window.clear(sf::Color(129, 181, 221)); + + // + sf::Vector2i mousePos = sf::Mouse::getPosition(window); + sf::Vector2f worldPos = window.mapPixelToCoords(mousePos); + + // + if (menu1.getGlobalBounds().contains(worldPos)) { menu1.setColor(sf::Color::Blue); menuNum = 1; } + if (menu2.getGlobalBounds().contains(worldPos)) { menu2.setColor(sf::Color::Blue); menuNum = 2; } + if (menu3.getGlobalBounds().contains(worldPos)) { menu3.setColor(sf::Color::Blue); menuNum = 3; } + if (menu4.getGlobalBounds().contains(worldPos)) { menu4.setColor(sf::Color::Blue); menuNum = 4; } + + // + if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) + { + if (menuNum == 1) { window.close(); }// , + if (menuNum == 2) { handleFight(event, window, font, terrainTexture, \ + nameTerrain, balance, earnedBalance, \ + cntUserTyrannosaurus, cntUserStegosaurus, cntUserTriceraptor, \ + coinsUser, coinsEarned); while (!sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) && window.isOpen()); } + if (menuNum == 3) { handleShop(event, window, font, balance, earnedBalance, coinsUser,\ + cntUserTyrannosaurus, cntUserStegosaurus, cntUserTriceraptor); while (!sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) && window.isOpen()); } + if (menuNum == 4) {handleInventory(event, window, font, balance, earnedBalance, \ + cntUserTyrannosaurus, cntUserStegosaurus, cntUserTriceraptor); while (!sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) && window.isOpen()); } + + } + + if (event.type == sf::Event::Closed) { window.close();}; + + window.draw(menuBg); + window.draw(menu1); + window.draw(menu2); + window.draw(menu3); + window.draw(menu4); + window.draw(balance); + window.draw(earnedBalance); + + window.display(); + } + } + //////////////////////////////////////////////////// +} \ No newline at end of file diff --git a/sem2/KochetovDI/GameDino/GameDino/userDinoInventory.txt b/sem2/KochetovDI/GameDino/GameDino/userDinoInventory.txt new file mode 100644 index 00000000..a353ad2e --- /dev/null +++ b/sem2/KochetovDI/GameDino/GameDino/userDinoInventory.txt @@ -0,0 +1,3 @@ +31 +63 +71 diff --git a/sem2/KochetovDI/GameDino/include/SFML/Audio.hpp b/sem2/KochetovDI/GameDino/include/SFML/Audio.hpp new file mode 100644 index 00000000..d5f798d1 --- /dev/null +++ b/sem2/KochetovDI/GameDino/include/SFML/Audio.hpp @@ -0,0 +1,56 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_HPP +#define SFML_AUDIO_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_AUDIO_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup audio Audio module +/// +/// Sounds, streaming (musics or custom sources), recording, +/// spatialization. +/// +//////////////////////////////////////////////////////////// diff --git a/sem2/KochetovDI/GameDino/include/SFML/Audio/AlResource.hpp b/sem2/KochetovDI/GameDino/include/SFML/Audio/AlResource.hpp new file mode 100644 index 00000000..7ac21fe8 --- /dev/null +++ b/sem2/KochetovDI/GameDino/include/SFML/Audio/AlResource.hpp @@ -0,0 +1,70 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_ALRESOURCE_HPP +#define SFML_ALRESOURCE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Base class for classes that require an OpenAL context +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API AlResource +{ +protected: + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + AlResource(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~AlResource(); +}; + +} // namespace sf + + +#endif // SFML_ALRESOURCE_HPP + +//////////////////////////////////////////////////////////// +/// \class sf::AlResource +/// \ingroup audio +/// +/// This class is for internal use only, it must be the base +/// of every class that requires a valid OpenAL context in +/// order to work. +/// +//////////////////////////////////////////////////////////// diff --git a/sem2/KochetovDI/GameDino/include/SFML/Audio/Export.hpp b/sem2/KochetovDI/GameDino/include/SFML/Audio/Export.hpp new file mode 100644 index 00000000..e2531514 --- /dev/null +++ b/sem2/KochetovDI/GameDino/include/SFML/Audio/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_EXPORT_HPP +#define SFML_AUDIO_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_AUDIO_EXPORTS) + + #define SFML_AUDIO_API SFML_API_EXPORT + +#else + + #define SFML_AUDIO_API SFML_API_IMPORT + +#endif + + +#endif // SFML_AUDIO_EXPORT_HPP diff --git a/sem2/KochetovDI/GameDino/include/SFML/Audio/InputSoundFile.hpp b/sem2/KochetovDI/GameDino/include/SFML/Audio/InputSoundFile.hpp new file mode 100644 index 00000000..0a02b140 --- /dev/null +++ b/sem2/KochetovDI/GameDino/include/SFML/Audio/InputSoundFile.hpp @@ -0,0 +1,268 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_INPUTSOUNDFILE_HPP +#define SFML_INPUTSOUNDFILE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; +class SoundFileReader; + +//////////////////////////////////////////////////////////// +/// \brief Provide read access to sound files +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API InputSoundFile : NonCopyable +{ +public: + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + InputSoundFile(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~InputSoundFile(); + + //////////////////////////////////////////////////////////// + /// \brief Open a sound file from the disk for reading + /// + /// The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC, MP3. + /// The supported sample sizes for FLAC and WAV are 8, 16, 24 and 32 bit. + /// + /// Because of minimp3_ex limitation, for MP3 files with big (>16kb) APEv2 tag, + /// it may not be properly removed, tag data will be treated as MP3 data + /// and there is a low chance of garbage decoded at the end of file. + /// See also: https://github.com/lieff/minimp3 + /// + /// \param filename Path of the sound file to load + /// + /// \return True if the file was successfully opened + /// + //////////////////////////////////////////////////////////// + bool openFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Open a sound file in memory for reading + /// + /// The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC. + /// The supported sample sizes for FLAC and WAV are 8, 16, 24 and 32 bit. + /// + /// \param data Pointer to the file data in memory + /// \param sizeInBytes Size of the data to load, in bytes + /// + /// \return True if the file was successfully opened + /// + //////////////////////////////////////////////////////////// + bool openFromMemory(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Open a sound file from a custom stream for reading + /// + /// The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC. + /// The supported sample sizes for FLAC and WAV are 8, 16, 24 and 32 bit. + /// + /// \param stream Source stream to read from + /// + /// \return True if the file was successfully opened + /// + //////////////////////////////////////////////////////////// + bool openFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Get the total number of audio samples in the file + /// + /// \return Number of samples + /// + //////////////////////////////////////////////////////////// + Uint64 getSampleCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the number of channels used by the sound + /// + /// \return Number of channels (1 = mono, 2 = stereo) + /// + //////////////////////////////////////////////////////////// + unsigned int getChannelCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the sample rate of the sound + /// + /// \return Sample rate, in samples per second + /// + //////////////////////////////////////////////////////////// + unsigned int getSampleRate() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the total duration of the sound file + /// + /// This function is provided for convenience, the duration is + /// deduced from the other sound file attributes. + /// + /// \return Duration of the sound file + /// + //////////////////////////////////////////////////////////// + Time getDuration() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the read offset of the file in time + /// + /// \return Time position + /// + //////////////////////////////////////////////////////////// + Time getTimeOffset() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the read offset of the file in samples + /// + /// \return Sample position + /// + //////////////////////////////////////////////////////////// + Uint64 getSampleOffset() const; + + //////////////////////////////////////////////////////////// + /// \brief Change the current read position to the given sample offset + /// + /// This function takes a sample offset to provide maximum + /// precision. If you need to jump to a given time, use the + /// other overload. + /// + /// The sample offset takes the channels into account. + /// If you have a time offset instead, you can easily find + /// the corresponding sample offset with the following formula: + /// `timeInSeconds * sampleRate * channelCount` + /// If the given offset exceeds to total number of samples, + /// this function jumps to the end of the sound file. + /// + /// \param sampleOffset Index of the sample to jump to, relative to the beginning + /// + //////////////////////////////////////////////////////////// + void seek(Uint64 sampleOffset); + + //////////////////////////////////////////////////////////// + /// \brief Change the current read position to the given time offset + /// + /// Using a time offset is handy but imprecise. If you need an accurate + /// result, consider using the overload which takes a sample offset. + /// + /// If the given time exceeds to total duration, this function jumps + /// to the end of the sound file. + /// + /// \param timeOffset Time to jump to, relative to the beginning + /// + //////////////////////////////////////////////////////////// + void seek(Time timeOffset); + + //////////////////////////////////////////////////////////// + /// \brief Read audio samples from the open file + /// + /// \param samples Pointer to the sample array to fill + /// \param maxCount Maximum number of samples to read + /// + /// \return Number of samples actually read (may be less than \a maxCount) + /// + //////////////////////////////////////////////////////////// + Uint64 read(Int16* samples, Uint64 maxCount); + + //////////////////////////////////////////////////////////// + /// \brief Close the current file + /// + //////////////////////////////////////////////////////////// + void close(); + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SoundFileReader* m_reader; //!< Reader that handles I/O on the file's format + InputStream* m_stream; //!< Input stream used to access the file's data + bool m_streamOwned; //!< Is the stream internal or external? + Uint64 m_sampleOffset; //!< Sample Read Position + Uint64 m_sampleCount; //!< Total number of samples in the file + unsigned int m_channelCount; //!< Number of channels of the sound + unsigned int m_sampleRate; //!< Number of samples per second +}; + +} // namespace sf + + +#endif // SFML_INPUTSOUNDFILE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::InputSoundFile +/// \ingroup audio +/// +/// This class decodes audio samples from a sound file. It is +/// used internally by higher-level classes such as sf::SoundBuffer +/// and sf::Music, but can also be useful if you want to process +/// or analyze audio files without playing them, or if you want to +/// implement your own version of sf::Music with more specific +/// features. +/// +/// Usage example: +/// \code +/// // Open a sound file +/// sf::InputSoundFile file; +/// if (!file.openFromFile("music.ogg")) +/// /* error */; +/// +/// // Print the sound attributes +/// std::cout << "duration: " << file.getDuration().asSeconds() << std::endl; +/// std::cout << "channels: " << file.getChannelCount() << std::endl; +/// std::cout << "sample rate: " << file.getSampleRate() << std::endl; +/// std::cout << "sample count: " << file.getSampleCount() << std::endl; +/// +/// // Read and process batches of samples until the end of file is reached +/// sf::Int16 samples[1024]; +/// sf::Uint64 count; +/// do +/// { +/// count = file.read(samples, 1024); +/// +/// // process, analyze, play, convert, or whatever +/// // you want to do with the samples... +/// } +/// while (count > 0); +/// \endcode +/// +/// \see sf::SoundFileReader, sf::OutputSoundFile +/// +//////////////////////////////////////////////////////////// diff --git a/sem2/KochetovDI/GameDino/include/SFML/Audio/Listener.hpp b/sem2/KochetovDI/GameDino/include/SFML/Audio/Listener.hpp new file mode 100644 index 00000000..edfe6502 --- /dev/null +++ b/sem2/KochetovDI/GameDino/include/SFML/Audio/Listener.hpp @@ -0,0 +1,234 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LISTENER_HPP +#define SFML_LISTENER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief The audio listener is the point in the scene +/// from where all the sounds are heard +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Listener +{ +public: + + //////////////////////////////////////////////////////////// + /// \brief Change the global volume of all the sounds and musics + /// + /// The volume is a number between 0 and 100; it is combined with + /// the individual volume of each sound / music. + /// The default value for the volume is 100 (maximum). + /// + /// \param volume New global volume, in the range [0, 100] + /// + /// \see getGlobalVolume + /// + //////////////////////////////////////////////////////////// + static void setGlobalVolume(float volume); + + //////////////////////////////////////////////////////////// + /// \brief Get the current value of the global volume + /// + /// \return Current global volume, in the range [0, 100] + /// + /// \see setGlobalVolume + /// + //////////////////////////////////////////////////////////// + static float getGlobalVolume(); + + //////////////////////////////////////////////////////////// + /// \brief Set the position of the listener in the scene + /// + /// The default listener's position is (0, 0, 0). + /// + /// \param x X coordinate of the listener's position + /// \param y Y coordinate of the listener's position + /// \param z Z coordinate of the listener's position + /// + /// \see getPosition, setDirection + /// + //////////////////////////////////////////////////////////// + static void setPosition(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the position of the listener in the scene + /// + /// The default listener's position is (0, 0, 0). + /// + /// \param position New listener's position + /// + /// \see getPosition, setDirection + /// + //////////////////////////////////////////////////////////// + static void setPosition(const Vector3f& position); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the listener in the scene + /// + /// \return Listener's position + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + static Vector3f getPosition(); + + //////////////////////////////////////////////////////////// + /// \brief Set the forward vector of the listener in the scene + /// + /// The direction (also called "at vector") is the vector + /// pointing forward from the listener's perspective. Together + /// with the up vector, it defines the 3D orientation of the + /// listener in the scene. The direction vector doesn't + /// have to be normalized. + /// The default listener's direction is (0, 0, -1). + /// + /// \param x X coordinate of the listener's direction + /// \param y Y coordinate of the listener's direction + /// \param z Z coordinate of the listener's direction + /// + /// \see getDirection, setUpVector, setPosition + /// + //////////////////////////////////////////////////////////// + static void setDirection(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the forward vector of the listener in the scene + /// + /// The direction (also called "at vector") is the vector + /// pointing forward from the listener's perspective. Together + /// with the up vector, it defines the 3D orientation of the + /// listener in the scene. The direction vector doesn't + /// have to be normalized. + /// The default listener's direction is (0, 0, -1). + /// + /// \param direction New listener's direction + /// + /// \see getDirection, setUpVector, setPosition + /// + //////////////////////////////////////////////////////////// + static void setDirection(const Vector3f& direction); + + //////////////////////////////////////////////////////////// + /// \brief Get the current forward vector of the listener in the scene + /// + /// \return Listener's forward vector (not normalized) + /// + /// \see setDirection + /// + //////////////////////////////////////////////////////////// + static Vector3f getDirection(); + + //////////////////////////////////////////////////////////// + /// \brief Set the upward vector of the listener in the scene + /// + /// The up vector is the vector that points upward from the + /// listener's perspective. Together with the direction, it + /// defines the 3D orientation of the listener in the scene. + /// The up vector doesn't have to be normalized. + /// The default listener's up vector is (0, 1, 0). It is usually + /// not necessary to change it, especially in 2D scenarios. + /// + /// \param x X coordinate of the listener's up vector + /// \param y Y coordinate of the listener's up vector + /// \param z Z coordinate of the listener's up vector + /// + /// \see getUpVector, setDirection, setPosition + /// + //////////////////////////////////////////////////////////// + static void setUpVector(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the upward vector of the listener in the scene + /// + /// The up vector is the vector that points upward from the + /// listener's perspective. Together with the direction, it + /// defines the 3D orientation of the listener in the scene. + /// The up vector doesn't have to be normalized. + /// The default listener's up vector is (0, 1, 0). It is usually + /// not necessary to change it, especially in 2D scenarios. + /// + /// \param upVector New listener's up vector + /// + /// \see getUpVector, setDirection, setPosition + /// + //////////////////////////////////////////////////////////// + static void setUpVector(const Vector3f& upVector); + + //////////////////////////////////////////////////////////// + /// \brief Get the current upward vector of the listener in the scene + /// + /// \return Listener's upward vector (not normalized) + /// + /// \see setUpVector + /// + //////////////////////////////////////////////////////////// + static Vector3f getUpVector(); +}; + +} // namespace sf + + +#endif // SFML_LISTENER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Listener +/// \ingroup audio +/// +/// The audio listener defines the global properties of the +/// audio environment, it defines where and how sounds and musics +/// are heard. If sf::View is the eyes of the user, then sf::Listener +/// is his ears (by the way, they are often linked together -- +/// same position, orientation, etc.). +/// +/// sf::Listener is a simple interface, which allows to setup the +/// listener in the 3D audio environment (position, direction and +/// up vector), and to adjust the global volume. +/// +/// Because the listener is unique in the scene, sf::Listener only +/// contains static functions and doesn't have to be instantiated. +/// +/// Usage example: +/// \code +/// // Move the listener to the position (1, 0, -5) +/// sf::Listener::setPosition(1, 0, -5); +/// +/// // Make it face the right axis (1, 0, 0) +/// sf::Listener::setDirection(1, 0, 0); +/// +/// // Reduce the global volume +/// sf::Listener::setGlobalVolume(50); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/sem2/KochetovDI/GameDino/include/SFML/Audio/Music.hpp b/sem2/KochetovDI/GameDino/include/SFML/Audio/Music.hpp new file mode 100644 index 00000000..4c4eefb2 --- /dev/null +++ b/sem2/KochetovDI/GameDino/include/SFML/Audio/Music.hpp @@ -0,0 +1,337 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUSIC_HPP +#define SFML_MUSIC_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Streamed music played from an audio file +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Music : public SoundStream +{ +public: + + //////////////////////////////////////////////////////////// + /// \brief Structure defining a time range using the template type + /// + //////////////////////////////////////////////////////////// + template + struct Span + { + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Span() + { + + } + + //////////////////////////////////////////////////////////// + /// \brief Initialization constructor + /// + /// \param off Initial Offset + /// \param len Initial Length + /// + //////////////////////////////////////////////////////////// + Span(T off, T len): + offset(off), + length(len) + { + + } + + T offset; //!< The beginning offset of the time range + T length; //!< The length of the time range + }; + + // Define the relevant Span types + typedef Span