-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller_LEFTnRIGHT.html
58 lines (51 loc) · 1.99 KB
/
controller_LEFTnRIGHT.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Controller</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,user-scalable=no" />
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<style>
body {font-family: Helvetica, Arial;}
#yes {display: none}
</style>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.21.6.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.dom.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="content">
<script>
var button1, button2;
function setup(){
button1 = createImg('left.png');
button1.size(windowWidth,(windowHeight/2)-10);
button1.position(0,0);
button1.mousePressed(lefty);
button2 = createImg('right.png');
button2.size(windowWidth,(windowHeight/2)+10);
button2.position(0, windowHeight/2);
button2.mousePressed(righty);
}
function draw(){}
function lefty (){
e = 3;
//console.log("yay!");
PUBNUB.publish({channel: 'ball', message: e});
}
function righty(){
e = 4;
PUBNUB.publish({channel: 'ball', message: e});
}
</script>
</div>
<script src="http://pubnub.s3.amazonaws.com/pubnub-3.0.min.js"
pub-key="pub-c-74eac257-c02f-445c-8878-1855324ab89f"
sub-key="sub-c-1a87f2fc-eb7f-11e8-ab71-96aca38ebf32"
ssl="off"
origin="pubsub.pubnub.com"
id="pubnub"
></script>
</body>
</html>