-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathctrl.html
executable file
·39 lines (36 loc) · 1.33 KB
/
ctrl.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<html>
<head>
<script type="text/javascript" src="ctrl/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="ctrl/js/underscore-min.js"></script>
<script type="text/javascript" src="ctrl/js/backbone-min.js"></script>
<script type="text/javascript" src="ctrl/js/joystick_view.js"></script>
</head>
<body>
<script type="text/html" id="joystick-view">
<canvas id="joystickCanvas" width="<%= squareSize %>" height="<%= squareSize %>" style="width: <%= squareSize %>px; height: <%= squareSize %>px;">
</canvas>
</script>
<div id="joystickContent">
</div>
<div>
x: <span id="xVal"></span><br/>
y: <span id="yVal"></span><br/>
</div>
<script type="text/javascript">
$(document).ready(function(){
var joystickView = new JoystickView(150, function(callbackView){
$("#joystickContent").append(callbackView.render().el);
setTimeout(function(){
callbackView.renderSprite();
}, 0);
});
joystickView.bind("verticalMove", function(y){
$("#yVal").html(y);
});
joystickView.bind("horizontalMove", function(x){
$("#xVal").html(x);
});
});
</script>
</body>
</html>