Skip to content

Commit

Permalink
Export plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Sep 17, 2023
1 parent 064b2fd commit 44995e7
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 93 deletions.
21 changes: 8 additions & 13 deletions dist/rexgameobjectshellplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -36130,7 +36130,7 @@
return callback;
};

var GenerateFrames = function GenerateFrames(scene, key, frame, columns, rows, overlapX, overlapY, getFrameNameCallback) {
var GenerateFrames = function GenerateFrames(scene, key, frame, columns, rows, getFrameNameCallback) {
if (frame == null) {
frame = '__BASE';
}
Expand All @@ -36142,8 +36142,8 @@
var baseWidth = baseFrame.width,
baseHeight = baseFrame.height;
var cellX, cellY, cellName;
var cellWidth = (baseWidth + (columns - 1) * overlapX) / columns,
cellHeight = (baseHeight + (rows - 1) * overlapY) / rows;
var cellWidth = baseWidth / columns,
cellHeight = baseHeight / rows;
var frameCutX = baseFrame.cutX,
frameCutY = baseFrame.cutY;
var offsetX = 0,
Expand All @@ -36155,9 +36155,9 @@
cellX = offsetX + frameCutX;
cellY = offsetY + frameCutY;
texture.add(cellName, 0, cellX, cellY, cellWidth, cellHeight);
offsetX += cellWidth - overlapX;
offsetX += cellWidth;
}
offsetY += cellHeight - overlapY;
offsetY += cellHeight;
}
return {
getFrameNameCallback: getFrameNameCallback,
Expand Down Expand Up @@ -36187,16 +36187,13 @@
}
var originX = GetValue$1w(config, 'originX', 0.5);
var originY = GetValue$1w(config, 'originY', 0.5);
var overlap = GetValue$1w(config, 'overlap', 0);
var overlapX = GetValue$1w(config, 'overlapX', overlap);
var overlapY = GetValue$1w(config, 'overlapY', overlap);
var addToScene = GetValue$1w(config, 'add', true);
var align = GetValue$1w(config, 'align', addToScene);
var imageObjectPool = GetValue$1w(config, 'objectPool', undefined);
var scene = gameObject.scene;
var texture = gameObject.texture;
var frame = gameObject.frame;
var result = GenerateFrames(scene, texture, frame, columns, rows, overlapX, overlapY);
var result = GenerateFrames(scene, texture, frame, columns, rows);
var getFrameNameCallback = result.getFrameNameCallback;
var scaleX = gameObject.scaleX,
scaleY = gameObject.scaleY;
Expand All @@ -36207,8 +36204,6 @@
var cellGameObjects = [];
var scaleCellWidth = result.cellWidth * scaleX,
scaleCellHeight = result.cellHeight * scaleY;
var scaleOverlapX = overlapX * scaleX,
scaleOverlapY = overlapY * scaleY;
for (var y = 0; y < rows; y++) {
for (var x = 0; x < columns; x++) {
var cellGameObject;
Expand All @@ -36222,8 +36217,8 @@
scene.add.existing(cellGameObject);
}
if (align) {
var cellTLX = startX + scaleCellWidth * x - scaleOverlapX * (x - 1);
var cellTLY = startY + scaleCellHeight * y - scaleOverlapY * (y - 1);
var cellTLX = startX + scaleCellWidth * x;
var cellTLY = startY + scaleCellHeight * y;
var cellX = cellTLX + originX * scaleCellWidth;
var cellY = cellTLY + originY * scaleCellHeight;
cellGameObject.setOrigin(originX, originY).setPosition(cellX, cellY).setScale(scaleX, scaleY).setRotation(rotation);
Expand Down
2 changes: 1 addition & 1 deletion dist/rexgameobjectshellplugin.min.js

Large diffs are not rendered by default.

21 changes: 8 additions & 13 deletions dist/rexgridcutimageplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
return callback;
};

var GenerateFrames = function GenerateFrames(scene, key, frame, columns, rows, overlapX, overlapY, getFrameNameCallback) {
var GenerateFrames = function GenerateFrames(scene, key, frame, columns, rows, getFrameNameCallback) {
if (frame == null) {
frame = '__BASE';
}
Expand All @@ -150,8 +150,8 @@
var baseWidth = baseFrame.width,
baseHeight = baseFrame.height;
var cellX, cellY, cellName;
var cellWidth = (baseWidth + (columns - 1) * overlapX) / columns,
cellHeight = (baseHeight + (rows - 1) * overlapY) / rows;
var cellWidth = baseWidth / columns,
cellHeight = baseHeight / rows;
var frameCutX = baseFrame.cutX,
frameCutY = baseFrame.cutY;
var offsetX = 0,
Expand All @@ -163,9 +163,9 @@
cellX = offsetX + frameCutX;
cellY = offsetY + frameCutY;
texture.add(cellName, 0, cellX, cellY, cellWidth, cellHeight);
offsetX += cellWidth - overlapX;
offsetX += cellWidth;
}
offsetY += cellHeight - overlapY;
offsetY += cellHeight;
}
return {
getFrameNameCallback: getFrameNameCallback,
Expand Down Expand Up @@ -195,16 +195,13 @@
}
var originX = GetValue(config, 'originX', 0.5);
var originY = GetValue(config, 'originY', 0.5);
var overlap = GetValue(config, 'overlap', 0);
var overlapX = GetValue(config, 'overlapX', overlap);
var overlapY = GetValue(config, 'overlapY', overlap);
var addToScene = GetValue(config, 'add', true);
var align = GetValue(config, 'align', addToScene);
var imageObjectPool = GetValue(config, 'objectPool', undefined);
var scene = gameObject.scene;
var texture = gameObject.texture;
var frame = gameObject.frame;
var result = GenerateFrames(scene, texture, frame, columns, rows, overlapX, overlapY);
var result = GenerateFrames(scene, texture, frame, columns, rows);
var getFrameNameCallback = result.getFrameNameCallback;
var scaleX = gameObject.scaleX,
scaleY = gameObject.scaleY;
Expand All @@ -215,8 +212,6 @@
var cellGameObjects = [];
var scaleCellWidth = result.cellWidth * scaleX,
scaleCellHeight = result.cellHeight * scaleY;
var scaleOverlapX = overlapX * scaleX,
scaleOverlapY = overlapY * scaleY;
for (var y = 0; y < rows; y++) {
for (var x = 0; x < columns; x++) {
var cellGameObject;
Expand All @@ -230,8 +225,8 @@
scene.add.existing(cellGameObject);
}
if (align) {
var cellTLX = startX + scaleCellWidth * x - scaleOverlapX * (x - 1);
var cellTLY = startY + scaleCellHeight * y - scaleOverlapY * (y - 1);
var cellTLX = startX + scaleCellWidth * x;
var cellTLY = startY + scaleCellHeight * y;
var cellX = cellTLX + originX * scaleCellWidth;
var cellY = cellTLY + originY * scaleCellHeight;
cellGameObject.setOrigin(originX, originY).setPosition(cellX, cellY).setScale(scaleX, scaleY).setRotation(rotation);
Expand Down
2 changes: 1 addition & 1 deletion dist/rexgridcutimageplugin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 16 additions & 22 deletions dist/rexjigsaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
Expand Down Expand Up @@ -797,7 +783,6 @@
return "".concat(c, ",").concat(r);
};
var GenerateFrames = function GenerateFrames(scene, _ref) {
var _JigsawPiece;
var sourceKey = _ref.sourceKey,
destinationKey = _ref.destinationKey,
columns = _ref.columns,
Expand Down Expand Up @@ -841,11 +826,14 @@
useDynamicTexture: true,
fillColor: 0x888888
});
var sample = new JigsawPiece(scene, (_JigsawPiece = {
var sample = new JigsawPiece(scene, {
width: frameWidth,
height: frameHeight,
edgeWidth: edgeWidth
}, _defineProperty(_JigsawPiece, "edgeWidth", edgeHeight), _defineProperty(_JigsawPiece, "key", sourceKey), _defineProperty(_JigsawPiece, "drawShapeCallback", drawShapeCallback), _JigsawPiece));
edgeWidth: edgeWidth,
edgeHeight: edgeHeight,
key: sourceKey,
drawShapeCallback: drawShapeCallback
});
var startX = -edgeWidth,
startY = -edgeHeight;
var scrollX = startX,
Expand Down Expand Up @@ -922,6 +910,12 @@
});
piecesKey = result.destinationKey;
var getFrameNameCallback = result.getFrameNameCallback;
var frameWidth = result.frameWidth,
frameHeight = result.frameHeight;
var pieceWidth = (frameWidth - edgeWidth * 2) * scaleX,
pieceHeight = (frameHeight - edgeHeight * 2) * scaleY;
var pieceDisplayOriginX = originX * frameWidth * scaleX,
pieceDisplayOriginY = originY * frameHeight * scaleY;
if (!createImageCallback) {
createImageCallback = function createImageCallback(scene, key, frame) {
return new ImageClass(scene, 0, 0, key, frame);
Expand All @@ -945,16 +939,16 @@
scene.add.existing(pieceGameObject);
}
if (align) {
var pieceX = pieceTopLeftX + originX * pieceGameObject.width * scaleX;
var pieceY = pieceTopLeftY + originY * pieceGameObject.height * scaleY;
var pieceX = pieceTopLeftX + pieceDisplayOriginX;
var pieceY = pieceTopLeftY + pieceDisplayOriginY;
pieceGameObject.setOrigin(originX, originY).setPosition(pieceX, pieceY).setScale(scaleX, scaleY).setRotation(rotation);
RotateAround(pieceGameObject, topLeftX, topLeftY, rotation);
}
pieceTopLeftX += (pieceGameObject.width - edgeWidth * 2) * scaleX;
pieceTopLeftX += pieceWidth;
pieceGameObjects.push(pieceGameObject);
}
pieceTopLeftX = topLeftX;
pieceTopLeftY += (pieceGameObject.height - edgeHeight * 2) * scaleY;
pieceTopLeftY += pieceHeight;
}
return pieceGameObjects;
};
Expand Down
Loading

0 comments on commit 44995e7

Please sign in to comment.