Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Megabyteceer committed Jun 13, 2024
2 parents e147137 + 79fb07d commit 04c82c8
Show file tree
Hide file tree
Showing 43 changed files with 1,264 additions and 465 deletions.
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"recommendations": [
"VasiliyKostin.blocks-highlighter",
"VasiliyKostin.thing-editor-integration",
"streetsidesoftware.code-spell-checker",
"dbaeumer.vscode-eslint"
]
Expand Down
16 changes: 16 additions & 0 deletions .vscode/extensions/thing-editor-integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# thing-editor integration


[Thing-Editor](https://github.com/Megabyteceer/thing-editor) integration extensions.


For now its just reapply breakpoints after game classes dynamic reloading.

extension accepts commands via http requests:
http://127.0.0.1:32025/classes-reloaded&my-game-name

But you don`t have to send them. They will be send automatically.


## changes log
1.0.2 activate extension if thing-editor workspace open only.
34 changes: 34 additions & 0 deletions .vscode/extensions/thing-editor-integration/extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var vscode = require('vscode');

function activate(_context) {

let popStackRequired = false;

vscode.debug.registerDebugAdapterTrackerFactory('*', {
createDebugAdapterTracker(session) {
return {
onWillReceiveMessage: (m) => {
//console.log(`,${JSON.stringify(m, undefined, 2)}`);
session.name;
},
onDidSendMessage: (m) => {
if(m.command === 'stackTrace') {
const stackFrame = m.body.stackFrames[0];
if(stackFrame && stackFrame.name && stackFrame.name.endsWith('_thing_editor_debug_helper')) {
popStackRequired = true;
}
} else if(popStackRequired && m.command === 'scopes') {
popStackRequired = false;
vscode.commands.executeCommand('workbench.action.debug.callStackDown');
}
//console.log(`,${JSON.stringify(m, undefined, 2)}`);
}
};
}
});
}
exports.activate = activate;

module.exports = {
activate
};
34 changes: 34 additions & 0 deletions .vscode/extensions/thing-editor-integration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "thing-editor-integration",
"displayName": "Thing-Editor integration",
"description": "thing-editor integration",
"publisher": "VasiliyKostin",
"repository": "https://github.com/Megabyteceer/thing-editor",
"version": "1.0.4",
"engines": {
"vscode": "^1.43.0"
},
"categories": [
"Other"
],
"activationEvents": [
"workspaceContains:./thing-editor.code-workspace"
],
"main": "./extension.js",
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "node ./test/runTest.js"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/mocha": "^7.0.1",
"@types/node": "^12.11.7",
"@types/vscode": "^1.43.0",
"eslint": "^6.8.0",
"glob": "^7.1.6",
"mocha": "^7.0.1",
"typescript": "^3.7.5",
"vscode-test": "^1.3.0"
}
}
17 changes: 12 additions & 5 deletions thing-editor.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"**/*.ogg": true,
"**/*.psd": true,
"**/*.flp": true,
"LICENSE": true,
"run-ubuntu.sh": true,
"run-win10.bat": true,
"**/*.png": true,
"**/*.jpg": true,
"**/*.aac": true,
Expand Down Expand Up @@ -183,9 +186,9 @@
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
"activeOnStart": false,
"beginsPattern": "editor",
"endsPattern": "launched"
}
}
]
Expand All @@ -206,7 +209,9 @@
"presentation": {
//"hidden": true
},
"skipFiles": [],
"skipFiles": [
"**/debug/assert**"
],
"sourceMaps": true,
"smartStep": true,
"resolveSourceMapLocations": [
Expand All @@ -232,7 +237,9 @@
"presentation": {
"hidden": true
},
"skipFiles": [],
"skipFiles": [
"**/debug/assert**"
],
"sourceMaps": true,
"smartStep": true,
"resolveSourceMapLocations": [
Expand Down
37 changes: 37 additions & 0 deletions thing-editor/electron-main/build-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const ifDefPlugin = require('./vite-plugin-ifdef/if-def-loader.js');
const path = require('path');
const {ViteImageOptimizer} = require('vite-plugin-image-optimizer');

module.exports = (root, publicDir, outDir, debug, _projectDesc) => {
return {
root: root + '/.tmp',
publicDir,
base: './',
esbuild: {
target: 'ES2015'
},
plugins: [
ifDefPlugin(debug),
ViteImageOptimizer({})
],
build: {
target: 'ES2015',
emptyOutDir: true,
minify: !debug,
outDir,
rollupOptions: {
input: ''
},
},
resolve: {
alias: {
'game-root': root,
'games': path.resolve(__dirname, '../../games'),
'libs': path.resolve(__dirname, '../../libs'),
'thing-editor': path.resolve(__dirname, '../../thing-editor'),
'howler.js': 'https://cdn.jsdelivr.net/npm/howler@2.2.3/dist/howler.min.js',
'pixi.js': 'https://cdn.jsdelivr.net/npm/pixi.js-legacy@7.2.4/dist/pixi-legacy.min.mjs'
}
}
};
};
55 changes: 5 additions & 50 deletions thing-editor/electron-main/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ const fs = require('fs');
const {walkSync} = require('./editor-server-utils');

module.exports = {
build: (projectDir, debug, assetsToCopy) => {

const ifDefPlugin = require('./vite-plugin-ifdef/if-def-loader.js');
const {ViteImageOptimizer} = require('vite-plugin-image-optimizer');


build: (projectDir, debug, assetsToCopy, projectDesc) => {
const editorRoot = path.resolve(__dirname, '../..');
const root = path.resolve(editorRoot, projectDir);
const outDir = root + (debug ? '/debug' : '/release');
Expand Down Expand Up @@ -53,54 +48,14 @@ module.exports = {
});
});
})).then(() => {
return require('vite').build({
root: root + '/.tmp',
publicDir,
base: './',
esbuild: {
target: 'ES2015'
},
plugins: [
ifDefPlugin(debug),
ViteImageOptimizer({})
],
build: {
target: 'ES2015',
emptyOutDir: true,
minify: !debug,
outDir,
rollupOptions: {
input: ''
},
},
resolve: {
alias: {
'game-root': root,
'games': path.resolve(__dirname, '../../games'),
'libs': path.resolve(__dirname, '../../libs'),
'thing-editor': path.resolve(__dirname, '../../thing-editor'),
'howler.js': 'https://cdn.jsdelivr.net/npm/howler@2.2.3/dist/howler.min.js',
'pixi.js': 'https://cdn.jsdelivr.net/npm/pixi.js-legacy@7.2.4/dist/pixi-legacy.min.mjs'
}
}
}).then((res) => {
return require('vite').build(require(path.resolve(editorRoot, debug ? projectDesc.__buildConfigDebug : projectDesc.__buildConfigRelease))(root, publicDir, outDir, debug, projectDesc)).then((res) => {
require('./static-server.js');
console.log('BUILD COMPLETE: ' + 'http://localhost:5174/' + projectDir);
return res;
}).catch((er) => {
console.error(er.stack);
return er;
});
});
}
};

if (require.main === module) {
module.exports.build('games/game1/', true, [
{
from: '/libs/lib1/assets/flag.png',
to: 'flag.png',
},
{
from: '/games/game1/assets/bunny.png',
to: 'bunny.png',
},
]);
}
Loading

0 comments on commit 04c82c8

Please sign in to comment.