-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.html
More file actions
126 lines (116 loc) · 3.76 KB
/
controller.html
File metadata and controls
126 lines (116 loc) · 3.76 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<html>
<head>
<script type="text/javascript"
src="https://www.airconsole.com/api/airconsole-1.3.0.js"></script>
<script type="text/javascript">
navigator.vibrate = (navigator.vibrate ||
navigator.webkitVibrate ||
navigator.mozVibrate ||
navigator.msVibrate);
var airconsole;
/**
* Sets up the communication to the screen.
*/
function init() {
airconsole = new AirConsole({"orientation": "portrait"});
/*
* Checks if this device is part of the active game.
*/
airconsole.onActivePlayersChange = function(player) {
var div = document.getElementById("player_id");
if (player !== undefined) {
div.innerHTML = (["Left Player", "Right Player"][player]);
} else {
div.innerHTML = "It's a 2 player game!";
}
};
/*
* Makes the device vibrate if the screen says so.
*/
airconsole.onMessage = function(from, data) {
if (from == AirConsole.SCREEN && data.vibrate) {
navigator.vibrate(data.vibrate);
console.log("Vibrating: " + data.vibrate);
}
};
}
/**
* Tells the screen to move the paddle of this player.
* @param amount
*/
function move(amount) {
airconsole.message(AirConsole.SCREEN, {move: amount})
}
</script>
<style type="text/css">
@font-face {
text-align: center;
}
html, body {
height: 100%;
margin: 0px;
font-family: 'PressStart2P', sans-serif;
color: white;
text-align: center;
background-color: 222222;
}
.button {
display: inline-block;
height: auto;
width: 30%;
background-color: #222;
position: relative;
}
.button_label1 {
left: 2px;
width: 100%;
height: auto;
}
img {
left: 2px;
width:100%;
height: auto;
}
h1{
color:white;
}
#player_id {
position: absolute;
top: 50%;
left: 0%;
width: 100%;
margin-top: -8px;
color: #777;
}
</style>
</head>
<body onload="init()">
<div style="height: 1%"></div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="Jerry's Nugget blue\Clubs 5.png"></img></div>
</div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="Jerry's Nugget blue\Clubs 11.png"></img></div>
</div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="Jerry's Nugget blue\Clubs 1.png"></img></div>
</div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="Jerry's Nugget blue\Hearts 11.png"></img></div>
</div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="Jerry's Nugget blue\Diamonds 13.png"></img></div>
</div>
<div style="height: 10%"></div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="redgradientleft.png"></img></div>
</div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="center.png"></img></div>
</div>
<div class=button ontouchstart="move(-50)" ontouchend="move(0)" onmousedown="move(-50)" onmouseup="move(0)">
<div class="button_label1"><img src="redgradient.png"></img></div>
</div>
<h1> Player: Blue </h1>
</body>
</html>