GPR5100 - Rollback
Loading...
Searching...
No Matches
Typedefs | Enumerations | Variables
game_globals.h File Reference
#include <SFML/Graphics/Color.hpp>
#include <array>
#include "engine/component.h"
#include "engine/entity.h"
#include "graphics/color.h"
#include "maths/angle.h"
#include "maths/vec2.h"
Include dependency graph for game_globals.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

using game::PlayerNumber = std::uint8_t
 PlayerNumber is a type used to define the number of the player. Starting from 0 to maxPlayerNmb.
 
using game::Frame = std::uint32_t
 
using game::PlayerInput = std::uint8_t
 PlayerInput is a type defining the input data from a player.
 

Enumerations

enum class  game::ClientId : std::uint16_t
 ClientId is a type used to define the client identification. It is given by the server to clients.
 
enum class  ComponentType : core::EntityMask {
  PLAYER_CHARACTER = static_cast<core::EntityMask>(core::ComponentType::OTHER_TYPE) , BULLET = static_cast<core::EntityMask>(core::ComponentType::OTHER_TYPE) << 1u , ASTEROID = static_cast<core::EntityMask>(core::ComponentType::OTHER_TYPE) << 2u , PLAYER_INPUT = static_cast<core::EntityMask>(core::ComponentType::OTHER_TYPE) << 3u ,
  DESTROYED = static_cast<core::EntityMask>(core::ComponentType::OTHER_TYPE) << 4u
}
 
enum  PlayerInput : std::uint8_t {
  NONE = 0u , UP = 1u << 0u , DOWN = 1u << 1u , LEFT = 1u << 2u ,
  RIGHT = 1u << 3u , SHOOT = 1u << 4u
}
 

Variables

constexpr auto game::INVALID_PLAYER = std::numeric_limits<PlayerNumber>::max()
 INVALID_PLAYER is an integer constant that defines an invalid player number.
 
constexpr auto game::INVALID_CLIENT_ID = ClientId{ 0 }
 
constexpr std::uint32_t game::maxPlayerNmb = 2
 mmaxPlayerNmb is a integer constant that defines the maximum number of player per game
 
constexpr short game::playerHealth = 5
 
constexpr float game::playerSpeed = 1.0f
 
constexpr core::Degree game::playerAngularSpeed = core::Degree(90.0f)
 
constexpr float game::playerShootingPeriod = 0.3f
 
constexpr float game::bulletSpeed = 2.0f
 
constexpr float game::bulletScale = 0.2f
 
constexpr float game::bulletPeriod = 3.0f
 
constexpr float game::playerInvincibilityPeriod = 1.5f
 
constexpr float game::invincibilityFlashPeriod = 0.5f
 
constexpr std::size_t game::windowBufferSize = 5u * 50u
 windowBufferSize is the size of input stored by a client. 5 seconds of frame at 50 fps
 
constexpr long long game::startDelay = 3000
 startDelay is the delay to wait before starting a game in milliseconds
 
constexpr std::size_t game::maxInputNmb = 50
 maxInputNmb is the number of inputs stored into an PlayerInputPacket
 
constexpr float game::fixedPeriod = 0.02f
 fixedPeriod is the period used in seconds to start a new FixedUpdate method in the game::GameManager
 
constexpr std::array< core::Color, std::max(4u, maxPlayerNmb)> game::playerColors
 
constexpr std::array< core::Vec2f, std::max(4u, maxPlayerNmb)> game::spawnPositions
 
constexpr std::array< core::Degree, std::max(4u, maxPlayerNmb)> game::spawnRotations
 

Variable Documentation

◆ playerColors

constexpr std::array<core::Color, std::max(4u, maxPlayerNmb)> game::playerColors
constexpr
Initial value:
{
core::Color::red(),
core::Color::blue(),
core::Color::yellow(),
core::Color::cyan()
}

◆ spawnPositions

constexpr std::array<core::Vec2f, std::max(4u, maxPlayerNmb)> game::spawnPositions
constexpr
Initial value:
{
core::Vec2f(0,-1),
core::Vec2f(-1,0),
}
Vec2f is a utility class that represents a mathematical 2d vector.
Definition: vec2.h:12

◆ spawnRotations

constexpr std::array<core::Degree, std::max(4u, maxPlayerNmb)> game::spawnRotations
constexpr
Initial value:
{
core::Degree(0.0f),
core::Degree(180.0f),
core::Degree(-90.0f),
core::Degree(90.0f)
}
Degree is an utility class that describes degree angles (0 to 360). It can be easily converted to Rad...
Definition: angle.h:56