This code works with "ESP WROOM-32 devKIT". Not sure for others. Once you connect your esp32, your device will recognize this esp32 as "HID-compliant touch screen".
I tested on my laptop, it works fine. With android, some are ok, some are not working.