#pragma once
#include "common.h"
#include <string>
#include <control/gamepad.hpp>

#define INPUT_UP 0
#define INPUT_DOWN 1
#define INPUT_LEFT 2
#define INPUT_RIGHT 3

#define INPUT_FIRE 4
#define INPUT_FLIP 5
#define INPUT_RESTART 6

class Input
{
private:
    control::Gamepad **gamepads;
    uint8_t *gamepadsConnected;
    uint8_t *buttonsState, *oldButtonsState;
    uint8_t controlState[7], oldControlState[7];
public:

    Input();
    ~Input();

    void Update();

    bool IsGamepadPresent(uint32_t number) const noexcept;
    const control::Gamepad *GetGamepad(uint32_t number) const noexcept;

    bool IsButtonPressed(uint32_t button);
    bool IsButtonJustPressed(uint32_t button);

    bool IsControlPressed(uint32_t button) const noexcept;
    bool IsControlJustPressed(uint32_t button) const noexcept;
};

