[Piano] updated Piano sources
authorPiotr Dabrowski <p.dabrowski2@samsung.com>
Thu, 11 Jul 2013 08:19:30 +0000 (10:19 +0200)
committerPiotr Dabrowski <p.dabrowski2@samsung.com>
Thu, 11 Jul 2013 08:19:30 +0000 (10:19 +0200)
Change-Id: I34245922a245981954a4f5bc458db7f25de5d90c

js/main.js

index 022f85d..fbbec59 100644 (file)
@@ -26,7 +26,9 @@ function Piano() {
        Piano.prototype = {
                touchPianoKey: [],
                lockIds: {},
-               audio: []
+               audio: [],
+               whiteCache: null,
+               blackCache: null
        };
 
        Piano.prototype.bindEvents = function bindEvents() {
@@ -117,7 +119,15 @@ function Piano() {
                }
        };
 
+       Piano.prototype.cacheImages = function cacheImages() {
+               this.whiteCache = new Image();
+               this.whiteCache.src = "white_pressed.png";
+               this.blackCache = new Image();
+               this.blackCache.src = "black_pressed.png";
+       };
+
        Piano.prototype.init = function init() {
+               this.cacheImages();
                this.bindEvents();
                this.audioInit();
        };