-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtouchEvent.html
More file actions
56 lines (47 loc) · 1.64 KB
/
touchEvent.html
File metadata and controls
56 lines (47 loc) · 1.64 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name = "viewport" content = "width = device-width , user-scalable = no">
<title>Title</title>
<link rel = "stylesheet" media = "screen and (-webkit-device-pixel-ratio:1.5)" href="hdpi.css"/>
<link rel = "stylesheet" media = "screen and (-webkit-device-pixel-ratio:1.0)" href="mdpi.css"/>
<script src="https://hammerjs.github.io/dist/hammer.js"></script>
<script src="http://canvasengine.net/cdn/canvasengine-latest.all.min.js"></script>
</head>
<body>
<div id="gameArea">
<!-- This is where the templates defined below will be used -->
<canvas id="myCanvas" width="500" height="500" style="border:1px solid #000000;">
</canvas>
</div>
<script>
var canvas = CE.defines("myCanvas").
ready(function() {
canvas.Scene.call("MyScene");
});
canvas.Scene.new({
name: "MyScene",
ready: function(stage) {
var el = this.createElement();
el.fillStyle = "red";
el.fillRect(0, 0, 100, 100);
el.on("dragleft", function(e, mouse) {
this.x = e.gesture.deltaX;
this.y = e.gesture.deltaY;
console.log(e.type+" gesture detected");
});
el.on("dragright", function(e, mouse) {
this.x = e.gesture.deltaX;
this.y = e.gesture.deltaY;
console.log(e.type+" gesture detected");
});
el.on("tap",function(e,mouse){
console.log(e.type+" gesture detected");
});
stage.append(el);
}
});
</script>
</body>
</html>