This repository has been archived on 2026-04-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Tortuga/server/player.hpp
T

40 lines
1.1 KiB
C++

#ifndef PLAYER_HPP_
#define PLAYER_HPP_
#include "vector2.hpp"
#include <string>
class Player {
public:
Player() = default;
Player(int playerID, int channel, std::string handle, std::string avatar);
void Update(int delta);
int SetPlayerID(int id) {return playerID = id;}
int GetPlayerID() const {return playerID;}
int SetChannel(int ch) {return channel = ch;}
int GetChannel() const {return channel;}
Vector2 SetPosition(Vector2 v) {return position = v;}
Vector2 ShiftPosition(Vector2 v) {return position += v;}
Vector2 GetPosition() const {return position;}
Vector2 SetMotion(Vector2 v) {return motion = v;}
Vector2 ShiftMotion(Vector2 v) {return motion += v;}
Vector2 GetMotion() const {return motion;}
std::string SetHandle(std::string s) {return handle = s;}
std::string GetHandle() const {return handle;}
std::string SetAvatar(std::string s) {return avatar = s;}
std::string GetAvatar() const {return avatar;}
private:
int playerID = -1;
int channel = -1; //for networking
Vector2 position;
Vector2 motion;
std::string handle;
std::string avatar;
};
#endif