refactoring
parent
e8a9589114
commit
d3fbaa0418
|
@ -10,10 +10,10 @@ add_executable(${CMAKE_PROJECT_NAME}
|
||||||
Source.cpp
|
Source.cpp
|
||||||
Player.cpp
|
Player.cpp
|
||||||
Player.h
|
Player.h
|
||||||
ShooterClient.cpp
|
network/ShooterClient.cpp
|
||||||
ShooterClient.h
|
network/ShooterClient.h
|
||||||
ShooterServer.cpp
|
network/ShooterServer.cpp
|
||||||
ShooterServer.h
|
network/ShooterServer.h
|
||||||
weapon/Weapon.cpp
|
weapon/Weapon.cpp
|
||||||
weapon/Weapon.h
|
weapon/Weapon.h
|
||||||
weapon/Ak47.h
|
weapon/Ak47.h
|
||||||
|
@ -26,8 +26,8 @@ add_executable(${CMAKE_PROJECT_NAME}
|
||||||
Shooter.cpp
|
Shooter.cpp
|
||||||
Shooter.h
|
Shooter.h
|
||||||
ShooterConsts.h
|
ShooterConsts.h
|
||||||
ShooterMsgType.h
|
network/ShooterMsgType.h
|
||||||
ShooterMsgType.cpp
|
network/ShooterMsgType.cpp
|
||||||
# 3d engine:
|
# 3d engine:
|
||||||
engine/Consts.h
|
engine/Consts.h
|
||||||
engine/math/Vec4D.h
|
engine/math/Vec4D.h
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "PlayerController.h"
|
#include "PlayerController.h"
|
||||||
#include "engine/gui/Window.h"
|
#include "engine/gui/Window.h"
|
||||||
|
|
||||||
#include "ShooterClient.h"
|
#include "network/ShooterClient.h"
|
||||||
#include "ShooterServer.h"
|
#include "network/ShooterServer.h"
|
||||||
|
|
||||||
|
|
||||||
class Shooter final : public Engine {
|
class Shooter final : public Engine {
|
||||||
|
|
|
@ -169,10 +169,15 @@ void Engine::printDebugInfo() const {
|
||||||
static_cast<sf::Uint8>(255.0 * (1.0 - static_cast<double>(width) / timerWidth)),
|
static_cast<sf::Uint8>(255.0 * (1.0 - static_cast<double>(width) / timerWidth)),
|
||||||
0, 100});
|
0, 100});
|
||||||
|
|
||||||
|
std::string fps;
|
||||||
|
if(timer.elapsedSeconds() > 0) {
|
||||||
|
fps = std::to_string((int) (1.0 / timer.elapsedSeconds()));
|
||||||
|
} else {
|
||||||
|
fps = "inf";
|
||||||
|
}
|
||||||
|
|
||||||
screen->drawText(
|
screen->drawText(
|
||||||
timerName.substr(2, timerName.size()) + ":\t" +
|
timerName.substr(2, timerName.size()) + ":\t" + fps + " / s \t (" +
|
||||||
std::to_string((int) (1.0 / timer.elapsedSeconds())) + " / s \t (" +
|
|
||||||
std::to_string((int) (100 * timer.elapsedSeconds() / totalTime)) + "%)",
|
std::to_string((int) (100 * timer.elapsedSeconds() / totalTime)) + "%)",
|
||||||
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
||||||
sf::Color(0, 0, 0, 150));
|
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)),
|
static_cast<sf::Uint8>(255.0 * (1.0 - static_cast<double>(width) / timerWidth)),
|
||||||
0, 100});
|
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)) + "%)",
|
std::to_string((int) (100 * (totalTime - timeSum) / totalTime)) + "%)",
|
||||||
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
Vec2D{xPos + 10, yPos + height * i + 5}, 30,
|
||||||
sf::Color(0, 0, 0, 150));
|
sf::Color(0, 0, 0, 150));
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
#include "ShooterClient.h"
|
#include "ShooterClient.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "engine/utils/Log.h"
|
#include "../engine/utils/Log.h"
|
||||||
#include "engine/animation/Timeline.h"
|
#include "../engine/animation/Timeline.h"
|
||||||
#include "ShooterMsgType.h"
|
#include "ShooterMsgType.h"
|
||||||
#include "engine/animation/Animations.h"
|
#include "../engine/animation/Animations.h"
|
||||||
|
|
||||||
void ShooterClient::updatePacket() {
|
void ShooterClient::updatePacket() {
|
||||||
sf::Packet packet;
|
sf::Packet packet;
|
|
@ -5,8 +5,8 @@
|
||||||
#ifndef SHOOTER_SHOOTERCLIENT_H
|
#ifndef SHOOTER_SHOOTERCLIENT_H
|
||||||
#define SHOOTER_SHOOTERCLIENT_H
|
#define SHOOTER_SHOOTERCLIENT_H
|
||||||
|
|
||||||
#include "engine/network/ClientUDP.h"
|
#include "../engine/network/ClientUDP.h"
|
||||||
#include "Player.h"
|
#include "../Player.h"
|
||||||
|
|
||||||
class ShooterClient final : public ClientUDP {
|
class ShooterClient final : public ClientUDP {
|
||||||
private:
|
private:
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "ShooterServer.h"
|
#include "ShooterServer.h"
|
||||||
#include "engine/utils/Log.h"
|
#include "../engine/utils/Log.h"
|
||||||
#include "ShooterMsgType.h"
|
#include "ShooterMsgType.h"
|
||||||
|
|
||||||
void ShooterServer::broadcast() {
|
void ShooterServer::broadcast() {
|
|
@ -5,8 +5,8 @@
|
||||||
#ifndef SHOOTER_SHOOTERSERVER_H
|
#ifndef SHOOTER_SHOOTERSERVER_H
|
||||||
#define SHOOTER_SHOOTERSERVER_H
|
#define SHOOTER_SHOOTERSERVER_H
|
||||||
|
|
||||||
#include "engine/network/ServerUDP.h"
|
#include "../engine/network/ServerUDP.h"
|
||||||
#include "Player.h"
|
#include "../Player.h"
|
||||||
|
|
||||||
struct BonusInfo final {
|
struct BonusInfo final {
|
||||||
const Vec3D position{};
|
const Vec3D position{};
|
Loading…
Reference in New Issue