centered images in image layers

This commit is contained in:
Jeena 2014-11-15 17:37:16 +01:00
parent 9c9db8ca8c
commit 357ef181d9
4 changed files with 10 additions and 52 deletions

View file

@ -90,37 +90,8 @@ function (Parent, Settings, Nc, PIXI, AbstractLayer) {
Level.prototype.setupLayer = function(options, behind, referenceId) {
Parent.prototype.setupLayer.call(this, options, behind, referenceId);
console.log(options.layerId, behind, referenceId);
Nc.trigger(Nc.ns.client.view.layer.createAndInsert, options.layerId, 1, behind, referenceId);
};
/*
Level.prototype.createItems = function(options) {
options.layerId = AbstractLayer.ID.ITEM;
Nc.trigger(Nc.ns.client.view.layer.createAndInsert, options.layerId, 1, AbstractLayer.ID.SPAWN, true);
Parent.prototype.createItems.call(this, options);
};
Level.prototype.createTiles = function(options) {
console.log('client level createTiles');
options.layerId = AbstractLayer.ID.TILE;
Nc.trigger(Nc.ns.client.view.layer.createAndInsert, options.layerId, 1, AbstractLayer.ID.SPAWN, true);
Parent.prototype.createTiles.call(this, options);
};
Level.prototype.createSpawnPoints = function(options) {
options.layerId = AbstractLayer.ID.SPAWN;
Nc.trigger(Nc.ns.client.view.layer.createAndInsert, options.layerId, 1);
Parent.prototype.createSpawnPoints.call(this, options);
};
Level.prototype.createContainer = function(options) {
Parent.prototype.createContainer.call(this, options);
};
*/
return Level;
});

View file

@ -74,36 +74,25 @@ function (Parent, Settings, Nc) {
var callback = function(mesh) {
Nc.trigger(Nc.ns.client.view.mesh.add, options.layerId, mesh);
Nc.trigger(Nc.ns.client.view.mesh.update, options.layerId, mesh, {
x: Settings.STAGE_WIDTH / 2,
y: Settings.STAGE_HEIGHT / 2,
pivot: {
x: mesh.texture.width / 2,
y: mesh.texture.height / 2
}
});
}
Nc.trigger(Nc.ns.client.view.mesh.create,
options.layerId,
texturePath,
callback,
{
x: 200
}
callback
);
}
};
TiledLevel.prototype.addBackground = function(options) {
var texturePath = Settings.GRAPHICS_PATH + options.image;
/*
var callback = function (mesh) {
Nc.trigger(Nc.ns.client.view.mesh.add, mesh, 0); // FIXME: add at z layer -1 or so
}
Nc.trigger(Nc.ns.client.view.mesh.create, texturePath, callback, {
width: 4000,
height: 2959,
x: -(4000 - Settings.STAGE_WIDTH) / 2,
y: -(2959 + Settings.STAGE_HEIGHT + 700) / 2
});
*/
}
TiledLevel.prototype.getLayer = function(levelData, name) {
for (var i = 0; i < levelData.layers.length; i++) {
if(levelData.layers[i].name === name) {

View file

@ -53,8 +53,6 @@ function (Nc, Exception, Layer) {
this.layers.splice(layerIndex, 0, layer);
this.rearrangeLayers();
console.log(this.layers.map(function(o) {return o.name}))
};
LayerManager.prototype.rearrangeLayers = function() {