work n new tracing game

This commit is contained in:
2023-09-23 17:27:47 +05:30
parent 8c88aea0a9
commit e492d23d70
5 changed files with 265 additions and 21 deletions

View File

@@ -339,13 +339,13 @@ import Layout from '../../layouts/Layout.astro';
graphics.strokePath();
}
};
// // Add a "Save Snapshot" button
// snapshotButton = this.add.image(window.innerWidth / 20, window.innerHeight / 2.3, 'buttonIcons');
// // snapshotButton = this.add.text(150, 80, 'SAVE', { fill: '#7c4c23', backgroundColor : '#5e17eb', font: '600 30px quicksand', borderRadius: '20px'}).setPadding(10, 10);
// snapshotButton.setInteractive();
// snapshotButton.on('pointerdown', () => {
// captureSnapshot(this);
// });
// Add a "Save Snapshot" button
snapshotButton = this.add.image(window.innerWidth / 20, window.innerHeight / 2.3, 'buttonIcons');
// snapshotButton = this.add.text(150, 80, 'SAVE', { fill: '#7c4c23', backgroundColor : '#5e17eb', font: '600 30px quicksand', borderRadius: '20px'}).setPadding(10, 10);
snapshotButton.setInteractive();
snapshotButton.on('pointerdown', () => {
captureSnapshot(this);
});
}
function captureSnapshot(drawingZone) {
drawingZone.renderer.snapshot((image) => {
@@ -357,7 +357,7 @@ import Layout from '../../layouts/Layout.astro';
// Download the snapshot as an image
const link = document.createElement('a');
link.href = image.src;
link.download = 'snapshot.png';
link.download = 'my_drawing.png';
link.click();
document.body.removeChild(image);