refactoring

master
Vectozavr 2022-07-19 16:35:14 +07:00
parent e8a9589114
commit d3fbaa0418
9 changed files with 30 additions and 19 deletions

View File

@ -10,10 +10,10 @@ add_executable(${CMAKE_PROJECT_NAME}
Source.cpp
Player.cpp
Player.h
ShooterClient.cpp
ShooterClient.h
ShooterServer.cpp
ShooterServer.h
network/ShooterClient.cpp
network/ShooterClient.h
network/ShooterServer.cpp
network/ShooterServer.h
weapon/Weapon.cpp
weapon/Weapon.h
weapon/Ak47.h
@ -26,8 +26,8 @@ add_executable(${CMAKE_PROJECT_NAME}
Shooter.cpp
Shooter.h
ShooterConsts.h
ShooterMsgType.h
ShooterMsgType.cpp
network/ShooterMsgType.h
network/ShooterMsgType.cpp
# 3d engine:
engine/Consts.h
engine/math/Vec4D.h

View File

@ -11,8 +11,8 @@
#include "PlayerController.h"
#include "engine/gui/Window.h"
#include "ShooterClient.h"
#include "ShooterServer.h"
#include "network/ShooterClient.h"
#include "network/ShooterServer.h"
class Shooter final : public Engine {

View File

@ -169,10 +169,15 @@ void Engine::printDebugInfo() const {
static_cast<sf::Uint8>(255.0 * (1.0 - static_cast<double>(width) / timerWidth)),
0, 100});
std::string fps;
if(timer.elapsedSeconds() > 0) {
fps = std::to_string((int) (1.0 / timer.elapsedSeconds()));
} else {
fps = "inf";
}
screen->drawText(
timerName.substr(2, timerName.size()) + ":\t" +
std::to_string((int) (1.0 / timer.elapsedSeconds())) + " / s \t (" +
timerName.substr(2, timerName.size()) + ":\t" + fps + " / s \t (" +
std::to_string((int) (100 * timer.elapsedSeconds() / totalTime)) + "%)",
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
sf::Color(0, 0, 0, 150));
@ -190,8 +195,14 @@ void Engine::printDebugInfo() const {
static_cast<sf::Uint8>(255.0 * (1.0 - static_cast<double>(width) / timerWidth)),
0, 100});
std::string fps;
if(totalTime - timeSum > 0) {
fps = std::to_string((int) (1.0 / (totalTime - timeSum)));
} else {
fps = "inf";
}
screen->drawText("other:\t" + std::to_string((int) (1.0 / (totalTime - timeSum))) + " / s \t (" +
screen->drawText("other:\t" + fps + " / s \t (" +
std::to_string((int) (100 * (totalTime - timeSum) / totalTime)) + "%)",
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
sf::Color(0, 0, 0, 150));

View File

@ -5,10 +5,10 @@
#include "ShooterClient.h"
#include <utility>
#include "engine/utils/Log.h"
#include "engine/animation/Timeline.h"
#include "../engine/utils/Log.h"
#include "../engine/animation/Timeline.h"
#include "ShooterMsgType.h"
#include "engine/animation/Animations.h"
#include "../engine/animation/Animations.h"
void ShooterClient::updatePacket() {
sf::Packet packet;

View File

@ -5,8 +5,8 @@
#ifndef SHOOTER_SHOOTERCLIENT_H
#define SHOOTER_SHOOTERCLIENT_H
#include "engine/network/ClientUDP.h"
#include "Player.h"
#include "../engine/network/ClientUDP.h"
#include "../Player.h"
class ShooterClient final : public ClientUDP {
private:

View File

@ -3,7 +3,7 @@
//
#include "ShooterServer.h"
#include "engine/utils/Log.h"
#include "../engine/utils/Log.h"
#include "ShooterMsgType.h"
void ShooterServer::broadcast() {

View File

@ -5,8 +5,8 @@
#ifndef SHOOTER_SHOOTERSERVER_H
#define SHOOTER_SHOOTERSERVER_H
#include "engine/network/ServerUDP.h"
#include "Player.h"
#include "../engine/network/ServerUDP.h"
#include "../Player.h"
struct BonusInfo final {
const Vec3D position{};