Permalink
Browse files

dev: fix buttons

  • Loading branch information...
1 parent 4f869fb commit 0424e8dd51125c3237e02cd4d206710faab8026f @egonelbre committed Jun 21, 2012
Showing with 16 additions and 12 deletions.
  1. +10 −8 js/buttons.js
  2. +2 −2 js/main.js
  3. +4 −2 js/net.js
View
@@ -72,7 +72,7 @@ var loadFromDefiniton = function(def){
return net;
};
-load.onclick = function(){
+load.addEventListener("click", function(){
log.innerHTML = "processing...";
var text = input.value;
try {
@@ -83,16 +83,18 @@ load.onclick = function(){
} catch (err){
log.innerHTML = err;
}
-};
+});
-step.onclick = function(){
+step.addEventListener("click", function(){
main.net.cpu.process();
-};
+});
-run.onclick = function(){
+run.addEventListener("click", function(){
main.net.cpu.paused = false;
-};
+});
+
+var btnStop = document.get
-stop.onclick = function(){
+document.getElementById("stop").addEventListener("click", function(){
main.net.cpu.paused = true;
-};
+});
View
@@ -44,15 +44,15 @@ net = new Net();
main.net = net;
setInterval(function(){
- main.net.cpu.process();
+ main.net.cpu.update();
}, 40);
main.huds.add(new NetUI());
main.huds.add(new NetMover());
main.huds.add(new WireAdjuster());
main.huds.add(new BiasAdjuster());
-setTimeout(function(){load.onclick();}, 1000);
+setTimeout(function(){load.click();}, 1000);
canvas.width = main.size.x;
canvas.height = main.size.y;
View
@@ -13,10 +13,12 @@ CPU.methods({
toggle : function(){
this.paused = !this.paused;
},
- process : function(){
+ update : function(){
if(this.paused)
return;
-
+ this.process();
+ },
+ process : function(){
this.time += 1;
var cur = this.next,
keys = Object.keys(cur);

0 comments on commit 0424e8d

Please sign in to comment.