Player.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include "Entity.h"
  3. #include "EntityType.h"
  4. class PlayerEntityType;
  5. class Player : public Entity
  6. {
  7. public:
  8. class Key
  9. {
  10. public:
  11. const static __int64 MOVE_FRONT = 0x1;
  12. const static __int64 MOVE_BACK = 0x2;
  13. const static __int64 MOVE_LEFT = 0x4;
  14. const static __int64 MOVE_RIGHT = 0x8;
  15. const static __int64 MOVE_UP = 0x10;
  16. const static __int64 MOVE_DOWN = 0x20;
  17. const static __int64 ROTATE_LEFT = 0x40;
  18. const static __int64 ROTATE_RIGHT = 0x80;
  19. };
  20. private:
  21. Framework::Text name;
  22. __int64 keyState;
  23. public:
  24. Player( Framework::Vec3<float> location, int dimensionId, int entityId );
  25. void setName( Framework::Text name );
  26. const char* getName() const;
  27. void tick( const Dimension* zDimension, Game* zGame ) override;
  28. void api( Framework::StreamReader* zRequest, NetworkResponse* zResponse ) override;
  29. friend PlayerEntityType;
  30. };
  31. class PlayerEntityType : public EntityType
  32. {
  33. REGISTRABLE( PlayerEntityType )
  34. protected:
  35. virtual void loadSuperEntity( Entity* zEntity, Framework::StreamReader* zReader ) const override;
  36. virtual void saveSuperEntity( Entity* zEntity, Framework::StreamWriter* zWriter ) const override;
  37. public:
  38. PlayerEntityType();
  39. virtual Entity* createEntity( Framework::Vec3<float> position, int dimensionId, Game* zTarget, int entityId ) const override;
  40. };
  41. REGISTER( PlayerEntityType, EntityType )