import { loadEvents } from '/js/events.js'
import { loadStatus } from '/js/status.js'
import { initCuteTexture } from '/js/cuteTexture.js'
import { makeItFloat } from '/js/floating.js';

// ======================================== events & statut d'ouverture
loadEvents();
loadStatus()
  .then((status) => {
    console.log("Status actuel du LOL", status);

    let cuteTexture = initCuteTexture({
      shaderSource: status.shaderSource
    });

    cuteTexture.target.style.visibility = "visible"
  });

// ======================================== floating message window

makeItFloat(document.querySelector('#msgWindow'));
makeItFloat(document.querySelector('#addUserWindow'));

/*
//================================ tentative de gestion des écran tactiles
startTarget.addEventListener('touchstart', (event) => {
  startX = event.pageX;
  startY = event.pageY;
  clicked = true;
  console.log('touching...')
})

document.addEventListener('touchmove', (event) => {
  if(clicked){
    console.log('moving...')
    let currentX = event.pageX;
    let currentY = event.pageY;
    let moveX = target.offsetLeft + currentX - startX;
    target.style.left =  moveX + 'px';
    let moveY = target.offsetTop + currentY - startY;
    target.style.top = moveY + 'px';
    startX = currentX;
    startY = currentY;
  }
});

document.addEventListener('touchend', () => {
  console.log('STOP !')
  clicked = false;
})
*/
