VOX
A little voxel engine
Loading...
Searching...
No Matches
Player Class Reference

#include <Player.hpp>

Collaboration diagram for Player:
Collaboration graph

Public Types

enum class  GameMode { SURVIVAL , CREATIVE , SPECTATOR }
 
enum class  ViewMode { FIRST_PERSON , THIRD_PERSON_BACK }
 

Public Member Functions

 Player ()
 
 ~Player ()
 
 Player (Player &other)=delete
 
 Player (Player &&other)=delete
 
Playeroperator= (Player &other)=delete
 
Playeroperator= (Player &&other)=delete
 
void moveDirection (double x_offset, double y_offset)
 
Camera camera () const
 
glm::dvec3 getTransformedMovement (glm::dvec3 move) const
 
glm::dvec3 cameraPosition () const
 
glm::dvec3 direction () const
 
bool shouldCollide () const
 
bool shouldFall () const
 
bool isFlying () const
 
bool canJump () const
 
void startJump ()
 
void startFall ()
 
double fallDuration ()
 
bool canAttack () const
 
void startAttack ()
 
bool canUse () const
 
void startUse ()
 
 TracyLockableN (std::mutex, mutex, "Player internal")
 

Public Attributes

enum Player::GameMode gameMode = GameMode::SPECTATOR
 
enum Player::ViewMode view_mode = ViewMode::FIRST_PERSON
 
double default_speed = 4.0
 
double sprint_speed_factor = 1.5
 
double sneak_speed_factor = 0.3
 
double fly_speed_factor = 3.0
 
double jump_speed_factor = 1.1
 
double jump_force = 10.0
 
double gravity = -30.0
 
bool on_ground = false
 
bool flying = false
 
bool sneaking = false
 
bool sprinting = false
 
bool jumping = false
 
bool swimming = false
 
BlockInfo::Type ground_block = BlockInfo::Type::Air
 
Transform transform = Transform({0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {1.0, 1.0, 1.0})
 
HitBox hitbox = HitBox({-0.3, 0, -0.3}, {0.6, 1.8, 0.6})
 
HitBox feet = HitBox({-0.3, -0.01, -0.3}, {0.6, 0.1, 0.6})
 
glm::dvec3 velocity = glm::dvec3(0.0)
 
int jump_remaining = 1
 
glm::dvec3 eye_position = glm::dvec3(0.0, 1.6, 0.0)
 
double yaw = 0.0
 
double pitch = 0.0
 
RayCastOnBlockResult targeted_block {false, glm::vec3(0.0), glm::vec3(0.0), glm::vec3(0.0), BlockInfo::Type::Air, false}
 
uint64_t connection_id = 0
 
uint64_t player_id = 0
 
uint64_t player_ticket_id = 0
 
std::array< ItemInfo::Type, 9 > toolbar_items
 
int toolbar_cursor = 0
 

Member Enumeration Documentation

◆ GameMode

enum class Player::GameMode
strong
Enumerator
SURVIVAL 
CREATIVE 
SPECTATOR 

◆ ViewMode

enum class Player::ViewMode
strong
Enumerator
FIRST_PERSON 
THIRD_PERSON_BACK 

Constructor & Destructor Documentation

◆ Player() [1/3]

Player::Player ( )

◆ ~Player()

Player::~Player ( )

◆ Player() [2/3]

Player::Player ( Player other)
delete

◆ Player() [3/3]

Player::Player ( Player &&  other)
delete

Member Function Documentation

◆ camera()

Camera Player::camera ( ) const

◆ cameraPosition()

glm::dvec3 Player::cameraPosition ( ) const

◆ canAttack()

bool Player::canAttack ( ) const

◆ canJump()

bool Player::canJump ( ) const

◆ canUse()

bool Player::canUse ( ) const

◆ direction()

glm::dvec3 Player::direction ( ) const

◆ fallDuration()

double Player::fallDuration ( )

◆ getTransformedMovement()

glm::dvec3 Player::getTransformedMovement ( glm::dvec3  move) const

◆ isFlying()

bool Player::isFlying ( ) const

◆ moveDirection()

void Player::moveDirection ( double  x_offset,
double  y_offset 
)

◆ operator=() [1/2]

Player & Player::operator= ( Player &&  other)
delete

◆ operator=() [2/2]

Player & Player::operator= ( Player other)
delete

◆ shouldCollide()

bool Player::shouldCollide ( ) const

◆ shouldFall()

bool Player::shouldFall ( ) const

◆ startAttack()

void Player::startAttack ( )

◆ startFall()

void Player::startFall ( )

◆ startJump()

void Player::startJump ( )

◆ startUse()

void Player::startUse ( )

◆ TracyLockableN()

Player::TracyLockableN ( std::mutex  ,
mutex  ,
"Player internal"   
)

Member Data Documentation

◆ connection_id

uint64_t Player::connection_id = 0

◆ default_speed

double Player::default_speed = 4.0

◆ eye_position

glm::dvec3 Player::eye_position = glm::dvec3(0.0, 1.6, 0.0)

◆ feet

HitBox Player::feet = HitBox({-0.3, -0.01, -0.3}, {0.6, 0.1, 0.6})

◆ fly_speed_factor

double Player::fly_speed_factor = 3.0

◆ flying

bool Player::flying = false

◆ gameMode

enum Player::GameMode Player::gameMode = GameMode::SPECTATOR

◆ gravity

double Player::gravity = -30.0

◆ ground_block

BlockInfo::Type Player::ground_block = BlockInfo::Type::Air

◆ hitbox

HitBox Player::hitbox = HitBox({-0.3, 0, -0.3}, {0.6, 1.8, 0.6})

◆ jump_force

double Player::jump_force = 10.0

◆ jump_remaining

int Player::jump_remaining = 1

◆ jump_speed_factor

double Player::jump_speed_factor = 1.1

◆ jumping

bool Player::jumping = false

◆ on_ground

bool Player::on_ground = false

◆ pitch

double Player::pitch = 0.0

◆ player_id

uint64_t Player::player_id = 0

◆ player_ticket_id

uint64_t Player::player_ticket_id = 0

◆ sneak_speed_factor

double Player::sneak_speed_factor = 0.3

◆ sneaking

bool Player::sneaking = false

◆ sprint_speed_factor

double Player::sprint_speed_factor = 1.5

◆ sprinting

bool Player::sprinting = false

◆ swimming

bool Player::swimming = false

◆ targeted_block

RayCastOnBlockResult Player::targeted_block {false, glm::vec3(0.0), glm::vec3(0.0), glm::vec3(0.0), BlockInfo::Type::Air, false}

◆ toolbar_cursor

int Player::toolbar_cursor = 0

◆ toolbar_items

◆ transform

Transform Player::transform = Transform({0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {1.0, 1.0, 1.0})

◆ velocity

glm::dvec3 Player::velocity = glm::dvec3(0.0)

◆ view_mode

enum Player::ViewMode Player::view_mode = ViewMode::FIRST_PERSON

◆ yaw

double Player::yaw = 0.0

The documentation for this class was generated from the following files: