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/client/player.hpp
T

37 lines
831 B
C++

#ifndef PLAYER_HPP_
#define PLAYER_HPP_
#include "defines.hpp"
#include "vector2.hpp"
#include "sprite_sheet.hpp"
#include "SDL/SDL.h"
class Player {
public:
Player(SDL_Surface*, int w, int h);
void Update(double delta);
void WalkInDirection(Direction);
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; }
void DrawTo(SDL_Surface* const s) { sprite.DrawTo(s, position.x, position.y); }
void FaceDirection(Direction);
SpriteSheet* GetSpriteSheet() { return &sprite; };
private:
Vector2 position;
Vector2 motion;
SpriteSheet sprite;
};
#endif