Debian Codegraph @

src/host-web/webchuck/examples/globals1/index.html

raw symbols SCIP
1 <!doctype html>
2 <html lang="en-us">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>ChucK + JS => ChucKScript</title>
7 <link rel="stylesheet" href="../../css/editor.css">
8 </head>
9 <body onresize="chuckEditor.resize();">
10 <div>
11 <div id="program">// Globals 1: setting ints, floats, and broadcasting Events
12 global Event mouseClicked;
13 global int mouseX;
14 global float mouseY;
15 SinOsc foo => dac;
16 while( true )
17 {
18 300 + 0.3 * mouseX => foo.freq;
19 <<< foo.freq(), mouseX, mouseY >>>;
20 mouseClicked => now;
21 }
22 </div>
23 </div>
24 <div class="buttons">
25 <button class="chuckButton" id="startChuck" disabled="disabled">Start ChucK</button>
26 <button class="chuckButton" id="compileButton" disabled="disabled">Compile and Run</button>
27 <button class="chuckButton" id="replaceButton" disabled="disabled">Replace</button>
28 <button class="chuckButton" id="removeButton" disabled="disabled">Remove</button>
29 <button class="chuckButton" id="clearButton" disabled="disabled">Clear VM and Globals</button>
30 <button class="chuckButton" id="micButton" disabled="disabled">Enable Microphone</button>
31 <button class="chuckButton" id="fileFormButton">Show File Uploader</button>
32 </div>
33 <div id="fileForm" class="hidden">
34 <p>File name to use in ChucK: <input type="text" id="uploadFilename"></p>
35 <p>Local file to upload: <input type="file" id="uploadFile" name="uploadFile"></p>
36 <p><button class="chuckButton" id="fileButton" disabled="disabled">Upload File to Virtual File System</button></p>
37 </div>
38 <div>
39 <textarea id="output"></textarea>
40 <div id="shreds">
41 <table id="shredstable">
42 <col width="60px">
43 <col width="1*">
44 <col width="50px">
45 <col width="60px">
46 <tr><th>shred</th><th>code</th><th>time</th><th>remove</th>
47 </table>
48 </div>
49 <div class="clearfix"></div>
50 </div>
51 <script type="text/javascript" src="../../js/ace-min-noconflict/ace.js" charset="utf-8"></script>
52 <script type="text/javascript" src="../../js/editor.js"></script>
53 <script type="text/javascript" src="../../js/defer.js"></script>
54 <script>
55 // override
56 var whereIsChuck = "../../js";
57 </script>
58 <script type="text/javascript" src="../../js/webchuck_host.js"></script>
59 <script type="text/javascript" src="../../js/host.js"></script>
60 <script>
61 // once the chuck is initialized, start sending stuff to it!
62 theChuckReady.then( function()
63 {
64 window.addEventListener( "mousemove", function( e )
65 {
66 var x = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
67 var y = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
68 theChuck.setInt( "mouseX", x );
69 theChuck.setFloat( "mouseY", y );
70 });
71 window.addEventListener( "mousedown", function( e )
72 {
73 theChuck.broadcastEvent( "mouseClicked" );
74 });
75 });
76 </script>
77 </body>
78 </html>
79
80