fencer/game/src/Player.h

70 lines
1.6 KiB
C

#ifndef FIGHT_PLAYER_H
#define FIGHT_PLAYER_H
#include "state_machine.h"
#include "mirror.h"
#include "behaviour_entity.h"
#include "animation_sprite.h"
#include "vmath.h"
#include "transform.h"
#include "player_input.h"
#include "rigidbody.h"
#include "collider.h"
#include "typeclass_helpers.h"
extern const Vector PLAYER_SPEED;
typedef struct Player {
Transform transform;
RigidBody* rigidbody;
Collider* physicsCollider;
PlayerInput* playerInput;
Vector moveInput;
int attackInput;
size_t animationTriggers;
int facing;
Sprite* sprite;
AnimationSprite* idle;
AnimationSprite* walk;
AnimationSprite* jab_a;
AnimationSprite* jab_b;
StateMachine* animationStateMachine;
AnimationSprite* currentAnimation;
} Player;
Player* MakePlayer();
Player* SpawnPlayer(Vector location);
void DestroyPlayer(Player* self);
void PlayerHorizontalInput(Player* self, InputEvent value);
void PlayerVerticalInput(Player* self, InputEvent value);
void PlayerAttackInput(Player* self, InputEvent value);
void PlayerStart(Player* self);
void PlayerUpdate(Player* self, float deltaTime);
void PlayerDraw(Player* self);
Transform* PlayerGetTransform(Player* self);
RigidBody* PlayerGetRigidBody(Player* self);
void PlayerOnCollision(Player* self, Collision collision);
void PlayerOnOverlap(Player* self, Collider* other);
static long PlayerGetDepth(Player* self) { return (int)(-10-self->transform.position.y * 1000); }
DECL_REFLECT(Player);
decl_typeclass_impl(BehaviourEntity, Player)
decl_typeclass_impl(Drop, Player)
decl_typeclass_impl(Transformable, Player)
decl_typeclass_impl(PhysicsEntity, Player)
#endif // !FIGHT_PLAYER_H