diff --git a/.gitignore b/.gitignore index 07dd881..1d7c235 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ /BinForRun/Textures/ImageTarget5.bmp /BinForRun/Textures/ImageTarget6.bmp /BinForRun +/GunsAndPans_BinForRun_Win64_v1.6.0.zip diff --git a/ClassDiagram/ClassDiagram_ver1.0.1.png b/ClassDiagrams/ClassDiagram_ver1.0.1.png similarity index 100% rename from ClassDiagram/ClassDiagram_ver1.0.1.png rename to ClassDiagrams/ClassDiagram_ver1.0.1.png diff --git a/ClassDiagram/ClassDiagram_ver1.5.0.png b/ClassDiagrams/ClassDiagram_ver1.5.0.png similarity index 100% rename from ClassDiagram/ClassDiagram_ver1.5.0.png rename to ClassDiagrams/ClassDiagram_ver1.5.0.png diff --git a/ClassDiagrams/ClassDiagram_ver1.6.0.png b/ClassDiagrams/ClassDiagram_ver1.6.0.png new file mode 100644 index 0000000..8e34b15 Binary files /dev/null and b/ClassDiagrams/ClassDiagram_ver1.6.0.png differ diff --git a/Screenshots/screen01.jpg b/Screenshots/screen01.jpg new file mode 100644 index 0000000..671c97a Binary files /dev/null and b/Screenshots/screen01.jpg differ diff --git a/Screenshots/screen01.png b/Screenshots/screen01.png deleted file mode 100644 index 80f6f73..0000000 Binary files a/Screenshots/screen01.png and /dev/null differ diff --git a/Screenshots/screen02.jpg b/Screenshots/screen02.jpg new file mode 100644 index 0000000..401c5f0 Binary files /dev/null and b/Screenshots/screen02.jpg differ diff --git a/Screenshots/screen02.png b/Screenshots/screen02.png deleted file mode 100644 index 8871131..0000000 Binary files a/Screenshots/screen02.png and /dev/null differ diff --git a/Screenshots/screen03.jpg b/Screenshots/screen03.jpg new file mode 100644 index 0000000..42fd291 Binary files /dev/null and b/Screenshots/screen03.jpg differ diff --git a/Screenshots/screen03.png b/Screenshots/screen03.png deleted file mode 100644 index a345161..0000000 Binary files a/Screenshots/screen03.png and /dev/null differ diff --git a/Screenshots/screen04.jpg b/Screenshots/screen04.jpg new file mode 100644 index 0000000..f138318 Binary files /dev/null and b/Screenshots/screen04.jpg differ diff --git a/Screenshots/screen04.png b/Screenshots/screen04.png deleted file mode 100644 index 4d89511..0000000 Binary files a/Screenshots/screen04.png and /dev/null differ diff --git a/Screenshots/screen05.jpg b/Screenshots/screen05.jpg new file mode 100644 index 0000000..85767f5 Binary files /dev/null and b/Screenshots/screen05.jpg differ diff --git a/Screenshots/screen05.png b/Screenshots/screen05.png deleted file mode 100644 index 0c44b78..0000000 Binary files a/Screenshots/screen05.png and /dev/null differ diff --git a/SourceCode/GunsAndPans/Score.txt b/SourceCode/GunsAndPans/Score.txt index ed64777..ff9e524 100644 --- a/SourceCode/GunsAndPans/Score.txt +++ b/SourceCode/GunsAndPans/Score.txt @@ -1,4 +1,6 @@ -Guns & Pans Game Results +=== Guns & Pans game results === +Start scores: 50 Max possible scores: 175 Your current scores: 165 Bullet cost: 5 +You did: 8 shots diff --git a/SourceCode/GunsAndPans/TGame.cpp b/SourceCode/GunsAndPans/TGame.cpp index 24ba3b5..d60818c 100644 --- a/SourceCode/GunsAndPans/TGame.cpp +++ b/SourceCode/GunsAndPans/TGame.cpp @@ -51,10 +51,6 @@ namespace GunsAndPuns soundsNames.push_back(soundsDir + L"SoundFinish.wav"); } - TGame::~TGame() - { - } - std::string __fastcall TGame::wstringToString(const std::wstring& wstr) const { using convert_typeX = std::codecvt_utf8; @@ -365,10 +361,12 @@ namespace GunsAndPuns { const size_t maxScores = startScores + level.getAllTargetsPoints() - (bulletCost * 6); - fout << "Guns & Pans Game Results" << std::endl; + fout << "=== Guns & Pans game results === " << std::endl; + fout << "Start scores: " << startScores << std::endl; fout << "Max possible scores: " << maxScores << std::endl; fout << "Your current scores: " << scores << std::endl; fout << "Bullet cost: " << bulletCost << std::endl; + fout << "You did: " << amun.getShotsNumber() << " shots" << std::endl; } } diff --git a/SourceCode/GunsAndPans/TGame.h b/SourceCode/GunsAndPans/TGame.h index ad670fb..c254222 100644 --- a/SourceCode/GunsAndPans/TGame.h +++ b/SourceCode/GunsAndPans/TGame.h @@ -15,7 +15,6 @@ namespace GunsAndPuns public: TGame(); - ~TGame(); enum class TKeyCode : uint8_t { diff --git a/SourceCode/GunsAndPans/TObjects.cpp b/SourceCode/GunsAndPans/TObjects.cpp index 98e98e8..15cbbd0 100644 --- a/SourceCode/GunsAndPans/TObjects.cpp +++ b/SourceCode/GunsAndPans/TObjects.cpp @@ -63,7 +63,7 @@ namespace GunsAndPuns cz = 3.0f; } - void TBullet::calcVector(const GLfloat xzAngleDegree, const GLfloat yzAngleDegree) + void __fastcall TBullet::calcVector(const GLfloat xzAngleDegree, const GLfloat yzAngleDegree) { vx = 0.0f; vy = 0.0f; @@ -181,12 +181,15 @@ namespace GunsAndPuns //================================================================================================ // class TTarget - TTarget::TTarget() - : active{ true }, z{ -5.0f } + TTarget::TTarget(const TScene& scene) + : active{ true }, speed{ 0.001f } , cx{ 0.0f }, cy{ 0.0f }, vx{ 0.0f }, vy{ 0.0f }, size{ 0.0f } , points{ 0U }, horizontalTarget{ false } + , sceneWidth{ scene.getWidth() } + , yTop{ scene.getTopY() } + , yDown{ scene.getDownY() } + , z{ scene.getZ() } { - } void TTarget::draw() const @@ -302,6 +305,13 @@ namespace GunsAndPuns //================================================================================================ // class TScreen + TScreen::TScreen() + : z{ 0.0f } + , width{ 6.0f } + , height{ 5.0f } + { + } + void TScreen::draw() const { const GLfloat h2 = height * 0.5f; @@ -322,6 +332,13 @@ namespace GunsAndPuns //================================================================================================ // class TGunAmunitions + TGunAmunitions::TGunAmunitions() + : currentAmunitionsNumber{ 10U }, shots{ 0U } + , height{0.0f}, width{0.0f} + , cx{0.0f}, cy{0.0f}, cz{0.0f} + { + } + void __fastcall TGunAmunitions::addFileAsTexture(const std::string& fname) { fileNames.push_back(fname); @@ -350,7 +367,18 @@ namespace GunsAndPuns //================================================================================================ // class TLevels - void TLevels::init(const std::vector& texturesNames) + TLevels::TLevels() + : appleTarget(scene) + , smallTarget(scene) + , bigTarget(scene) + , leftTarget(scene) + , rightTarget(scene) + , lemonTarget(scene) + , level{ TLevelNum::FIRST } + { + } + + void __fastcall TLevels::init(const std::vector& texturesNames) { appleTarget.loadTexture(texturesNames[TGame::TTexture::APPLE_TARGET]); smallTarget.loadTexture(texturesNames[TGame::TTexture::SMALL_TARGET]); @@ -374,13 +402,18 @@ namespace GunsAndPuns void TLevels::reInit() { - appleTarget.init(0.0f, 4.9f, 1.5f, 0.0f, 0.5f, true); - smallTarget.init(0.0f, 2.3f, -1.0f, 0.0f, 0.75f, true); - bigTarget.init(0.0f, -0.2f, 1.0f, 0.0f, 1.0f, true); + const GLfloat smallSize{ 0.5f }; + const GLfloat middleSize{ 0.75f }; + const GLfloat bigSize{ 1.0f }; + + appleTarget.init(0.0f, 4.9f, 1.5f, 0.0f, smallSize); + smallTarget.init(0.0f, 2.3f, -1.0f, 0.0f, middleSize); + bigTarget.init(0.0f, -0.2f, 1.0f, 0.0f, bigSize); - lemonTarget.init(0.0f, 4.9f, -1.6f, 0.0f, 0.5f, true); - leftTarget.init(-3.0f, 1.0f, 0.0f, 1.0f, 0.75f, false); - rightTarget.init(3.0f, 1.0f, 0.0f, -1.0f, 0.75f, false); + const GLfloat sceneCenterY = scene.getDownY() + (scene.getTopY() - scene.getDownY()) * 0.5f; + lemonTarget.init(0.0f, 4.9f, -1.7f, 0.0f, smallSize); + leftTarget.init(-3.0f, sceneCenterY, 0.0f, 1.0f, middleSize, false); + rightTarget.init(3.0f, sceneCenterY, 0.0f, -1.0f, middleSize, false); level = TLevelNum::FIRST; } @@ -405,7 +438,7 @@ namespace GunsAndPuns leftTarget.getPoints() + rightTarget.getPoints() + lemonTarget.getPoints(); } - bool TLevels::collisionCheck(const GLfloat x, const GLfloat y, size_t& scores, TBullet& bullet) + bool __fastcall TLevels::collisionCheck(const GLfloat x, const GLfloat y, size_t& scores, TBullet& bullet) { if (level == TLevelNum::FIRST) { diff --git a/SourceCode/GunsAndPans/TObjects.h b/SourceCode/GunsAndPans/TObjects.h index 1be1f1f..dec81e3 100644 --- a/SourceCode/GunsAndPans/TObjects.h +++ b/SourceCode/GunsAndPans/TObjects.h @@ -82,7 +82,7 @@ namespace GunsAndPuns GLfloat getRadius() const { return radius; } void resetCenter(); - void calcVector(const GLfloat xzAngleDegree, const GLfloat yzAngleDegree); + void __fastcall calcVector(const GLfloat xzAngleDegree, const GLfloat yzAngleDegree); bool active; @@ -108,6 +108,9 @@ namespace GunsAndPuns void draw() const override; GLfloat getZ() const { return z; } + GLfloat getWidth() const { return width; } + GLfloat getTopY() const { return topY; } + GLfloat getDownY() const { return downY; } private: @@ -126,7 +129,7 @@ namespace GunsAndPuns { public: - TTarget(); + TTarget(const TScene & scene); void draw() const override; void __fastcall move(const size_t dtMs) override; @@ -137,7 +140,7 @@ namespace GunsAndPuns size_t getPoints() const { return points; } void __fastcall init(const GLfloat _cx, const GLfloat _cy, - const GLfloat _vx, const GLfloat _vy, const GLfloat _size, const bool _horizontalTarget) + const GLfloat _vx, const GLfloat _vy, const GLfloat _size, const bool _horizontalTarget = true) { cx = _cx; cy = _cy; @@ -152,10 +155,10 @@ namespace GunsAndPuns private: - const GLfloat speed{ 0.001f }; - const GLfloat sceneWidth{ 10.0f }; - const GLfloat yTop{ 4.0f }; - const GLfloat yDown{ -2.0f }; + const GLfloat speed; + const GLfloat sceneWidth; + const GLfloat yTop; + const GLfloat yDown; GLfloat z, cx, cy, vx, vy, size /* half width */; size_t points; bool horizontalTarget; @@ -196,6 +199,8 @@ namespace GunsAndPuns { public: + TScreen(); + void draw() const override; void __fastcall setParams(const GLfloat _z, const GLfloat _width, const GLfloat _height) @@ -207,9 +212,9 @@ namespace GunsAndPuns private: - GLfloat z{ 0.0f }; - GLfloat width{ 6.0f }; - GLfloat height{ 5.0f }; + GLfloat z; + GLfloat width; + GLfloat height; }; //================================================================================================ @@ -219,10 +224,12 @@ namespace GunsAndPuns { public: + TGunAmunitions(); void __fastcall addFileAsTexture(const std::string& fname); - void __fastcall setAmunNumber(const size_t num) { currentAmunitionsNumber = num; } + void __fastcall setAmunNumber(const size_t num) { currentAmunitionsNumber = num; shots = 0U; } size_t getAmunNumber() const { return currentAmunitionsNumber; } + size_t getShotsNumber() const { return shots; } void initCurTexture() { @@ -234,10 +241,11 @@ namespace GunsAndPuns void decrementNumber() { currentAmunitionsNumber--; + shots++; initCurTexture(); } - void setParams(const GLfloat _width, const GLfloat _height, + void __fastcall setParams(const GLfloat _width, const GLfloat _height, const GLfloat _cx, const GLfloat _cy, const GLfloat _cz) { height = _height; @@ -254,7 +262,7 @@ namespace GunsAndPuns std::vector fileNames; TImage curImage; - size_t currentAmunitionsNumber{ 10U }; + size_t currentAmunitionsNumber, shots; GLfloat width, height, cx, cy, cz; }; @@ -273,9 +281,11 @@ namespace GunsAndPuns FINISH }; - void init(const std::vector & textures); + TLevels(); + + void __fastcall init(const std::vector & textures); void reInit(); - bool collisionCheck(const GLfloat x, const GLfloat y, size_t& scores, TBullet& bullet); + bool __fastcall collisionCheck(const GLfloat x, const GLfloat y, size_t& scores, TBullet& bullet); void draw() const override; void __fastcall move(const size_t dtMs) override; @@ -289,8 +299,8 @@ namespace GunsAndPuns private: - TGround ground; TScene scene; + TGround ground; // Level 1 TTarget appleTarget; @@ -302,7 +312,7 @@ namespace GunsAndPuns TTarget rightTarget; TTarget lemonTarget; - TLevelNum level{ TLevelNum::FIRST }; + TLevelNum level; }; diff --git a/SourceCode/GunsAndPans/Textures/ImageStart1.bmp b/SourceCode/GunsAndPans/Textures/ImageStart1.bmp index 77de2e6..71ccd0d 100644 Binary files a/SourceCode/GunsAndPans/Textures/ImageStart1.bmp and b/SourceCode/GunsAndPans/Textures/ImageStart1.bmp differ diff --git a/SourceCode/x64/Debug/GunsAndPans.exe b/SourceCode/x64/Debug/GunsAndPans.exe index cab7655..321bf51 100644 Binary files a/SourceCode/x64/Debug/GunsAndPans.exe and b/SourceCode/x64/Debug/GunsAndPans.exe differ diff --git a/SourceCode/x64/Release/GunsAndPans.exe b/SourceCode/x64/Release/GunsAndPans.exe index f6b08a7..62f2884 100644 Binary files a/SourceCode/x64/Release/GunsAndPans.exe and b/SourceCode/x64/Release/GunsAndPans.exe differ