A bit of an architectural change before we progress further. Moved player code into a shared PlayerBass class to elimnate some severe code duplication while i was getting things working.
19 lines
604 B
C++
19 lines
604 B
C++
#include "player.h"
|
|
#include <cmath>
|
|
#include "bettola/game/player_base.h"
|
|
#include "bettola/math/vec3.h"
|
|
#include "bettola/network/player_input_message.h"
|
|
|
|
Player::Player(void) :
|
|
PlayerBase(),
|
|
_width(50.0f),
|
|
_height(50.0f) {}
|
|
|
|
void Player::apply_input(const BettolaLib::Network::PlayerInputMessage& input) {
|
|
/* Server side replay doesn't have a camera. use a default forward vector. */
|
|
BettolaMath::Vec3 face_cam_front = { 0.0f, 0.0f, -1.0f };
|
|
InputState state = { input.up, input.down, input.left, input.right };
|
|
set_velocity_direction(state, face_cam_front);
|
|
update(input.dt);
|
|
}
|