Skip to main content

News

Topic: QtSphere IDE 0.6.0 (Read 35872 times) previous topic - next topic

0 Members and 5 Guests are viewing this topic.
  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
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).
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: QtSphere IDE (working title) 0.2
Reply #31
Is there a difference between mjs and js modules? I tend to not use the global variable.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
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.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

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.
  • Last Edit: June 14, 2017, 04:15:23 pm by Eggbert

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
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.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: QtSphere IDE (working title) 0.2
Reply #35
Strong(er) typing was part of the reason I like it. And I already know that it's a superset of JavaScript. I've messed with it a little bit before.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
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.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: QtSphere IDE (working title) 0.2
Reply #37
That's fine, I doubt it would take a lot of effort to automate that. And of course I could make it easy to do that with QSI.

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
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. :)
  • Last Edit: June 15, 2017, 08:58:15 am by DaVince

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
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 #40
That's weird, I'm having a similar problem on Ubuntu, but not Arch or Windows.

Open QtSphereIDE.pro and replace
Code: [Select]
unix:LIBS += -lqscintilla2_qt5

with
Code: [Select]
unix:LIBS += -lqt5scintilla2



Re: QtSphere IDE (working title) 0.2.3
Reply #41
Never mind, just pull the changes from the GitHub repo, that should fix it.

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
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 #43
That was the idea from the start, basing the UI on Sphere Studio, with my own changes based on personal preferences.

  • Rhuan
  • [*][*][*][*]
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)