45 | 45 |
<div id="panel">
|
46 | 46 |
<button id="start">Start</button>
|
47 | 47 |
<button id="stop">Stop</button>
|
48 | |
<button id="wrap" onclick="c.wrapWith(document.getElementById('pixley-interpreter').innerHTML);">Wrap in Pixley Interpreter</button>
|
|
48 |
<button id="wrap">Wrap in Pixley Interpreter</button>
|
49 | 49 |
<span id="status"></span>
|
50 | 50 |
</div>
|
51 | 51 |
|
|
230 | 230 |
<script src="../src/yoob/preset-manager.js"></script>
|
231 | 231 |
<script src="../src/pixley-controller.js"></script>
|
232 | 232 |
<script src="../src/pixley-depictor.js"></script>
|
|
233 |
<script src="../src/pixley-launcher.js"></script>
|
233 | 234 |
<script>
|
234 | |
var c = new PixleyController();
|
235 | |
c.init({
|
236 | |
'status': document.getElementById('status'),
|
237 | |
'display': document.getElementById('display'),
|
238 | |
'output': document.getElementById('output'),
|
239 | |
'wrapButton': document.getElementById('wrap')
|
240 | |
});
|
241 | |
document.getElementById('start').onclick = function() { c.start(); };
|
242 | |
document.getElementById('stop').onclick = function() { c.stop(); };
|
243 | |
c.depictor = new PixleyDepictor();
|
244 | |
c.depictor.init(document.getElementById('canvas'));
|
245 | |
|
246 | |
var sourceManager = (new yoob.SourceManager()).init({
|
247 | |
'panelContainer': document.getElementById('edit_panel'),
|
248 | |
'editor': document.getElementById('program'),
|
249 | |
'hideDuringEdit': [
|
250 | |
document.getElementById('display'),
|
251 | |
document.getElementById('status')
|
252 | |
],
|
253 | |
'disableDuringEdit': [document.getElementById('panel')],
|
254 | |
'storageKey': 'demo/pixley.html',
|
255 | |
'onDone': function() {
|
256 | |
/* Apparently this gets called as soon as the sourceManager
|
257 | |
has been initialized... but we don't have any editor text
|
258 | |
yet at that point. But it will get called again, when
|
259 | |
we make the sourceManager. So, ... we check first. */
|
260 | |
if (this.getEditorText()) {
|
261 | |
c.load(this.getEditorText());
|
262 | |
}
|
263 | |
}
|
264 | |
});
|
265 | |
|
266 | |
var presetManager = (new yoob.PresetManager()).init({
|
|
235 |
launch({
|
|
236 |
workerURL: "../src/pixley-worker.js",
|
|
237 |
status: document.getElementById('status'),
|
|
238 |
display: document.getElementById('display'),
|
|
239 |
output: document.getElementById('output'),
|
|
240 |
startButton: document.getElementById('start'),
|
|
241 |
stopButton: document.getElementById('stop'),
|
|
242 |
wrapButton: document.getElementById('wrap'),
|
|
243 |
pixleyInterpreter: document.getElementById('pixley-interpreter').innerHTML,
|
|
244 |
depictionCanvas: document.getElementById('canvas'),
|
|
245 |
editor: document.getElementById('program'),
|
|
246 |
editPanel: document.getElementById('edit_panel'),
|
|
247 |
controlPanel: document.getElementById('panel'),
|
|
248 |
storageKey: 'demo/pixley.html',
|
267 | 249 |
selectElem: document.getElementById('select_source'),
|
268 | |
setPreset: function(id) {
|
269 | |
sourceManager.loadSourceFromHTML(document.getElementById(id).innerHTML);
|
270 | |
}
|
271 | |
}).populateFromClass('example_program').select('cons-test');
|
|
250 |
exampleProgramClass: 'example_program',
|
|
251 |
initialProgramName: 'cons-test'
|
|
252 |
});
|
272 | 253 |
</script>
|