#pragma once #include #include "bettola/network/tcpsocket.h" class Player { public: Player(BettolaLib::Network::TCPSocket* socket); void update(double dt); void set_velocity_direction(float dir_x, float dir_y); void set_position(float x, float y) { _x = x; _y = y; } void set_udp_addr(const sockaddr_in& addr) { _udp_addr = addr; _has_udp_addr = true; } unsigned int get_id(void) const { return _id; } float get_x(void) const { return _x; } float get_y(void) const { return _y; } BettolaLib::Network::TCPSocket& get_socket(void) const { return *_socket; } const sockaddr_in& get_udp_addr(void) const { return _udp_addr; } bool has_udp_addr(void) const { return _has_udp_addr; } void set_last_processed_sequence(unsigned int sequence) { _last_processed_sequence = sequence; } unsigned int get_last_processed_sequence(void) const { return _last_processed_sequence; } private: static unsigned int _next_player_id; unsigned int _id; float _x; float _y; BettolaLib::Network::TCPSocket* _socket; sockaddr_in _udp_addr; bool _has_udp_addr; unsigned int _last_processed_sequence; float _vx, _vy; float _speed; };