From b320be13683ba74e2be834b91d5d53df575d8b98 Mon Sep 17 00:00:00 2001 From: Piotr Dabrowski Date: Thu, 11 Jul 2013 10:19:30 +0200 Subject: [PATCH] [Piano] updated Piano sources Change-Id: I34245922a245981954a4f5bc458db7f25de5d90c --- js/main.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 022f85d..fbbec59 100644 --- a/js/main.js +++ b/js/main.js @@ -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(); }; -- 2.7.4