diff --git a/.floo b/.floo new file mode 100644 index 0000000..afefe92 --- /dev/null +++ b/.floo @@ -0,0 +1,3 @@ +{ + "url": "https://floobits.com/r/logsol/chuck/" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index e4d81d5..3c45938 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ node_modules/ *.log .DS_Store -.floo -.sublime-project diff --git a/.sublime-project b/.sublime-project new file mode 100644 index 0000000..fe609e4 --- /dev/null +++ b/.sublime-project @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "/Users/karlpannek/Work/projects/js/chuck.js" + } + ] +} \ No newline at end of file diff --git a/app/Game/Client/View/ViewController.js b/app/Game/Client/View/ViewController.js index be18010..b4c236c 100755 --- a/app/Game/Client/View/ViewController.js +++ b/app/Game/Client/View/ViewController.js @@ -61,17 +61,10 @@ define(requires, function (DomController, Three, Settings, CameraController) { //this.scene.add(directionalLight); - this.createMesh(100, 100, 100, 100, 'static/img/100.png', function (mesh) { - self.mesh = mesh; - self.scene.add(mesh); - }); -/* - this.createMesh(50, 50, 200, 100, 'static/img/100.png', function (mesh) { - self.scene.add(mesh); - }); -*/ - - //this.animate(this); + //this.createMesh(100, 100, 100, 100, 'static/img/100.png', function (mesh) { + // self.mesh = mesh; + // self.scene.add(mesh); + //}); } ViewController.prototype.loadMeshes = function(objects) { @@ -88,6 +81,7 @@ define(requires, function (DomController, Three, Settings, CameraController) { self.createMesh(Settings.TILE_SIZE, Settings.TILE_SIZE, x, y, 'static/img/Tiles/' + material + '/' + o.s + '' + o.r + '.gif', function(mesh) { self.scene.add(mesh); + console.log("img height:", mesh.material.map.image.height); //mesh.rotation.z = rad; }); })(); @@ -108,27 +102,23 @@ define(requires, function (DomController, Three, Settings, CameraController) { } ViewController.prototype.render = function () { - this.renderer.render(this.scene, this.cameraController.getCamera()); } ViewController.prototype.createMesh = function (width, height, x, y, imgPath, callback) { - var textureImg = new Image(); - textureImg.onload = function () { // FIXME: perhaps not needed to load double? - var material = new Three.MeshLambertMaterial({ - map: Three.ImageUtils.loadTexture(imgPath), - transparent: true - }); + var mesh; + var material = new Three.MeshLambertMaterial({ + map: Three.ImageUtils.loadTexture(imgPath, new THREE.UVMapping(), function(){ + callback(mesh); + }), + transparent: true + }); - var mesh = new Three.Mesh(new Three.PlaneGeometry(width, height), material); - mesh.overdraw = true; - //mesh.position.z = 1; - mesh.position.x = x; - mesh.position.y = y; - - callback(mesh); - }; - textureImg.src = imgPath; + mesh = new Three.Mesh(new Three.PlaneGeometry(width, height), material); + mesh.overdraw = true; + mesh.position.x = x; + mesh.position.y = y; + //mesh.position.z = 1; } return ViewController; diff --git a/snippets/canvas-mouseposition.js b/snippets/canvas-mouseposition.js new file mode 100644 index 0000000..1e0a247 --- /dev/null +++ b/snippets/canvas-mouseposition.js @@ -0,0 +1,6 @@ +var myCanvas = null; +myCanvas = document.getElementsByTagName('canvas')[0]; + +myCanvas.onmousemove = function(e){ + console.log(e.clientX - this.offsetLeft) +} \ No newline at end of file diff --git a/static/img/Animation/chuckwitharmssprite.png b/static/img/Animation/chuckwitharmssprite.png new file mode 100644 index 0000000..977d286 Binary files /dev/null and b/static/img/Animation/chuckwitharmssprite.png differ diff --git a/static/img/Animation/chuckwithoutarmssprite.png b/static/img/Animation/chuckwithoutarmssprite.png new file mode 100644 index 0000000..7ef0400 Binary files /dev/null and b/static/img/Animation/chuckwithoutarmssprite.png differ