#pragma once
#include "EngineFrame/Base/BaseNode.h"
#include "Tool/Common.h"
class CharacterObject;
class Chr_Controller : public BaseNode
{
private:
    CharacterObject *m_pCharacter = nullptr;

public:
    Vec2 LeftStick = {0.f, 0.f};
    Vec2 RightStick = {0.f, 0.f};

    // 用于将SDL的轴值(-32768到32767)转换为-1到1之间的浮点数
    float ConvertAxisValue(Sint16 rawValue);

public:
    void Init(CharacterObject *pCharacter);
    void HandleEvents(SDL_Event *e) override;

    // 获取摇杆位置的方法
    const Vec2 &GetLeftStick() const { return LeftStick; }
    const Vec2 &GetRightStick() const { return RightStick; }
};
