Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (37 sloc) 1.26 KB
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="stylesheets/hud.css">
</head>
<body>
<div id="container"></div>
<div id="info">
<span id="result"></span>
</div>
<script src="javascripts/virtualjoystick.js"></script>
<script>
console.log("touchscreen is", VirtualJoystick.touchScreenAvailable() ? "available" : "not available");
var joystick = new VirtualJoystick({
container : document.getElementById('container'),
mouseSupport : true,
});
joystick.addEventListener('touchStart', function(){
console.log('down')
})
joystick.addEventListener('touchEnd', function(){
console.log('up')
})
setInterval(function(){
var outputEl = document.getElementById('result');
outputEl.innerHTML = ''
// + ' dx:'+joystick.deltaX()
// + ' dy:'+joystick.deltaY()
+ (joystick.right() ? ' right' : '')
+ (joystick.up() ? ' up' : '')
+ (joystick.left() ? ' left' : '')
+ (joystick.down() ? ' down' : '')
}, 1/30 * 1000);
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.