#include "core/input/mouse.hpp"

namespace Mouse {

    static constexpr Uint32 HIDE_DELAY = 3000;  // Temps en ms per a amagar el cursor
    static Uint32 last_move_time = 0;
    static bool cursor_visible = true;

    void handleEvent(const SDL_Event& event) {
        if (event.type == SDL_EVENT_MOUSE_MOTION) {
            last_move_time = SDL_GetTicks();
            if (!cursor_visible) {
                SDL_ShowCursor();
                cursor_visible = true;
            }
        }
    }

    void updateCursorVisibility() {
        if (cursor_visible && (SDL_GetTicks() - last_move_time > HIDE_DELAY)) {
            SDL_HideCursor();
            cursor_visible = false;
        }
    }

}  // namespace Mouse
