From 099bb8bb4312d607689684a790c6cb18a66407bb Mon Sep 17 00:00:00 2001 From: Ostap <58697558+OldiLo@users.noreply.github.com> Date: Wed, 3 Nov 2021 18:22:14 +0200 Subject: [PATCH 1/2] Fix compilation error on arm64 linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit У меня без memory не собирался --- engine/animation/Timeline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/animation/Timeline.h b/engine/animation/Timeline.h index 1c207a7..782339e 100644 --- a/engine/animation/Timeline.h +++ b/engine/animation/Timeline.h @@ -4,7 +4,7 @@ #ifndef SHOOTER_TIMELINE_H #define SHOOTER_TIMELINE_H - +#include #include "Animation.h" class AnimationListTag final { From c12fcc857dfd0b3b99ceaa81eb2ecf260a9b77f5 Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Thu, 4 Nov 2021 13:05:21 +0700 Subject: [PATCH 2/2] HitBox added. acceleration of collision detection in 20 times. --- Source.cpp | 4 ++-- engine/Engine.cpp | 8 ++++---- engine/physics/HitBox.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source.cpp b/Source.cpp index 9c40cdf..372c41c 100644 --- a/Source.cpp +++ b/Source.cpp @@ -10,10 +10,10 @@ using namespace std; int main() { Shooter game; - //game.create(1280, 720, ShooterConsts::PROJECT_NAME); + game.create(1280, 720, ShooterConsts::PROJECT_NAME); //game.create(1920, 1080, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen); - game.create(2048, 1152, ShooterConsts::PROJECT_NAME, false); + //game.create(2048, 1152, ShooterConsts::PROJECT_NAME, true); //game.create(3072, 1920, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen); return 0; diff --git a/engine/Engine.cpp b/engine/Engine.cpp index 8883275..6deada2 100644 --- a/engine/Engine.cpp +++ b/engine/Engine.cpp @@ -162,7 +162,7 @@ void Engine::printDebugInfo() const { Vec2D{xPos, yPos + height + height * i}, {static_cast(255 * width / timerWidth), static_cast(255 * (1 - width / timerWidth)), - 0, 100}); + 0, 150}); screen->drawText( @@ -170,7 +170,7 @@ void Engine::printDebugInfo() const { std::to_string((int) (1.0 / timer.elapsedMilliseconds())) + " / s \t (" + std::to_string((int) (100 * timer.elapsedMilliseconds() / totalTime)) + "%)", Vec2D{xPos + 10, yPos + height * i + 5}, 30, - sf::Color(0, 0, 0, 100)); + sf::Color(0, 0, 0, 200)); i++; timeSum += timer.elapsedMilliseconds(); @@ -183,13 +183,13 @@ void Engine::printDebugInfo() const { Vec2D{xPos, yPos + height + height * i}, {static_cast(255 * width / timerWidth), static_cast(255 * (1 - width / timerWidth)), - 0, 100}); + 0, 150}); screen->drawText("other:\t" + std::to_string((int) (1.0 / (totalTime - timeSum))) + " / s \t (" + std::to_string((int) (100 * (totalTime - timeSum) / totalTime)) + "%)", Vec2D{xPos + 10, yPos + height * i + 5}, 30, - sf::Color(0, 0, 0, 100)); + sf::Color(0, 0, 0, 200)); } } diff --git a/engine/physics/HitBox.cpp b/engine/physics/HitBox.cpp index 54eaf72..7fa21dd 100644 --- a/engine/physics/HitBox.cpp +++ b/engine/physics/HitBox.cpp @@ -17,7 +17,7 @@ HitBox::HitBox(const Mesh &mesh) { void HitBox::_addIfUnique(const Vec3D &point) { bool addPoint = true; for(const auto& p : _hitBox) { - if((p - point).sqrAbs() < Consts::EPS) { + if(p == point) { addPoint = false; } }