diff --git a/js/prototype/Coin.js b/js/prototype/Coin.js index b03d76d..41bd125 100644 --- a/js/prototype/Coin.js +++ b/js/prototype/Coin.js @@ -11,6 +11,39 @@ var Coin = function(x,y,z, callback) { var _toto = new Audio(); Coin.extension = _toto.canPlayType("audio/x-vorbis") === "" ? ".ogg" : ".mp3"; +Coin.domElement = document.createElement('canvas'); +Coin.domElement.style.position = 'absolute'; +// Coin.domElement.style.cssFloat = 'top-right'; +Coin.domElement.style.top = "0px"; +Coin.domElement.style.right = "0px"; + +Coin.image = new Image(); +Coin.image.src = '/static/img/redcoin.png'; + +Coin.update = function() { + console.log("ok"); + Coin.domElement.width = Coin.domElement.width; + + Coin.ctx.drawImage(Coin.image,200,25,30,30); + + Coin.ctx.fillStyle = 'red'; + Coin.ctx.strokeStyle = 'black'; + + Coin.ctx.font = "30px Verdana"; + Coin.ctx.fillText(Coin.total - 1 + " / " + 8, 125, 50); + Coin.ctx.strokeText(Coin.total - 1 + " / " + 8, 125, 50); + + Coin.ctx.fill(); + Coin.ctx.stroke(); + +} + +Coin.image.onload = Coin.update; + +Coin.total = 1; +Coin.ctx = Coin.domElement.getContext('2d'); +Coin.update(); + Coin.prototype.init = function(x,y,z) { if (Coin.BASIC_MESH !== null) { this.mesh = Coin.BASIC_MESH.clone(); @@ -70,6 +103,8 @@ Coin.prototype.get = function() { Coin.nextSound = new Audio('/static/data/music/redcoins/' + Coin.total + Coin.extension); Coin.nextSound.preload = "auto"; } + + Coin.update(); } } diff --git a/js/prototype/main.js b/js/prototype/main.js index 30045b4..ce36dab 100644 --- a/js/prototype/main.js +++ b/js/prototype/main.js @@ -74,10 +74,12 @@ function init() { container.appendChild( stats.domElement ); container.appendChild(previewer.domElement); container.appendChild(renderer.domElement); + container.appendChild(Coin.domElement); // Initialize pointer camera var camera1 = new PointerCamera(50, container_size.width() / container_size.height(), 0.1, 100000, renderer, container); + BD.disable(); cameras = initMainScene(camera1, scene, static_path, coins); // cameras = initPeach(camera1, scene, static_path, coins); // cameras = initBobomb(camera1, scene, static_path, coins); diff --git a/static/img/redcoin.png b/static/img/redcoin.png new file mode 100644 index 0000000..66d0bce Binary files /dev/null and b/static/img/redcoin.png differ