58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
/*
|
|
* PlayerController.h
|
|
*
|
|
* Created on: Nov 27, 2016
|
|
* Author: tibi
|
|
*/
|
|
|
|
#ifndef CONTROLLER_PLAYERCONTROLLER_H_
|
|
#define CONTROLLER_PLAYERCONTROLLER_H_
|
|
|
|
#include <components/basic/Transform.h>
|
|
#include <components/items/Weapon.h>
|
|
#include <model/Component.h>
|
|
#include <model/Direction.h>
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
#define MAX_INVENTORY_SIZE 50
|
|
|
|
namespace farmlands {
|
|
namespace components {
|
|
namespace player {
|
|
|
|
class PlayerInventory;
|
|
|
|
class PlayerMovement : public model::Component
|
|
{
|
|
public:
|
|
PlayerMovement();
|
|
virtual ~PlayerMovement();
|
|
|
|
virtual model::Component* clone() override;
|
|
virtual void dump(unsigned level) override;
|
|
|
|
virtual void onInitialize() override;
|
|
virtual void onUpdateLogic() override;
|
|
virtual void onPreRender() override;
|
|
|
|
model::Direction facingDirection;
|
|
bool walking, running;
|
|
|
|
private:
|
|
static model::Direction getDirection(float vx, float vy);
|
|
bool canMove(float x, float y);
|
|
|
|
// Movement
|
|
basic::Transform* m_transform;
|
|
|
|
// For getting speed
|
|
PlayerInventory* m_inventory;
|
|
};
|
|
|
|
}
|
|
} /* namespace components */
|
|
} /* namespace farmlands */
|
|
|
|
#endif /* CONTROLLER_PLAYERCONTROLLER_H_ */
|