Thank you Gautier! That worked perfectly. Is that planned to be added to the official source? It seems like it should be.
Also, great job on the pasta game! Very well done! Is the source for that available? I'm looking to add some features that I notice you already have in yours, and I would be interested in seeing how you did that. In particular, I'd like to add a sound effect connected to a mouse event, and I'd like to fill the background of say a canvas object to a picture. Possibly even a video played back within a canvas or gui object? Regards, Brad ----- Original Message ----- > From: "Gautier de Montmollin" <[email protected]> > To: "gnoga-list" <[email protected]> > Sent: Sunday, January 13, 2019 4:45:42 PM > Subject: Re: [Gnoga-list] Touch screen support in Gnoga? > In the 2017 thread, it is not clear what needs to be changed, so here is > a result of "diff boot.js phyrama_boot.js" (you can see it in action @ > http://pasta.phyrama.com/ ): > > ***** > > 68a69,103 > > function touchHandler(event) > > { > > var touches = event.changedTouches, > > first = touches[0], > > type = ""; > > switch(event.type) > > { > > case "touchstart": type = "mousedown"; break; > > case "touchmove": type = "mousemove"; break; > > case "touchend": type = "mouseup"; break; > > default: return; > > } > > > > // initMouseEvent(type, canBubble, cancelable, view, clickCount, > > // screenX, screenY, clientX, clientY, ctrlKey, > > // altKey, shiftKey, metaKey, button, > relatedTarget); > > > > var simulatedEvent = document.createEvent("MouseEvent"); > > simulatedEvent.initMouseEvent(type, true, true, window, 1, > > first.screenX, first.screenY, > > first.clientX, first.clientY, false, > > false, false, false, 0/*left*/, > null); > > > > first.target.dispatchEvent(simulatedEvent); > > // event.preventDefault(); > > } > > > > function touch2mouseinit() > > { > > document.addEventListener("touchstart", touchHandler, true); > > document.addEventListener("touchmove", touchHandler, true); > > document.addEventListener("touchend", touchHandler, true); > > document.addEventListener("touchcancel", touchHandler, true); > > } > > > 91c126 > < console.log ("connecting to " + adr); > --- > > console.log ("Gnoga: connecting to " + adr); > 94c129 > < console.log ("trying again, connecting to " + adr); > --- > > console.log ("Gnoga: trying again, connecting to " + adr); > 100c135 > < console.log ("connection successful"); > --- > > console.log ("Gnoga: connection successful"); > 105c140 > < document.writeln ("If you are seeing this your browser or your > connection to the internet is blocking websockets."); > --- > > document.writeln ("Gnoga: if you are seeing this your browser > or your connection to the internet is blocking websockets."); > 107c142,146 > < }); > --- > > > > touch2mouseinit(); > > > > console.log ("Gnoga: ready."); > > }); > > > _______________________________________________ > Gnoga-list mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gnoga-list _______________________________________________ Gnoga-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gnoga-list
