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

#define INPUT_MENU 0
#define INPUT_BACK 1

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

    vec2d cursor;

    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) const noexcept;
    bool IsButtonJustPressed(uint32_t button) const noexcept;
    bool IsButtonJustReleased(uint32_t button) const noexcept;

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

