Skip to main content
Topic: QtSphere IDE 0.6.0 (Read 1066578 times) previous topic - next topic
0 Members and 19 Guests are viewing this topic.

Re: QtSphere IDE (working title) 0.2

Reply #30

(I need to learn not to pollute the global scope like that...)


That's easy, just use modules (.mjs).  Any `var`s at top level are local to the module, and you have to explicitly make stuff global by:

Code: (javascript) [Select]

global.pigEatinessLevel = 812812;


Same is true for scripts loaded with `require()` (which applies to the main file as well when the version in game.json is >=2).


Re: QtSphere IDE (working title) 0.2

Reply #32
.mjs runs in strict mode by default and lets you use import/export for modules, which is much cleaner (less boilerplate) than CommonJS modules.  For example:
https://github.com/fatcerberus/spectacles-i/blob/master/src/inGameClock.mjs

Because Duktape doesn't support ES6 natively yet though, you need to use Cell.

Re: QtSphere IDE (working title) 0.2

Reply #33
Ah, I've never actually used Cell. If I want advanced Class stuff, I use TypeScript. Though even then, I don't use it very much, because using the usual
Code: (javascript) [Select]

var ClassThingy = function(a,b) {
    this.a = a;
    this.b = b;
}

ClassThingy.prototype.setA = function(newa) {
    this.a = newa;
}

// etc etc
module.export.ClassThingy = ClassThingy;


has always been good enough for me.

Re: QtSphere IDE (working title) 0.2

Reply #34
Cell actually uses TypeScript as its transpiler (type-related stuff is disabled though) :)  Fun fact: TS is just standard ECMA JavaScript + extensions.


Re: QtSphere IDE (working title) 0.2

Reply #36
I wanted to enable typing originally, but it requires compiling all sources together (changing one file recompiles the entire program), and Duktape is way too slow for it (type checking slows down the compilation a LOT).  The tradeoff was necessary, sadly.


Re: QtSphere IDE (working title) 0.2

Reply #38
Completely missed that Github link in your signature! I'll also add it to the top post if that's okay.



(I need to learn not to pollute the global scope like that...)


That's easy, just use modules (.mjs).  Any `var`s at top level are local to the module, and you have to explicitly make stuff global by:

Code: (javascript) [Select]

global.pigEatinessLevel = 812812;


Same is true for scripts loaded with `require()` (which applies to the main file as well when the version in game.json is >=2).

Thanks, that looks very nice and clean. :)

Re: QtSphere IDE (working title) 0.2.3

Reply #39
I can't seem to build this successfully. Despite having installed libqt5scintilla2-dev in Ubuntu, which is supposed to be the source code for qscintilla-qt5, it errors out with this:

Code: [Select]
g++ -m64 -Wl,-O1 -o QtSphereIDE main.o mainwindow.o aboutdialog.o util.o modifiedfilesdialog.o config.o settingswindow.o mapfile.o spherefile.o qrc_qsires.o moc_mainwindow.o moc_aboutdialog.o moc_modifiedfilesdialog.o moc_settingswindow.o moc_mapfile.o moc_spherefile.o   -L/usr/X11R6/lib64 -lqscintilla2_qt5 -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread 
/usr/bin/ld: cannot find -lqscintilla2_qt5
collect2: error: ld returned 1 exit status
Makefile:167: recipe for target 'QtSphereIDE' failed
make: *** [QtSphereIDE] Error 1

 


Re: QtSphere IDE (working title) 0.2.3

Reply #42
Thanks! I gotta say, the interface looks really clean so far. And I like that you based it off of Sphere Studio.


Re: QtSphere IDE (working title) 0.2.3

Reply #44
Is there an easy way to build this without doing a unix style install of QScintilla?

(I try to keep my mac's unix-y folders /usr /sys etc clean of any extras - as it gets very hard to know what I've changed if I start putting things in them)