Spherical forums

Sphere Development => Editor Development => Topic started by: Eggbertx on January 22, 2017, 05:12:12 pm

Title: QtSphere IDE 0.6.0
Post by: Eggbertx on January 22, 2017, 05:12:12 pm
QtSphere IDE

(On Github) (https://github.com/Eggbertx/QtSphere-IDE)

QtSphere IDE is an alternative Sphere development environment, focused on being both powerful and cross-platformy, for those of us who use Linux/Mac/*BSD/Solaris (or hypothetically any OS that Qt supports) and their respective miniSphere builds but lack a proper IDE without using the 1.x editor via WINE. It used to have a source code editor with syntax highlighting and line numbering, but because of difficulty with QScintilla, I'm going to focus on miniSphere's specific formats (Spritesets, maps, etc) and leave code editing to my Visual Studio Code (https://marketplace.visualstudio.com/items?itemName=eggbertx.minisphere-vs-code-tools) extension. You can still open plain text files if you want, but there are better alternatives.

(https://raw.githubusercontent.com/Eggbertx/QtSphere-IDE/master/screenshots/screenshot-spriteset.png)
Title: Re: QtSphere IDE (working title) 0.1
Post by: DaVince on January 23, 2017, 01:20:09 am
Ooooh, this looks interesting. To make it manageable, though, maybe just focus on one element of Sphere things. I wouldn't mind there being a set of tools rather than just a whole IDE, at least at first.

Also, with the ongoing discussion about leveraging cross-platform map editors like Tiled, it might be good to discuss that and figure out how to proceed! :)
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 23, 2017, 02:32:40 am
I think it would be easier to have a group of tools in one program, rather than multiple programs. And with Qt Creator, it doesn't seem to be too difficult, lack of serious C++ experience aside.
Title: Re: QtSphere IDE (working title) 0.1
Post by: mezzoEmrys on January 23, 2017, 01:53:18 pm
If you wanted to write the backend in Java instead of C++, you could use the Qt Jambi library in Java to make use of all the Qt stuff.
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 23, 2017, 04:48:58 pm
I did consider that, but I don't want to have Java as a dependency.
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 31, 2017, 03:12:34 am
It actually looks (a little bit) like an IDE now!
(https://i.imgur.com/5y7xdh5.png)
Title: Re: QtSphere IDE (working title) 0.1
Post by: Fat Cerberus on January 31, 2017, 03:41:42 am
Nice.

One great feature for the IDE to eventually have would be Cell integration, in other words have the IDE compose the Cellscript for you automatically from the project metadata, so you don't have to write one.  This is something I'd really like to implement in Sphere Studio now that minisphere is more established as The One True Sphere Engine(tm) but it requires pretty tight integration with the project system which I'm not sure is possible to do within the confines of the current plugin architecture.
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 31, 2017, 04:06:57 am
As much as I love plugins, I don't think QSI is going to have much of a plugin system. So everything that wouldn't normally be handled by minisphere anyway is going to be built in, including debugging.
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 31, 2017, 04:11:23 am
With plans to port minisphere to mobile platforms, I'd like QSI to be able to eventually communicate with minisphere over USB though I have no idea how that would work, so I'm not in a hurry to implement it. It's barely off the ground and can't even save/load yet.
Title: Re: QtSphere IDE (working title) 0.1
Post by: DaVince on January 31, 2017, 11:01:25 am
Well, it's looking very clean so far. Nice to see you making progress. I'll be here if you need someone to test on Linux and Win 8.1... :)
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 31, 2017, 11:17:03 am
I use both Windows and Linux, so that won't be an issue. Do you use macOS, or are you familiar with mobile app development?
Title: Re: QtSphere IDE (working title) 0.1
Post by: Fat Cerberus on January 31, 2017, 02:33:16 pm

As much as I love plugins, I don't think QSI is going to have much of a plugin system. So everything that wouldn't normally be handled by minisphere anyway is going to be built in, including debugging.


Note that Cell and SSJ are meant to be first-class parts of the Sphere v2 toolchain.  So if QSI could integrate directly with SSJ that would save a lot of duplicated effort.  That would need a bit of reworking on my part to standardize the SSJ output and make it easier for outside programs to parse.

I understand that all that is a ways off still though, you'd have to get the user interface components worked out first :)
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 31, 2017, 03:47:54 pm
By "handled by minisphere" I was referring to SSJ and Cell as well, with QSI integrating with them directly rather than using a plugin for that.
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on January 31, 2017, 10:49:18 pm
Now with more buttons, a window/exe icon (Windows only, though some Linux window managers will show it) and some logging tabs!
(https://i.imgur.com/CXOuJl2.png)
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on February 07, 2017, 01:46:21 pm
Well TIL (ok, yesterday but no1curr) how debugging works. Qt Creator makes it surprisingly easy regardless of your OS.
Title: Re: QtSphere IDE (working title) 0.1
Post by: DaVince on February 08, 2017, 03:31:13 am
Even though I'm using a Windows laptop (for my internship) these days, I seriously can't wait to see this enter a usable state. :D
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on February 08, 2017, 04:58:17 pm
As of 0.2, you'll be able to open/save script/plain text files (in progress), it'll have syntax highlighting (mostly done) and tabs.
Title: Re: QtSphere IDE (working title) 0.1
Post by: Eggbertx on February 17, 2017, 07:36:37 pm
Yes I know it looks like crap for the time being, but while I'm still working out the kinks, QSI has basic theme support now.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on March 06, 2017, 05:15:44 pm
Finally, syntax highlighting (mostly) works, at least for Javascript. You can open and save files, and it checks to see if any open files have been modified.
Title: Re: QtSphere IDE (working title) 0.2
Post by: casiotone on March 13, 2017, 11:38:57 am
You should probably focus on things like maps/spritesets/fonts first - that's the real pain of Sphere on other platforms. I can't work with Sphere on Mac because I can't create maps or sprites, but I can use any editor for JS.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on March 13, 2017, 01:43:11 pm
I just figured I'd work on Javascript/text because I'm new to Qt and C++ and wanted to get something relatively simple out of the way. I'm working on map editing now.
Title: Re: QtSphere IDE (working title) 0.2
Post by: DaVince on June 11, 2017, 03:12:56 am
Hey Eggbert, are you still working on this? It was looking rather promising. :)
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 11, 2017, 01:51:20 pm
I am, and I apologize for its inactivity. I have a bad tendency to get involved with too many projects at once. On two of them, a couple more people are being added to the team, and another is being set aside until QSI is at a usable state for more than just text/code editing.
Title: Re: QtSphere IDE (working title) 0.2
Post by: DaVince on June 12, 2017, 01:53:22 am
Well, it's good to know the project is still very much alive!


I have a bad tendency to get involved with too many projects at once.

Oh, I know this feeling all too well.  ;D
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 13, 2017, 07:02:54 pm
And now it has syntax highlighting and line numbering via QScintilla!
Title: Re: QtSphere IDE (working title) 0.2
Post by: Fat Cerberus on June 13, 2017, 07:11:06 pm
Blegh, variable width font for code :P  otherwise looks nice though. :D
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 13, 2017, 07:26:52 pm
I kinda got sick of  Windows' library dependency bullsh** and by that point, I just wanted to get that part of it finished. Changing the font will take all of...two lines of code.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 13, 2017, 07:27:44 pm
Oh, also, when I get some more work on it done, you'll be able to set that in a stylesheet file. Qt uses qss files, which have an almost identical syntax to CSS.

Edit: I just booted into Windows and it won't build, because of dumb linking errors :/
Title: Re: QtSphere IDE (working title) 0.2
Post by: DaVince on June 14, 2017, 03:36:01 am
Nice example project. :P (I need to learn not to pollute the global scope like that...)

A style sheet file, huh? I like that. Makes me think of how Sublime Text (or VS Code, or Atom...) stores its editor configuration. You just open and edit a file and see any changes made immediately.

Do you have a Github repo set up for this yet? I'm getting kinda eager to check it out, even if it's still in a very primitive state.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 14, 2017, 12:25:36 pm
What do you mean by global scope? And yes, Visual Studio Code is my favorite text editor/IDE, so QSI takes some influence from that. It doesn't store regular config stuff there though, that goes in a json file (also like VS Code). Since QSI is much more simple though, most configuration is done through a built-in dialogue box.
there's a link to the repo in my signature.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Fat Cerberus on June 14, 2017, 01:43:31 pm

(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).
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 14, 2017, 02:09:13 pm
Is there a difference between mjs and js modules? I tend to not use the global variable.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Fat Cerberus on June 14, 2017, 02:34:33 pm
.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.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 14, 2017, 04:13:51 pm
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.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Fat Cerberus on June 14, 2017, 05:32:23 pm
Cell actually uses TypeScript as its transpiler (type-related stuff is disabled though) :)  Fun fact: TS is just standard ECMA JavaScript + extensions.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 14, 2017, 05:35:09 pm
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.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Fat Cerberus on June 14, 2017, 05:43:57 pm
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.
Title: Re: QtSphere IDE (working title) 0.2
Post by: Eggbertx on June 14, 2017, 05:54:52 pm
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.
Title: Re: QtSphere IDE (working title) 0.2
Post by: DaVince on June 15, 2017, 08:49:27 am
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. :)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on June 15, 2017, 09:10:06 am
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
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on June 15, 2017, 06:35:49 pm
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


Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on June 15, 2017, 08:43:12 pm
Never mind, just pull the changes from the GitHub repo, that should fix it.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on June 16, 2017, 05:09:35 am
Thanks! I gotta say, the interface looks really clean so far. And I like that you based it off of Sphere Studio.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on June 16, 2017, 05:16:15 pm
That was the idea from the start, basing the UI on Sphere Studio, with my own changes based on personal preferences.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on June 17, 2017, 10:54:40 am
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)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on June 17, 2017, 11:28:07 am
I can just ship the source code with a macOS build of QScintilla as with Windows, but I don't have a mac anymore.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on July 01, 2017, 12:15:25 pm
I really should learn how make files work... I built QScintilla but can't manage to get QtSphere IDE to link to it :(
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on July 02, 2017, 04:42:31 am
Did you build it statically or dynamically? Truth be told, I eventually want to replace it with my own widget based on QTextEdit, but that's not high on my priority list.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on July 02, 2017, 07:38:06 am

Did you build it statically or dynamically? Truth be told, I eventually want to replace it with my own widget based on QTextEdit, but that's not high on my priority list.
I built it dynamically, probably should be static?

But I couldn't work out the right instruction to put in to the makefile so QtCreator could find it when trying to build QTSphere IDE. (I've never learnt how to do makefiles manually)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on July 02, 2017, 07:52:01 am
I guess it's supposed to be statically linked then. To be honest, I'm really not very familiar with figuring out linking like this, and QSscintilla is a pain in the ass to set up anyway, hence the desire for a better widget. As much as I'd rather not, if the damn text/source editor is causing this much trouble, I may have to temporarily put off the fun graphics stuff.
Serves me right for trying to take the easy way out :P
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on July 02, 2017, 07:57:43 am
Also, QScintilla's source editor doesn't seem to play nicely with non-ASCII input.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on July 02, 2017, 08:33:07 am
Well I've built it static and still no joy.

I either get Library not found errors or I get "No rule to make target `QtSphereIDE.o'."
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on July 02, 2017, 08:41:21 am
Yeah, I don't care if it's my fault, this isn't worth the trouble.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on August 17, 2017, 03:58:18 pm
Well for now as a result of the above I've actually turned to using QTcreator as my sphere IDE - all I really need right now is something to edit multiple script files in.

I was tired of the oddities of working with wine for the old Sphere IDE and xcode wasn't ideal for a few reasons. QTCreator seems to have a great text editor and does good JS highlighting and stuff :)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on August 18, 2017, 07:32:54 pm
I've mostly been using Visual Studio Code for JavaScript, GIMP for raw images, and the 1.x IDE for converting those images into Spritesets/Maps.
I'm having weird issues with resources in the resource files being ignored by QSI despite showing up fine in Qt Creator, but as soon as I figure that stuff out, I can finally move on.

Also, if you've never tried Visual Studio Code, I highly recommend it. It uses Electron, the same engine as Github Atom, but it feels much more snappy. I never thought I'd be singing the praises of a Microsoft product over something else, but it's a great text editor/lightweight IDE.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on August 26, 2017, 06:31:02 am
Did development of this cease? While I had given up on compiling it for now I was looking forward to the idea of a working macOS sphere IDE.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 08, 2017, 03:54:55 am
No, it's still in active development. I have a bunch of projects that require my attention (though two of them are going to be scaled back, neither of which involve Sphere), and I have some IRL stuff going on.

Also, I don't know if any of you have heard of it or have any experience with it, but today I've been looking into a framework called Electron. It's a Node.js package that allows you to create GUI applications using the Blink (think Chrome, Opera and maybe others) rendering engine. This means you would be doing the vast majority of a given app in JavaScript/HTML/CSS/etc. This would make the filesize a bit larger but has a huge benefit of having much faster development. For example, I got a far more feature-complete syntax highlighter/source editor than what QtSphere has up in a few minutes.
This also makes it much easier to build, since all you need is node.js and npm, which is packaged (I think?) with node.js in Windows and maybe macOS and pretty easy to get in Linux/FreeBSD. So this is sort of like a couple step backwards in terms of progress, but because of the change, I'll be able to take several step forwards in a short time.

The worst part is that I'll have to come up with a new name, since QtSphere IDE without Qt obviously makes no sense.
ElectroSphere? ElectroSphere IDE? That sounds like an IDE for something called ElectroSphere. Sphere Zapper?
Any other ideas?
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 08, 2017, 03:55:54 am
Oh also, Discord, Visual Studio Code (my IDE of choice), and GitHub Atom, among others are built on top of Electron/Node.js.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Miscreant on September 08, 2017, 04:06:33 am
The worst part is that I'll have to come up with a new name, since QtSphere IDE without Qt obviously makes no sense.
ElectroSphere? ElectroSphere IDE? That sounds like an IDE for something called ElectroSphere. Sphere Zapper?
Any other ideas?

Simplistic suggestion: Spheretron?
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on September 08, 2017, 10:29:08 am
I would actually like to make a VSCode plugin for Sphere v2.  It would support the entire toolchain: miniSphere, Cell and SSj.  I have to learn how to make extensions for it first, though.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Chad Zechs on September 08, 2017, 10:52:01 am
The worst part is that I'll have to come up with a new name, since QtSphere IDE without Qt obviously makes no sense.
ElectroSphere? ElectroSphere IDE? That sounds like an IDE for something called ElectroSphere. Sphere Zapper?
Any other ideas?

Simplistic suggestion: Spheretron?

IonoSphere (both referencing Ionized air and the Ionosphere itself)
StatiSphere (Static + Sphere)
BlitSphere/BlitzSphere (Blitz, German for Lightning, + Sphere)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 08, 2017, 12:02:30 pm
I would actually like to make a VSCode plugin for Sphere v2.  It would support the entire toolchain: miniSphere, Cell and SSj.  I have to learn how to make extensions for it first, though.
I did consider that for a while, but I haven't seen any painting related plugins, so I'm not sure if it would be very feasible. JavaScript is so ubiquitous that I can easily find stuff to add widgets and things, making it much less uncertain.

Simplistic suggestion: Spheretron?

IonoSphere (both referencing Ionized air and the Ionosphere itself)
StatiSphere (Static + Sphere)
BlitSphere/BlitzSphere (Blitz, German for Lightning, + Sphere)
Hmm, those could work
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Chad Zechs on September 08, 2017, 12:46:36 pm
IonoSphere (both referencing Ionized air and the Ionosphere itself)
StatiSphere (Static + Sphere)
BlitSphere/BlitzSphere (Blitz, German for Lightning, + Sphere)
Hmm, those could work

You are for sure welcome to any of them. :)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 08, 2017, 11:57:32 pm
@Fat Cerberus I asked about VS Code and drawing/mouseclick events on StackOverflow. If I get a good lead and it turns out that it isn't too difficult, I'll just make a plugin or plugins. If not, I'll probably go back to the electron plan. It sucks that all the time spent with Qt was wasted, but I had been meaning to learn more C++ anyway so I guess it wasn't a total loss, even if that might be a little selfish.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 09, 2017, 10:55:16 am
By searching around the internet and peeking through the API, I'm fairly certain by now that Code doesn't provide anything like I described. It does make it possible to embed a browser, so I still might be able to make an extension for Sphere editing
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 09, 2017, 01:42:17 pm
Damn, it looks like the embedded browser can't execute JavaScript. Looks like it's back to electron then.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on September 10, 2017, 06:25:13 am
Electron + Sphere... Hmmm, maybe a name related to Tesla coils? You know, because of plasma globes (https://en.wikipedia.org/wiki/Plasma_globe). :)

As for your experiments with Electron, it looks interesting, and I think it's a clever idea to speed up development! It even allows for some code reuse as I'm sure miniSphere has some file reading scripts you could use here.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on September 10, 2017, 09:45:07 am
A key reason I'm sticking with QT Creator at the moment is that it has some useful automatic JS checking for me.

E.g. it points out if I declare the same variable twice or if I use an undefined variable or have a missing comma etc.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on September 10, 2017, 09:53:58 am
One thing I like about ES6 is that if you do this:

Code: (javascript) [Select]
let pig = 812;
/* .......... */
let pig = 1208;

You get a runtime error.  Also modules are strict mode by default so if you forget to declare a variable that's an error too.  It's still indeed nice if the IDE catches it first, though. :)

Also nice: let is block-scoped, like in C, and the variable is not hoisted so if you use it before the declaration, you *also* get a runtime error.  The JS community has given that phenomenon a name: the variable is said to be in the "temporal dead zone".  Pretty goofy, huh? :P
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 14, 2017, 11:08:04 am
I'll probably make a poll or something when this gets off the ground and I can confirm that it's going to replace QtSphere IDE. If that is the case, should I just lock this thread and make a new one? Or can a mod split this thread, starting at my first post about electron?

One thing I like about ES6 is that if you do this:

Code: (javascript) [Select]
let pig = 812;
/* .......... */
let pig = 1208;

You get a runtime error.  Also modules are strict mode by default so if you forget to declare a variable that's an error too.  It's still indeed nice if the IDE catches it first, though. :)
Honestly, I've never really used lets, just because I never saw much of a point in them. With the errors, that should be something that the programmer is responsible for, shouldn't it?

Also nice: let is block-scoped, like in C, and the variable is not hoisted so if you use it before the declaration, you *also* get a runtime error.  The JS community has given that phenomenon a name: the variable is said to be in the "temporal dead zone".  Pretty goofy, huh? :P
So it treats it like use strict? And how is it goofy? Is "temporal dead zone" a reference to something?
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on September 14, 2017, 11:20:00 am
I think a lot of new JS programmers get thrown off by the hoisting behavior of var.  For example, this is confusing:

Code: (javascript) [Select]
// console.log(y);  // strict mode error
console.log(x);  // undefined (!)
var x = 812;
console.log(x);  // 812

Versus:
Code: (javascript) [Select]
// console.log(x);  // error (TDZ)
let x = 812;
console.log(x);  // 812

And block-scoping means that if you have a let in an inner block, such as an if condition or loop, it doesn't get hoisted outside like a var would.  That one catches a lot of people off-guard, myself included when I first started learning JS, because it differs from how scoping works in almost every other C-like language.

...which brings me to the goofiness of the "temporal dead zone" terminology.  For that I'll just quote a post I saw a year or so ago:
Quote
I can't begin to guess why someone decided to add "Temporal Dead Zone" to our vocabulary, other than that it probably followed a 17-hour binge-watch of ST:TNG accompanied by too much hipster brew.

Those of us who have been programming in Java, C++, and the like for the last two decades or so just call those "the place where I haven't yet declared the variable I want to use." I think life would have been better for all concerned if braces defined block scope and we could just be done with it. (Maybe not better for Brendan back in the day, but better now, IMHO.)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 14, 2017, 01:15:07 pm
I somehow never noticed that hoisting behavior. I always always (almost) always declare my variables at the beginning of the script or source file, immediately after the imports, aside from temporary variables in if/for blocks, and to avoid confusion, I generally don't use those temporary variable names outside of those blocks. I just tested that with
Code: (javascript) [Select]
var a = true;
if(a) {
var b = 43;
let c = 44;
}
console.log(b); // 43
console.log(c); // error
and I see what you mean now. That doesn't make any logical sense why the above code is the way it is.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on September 15, 2017, 06:35:22 am
A key reason I'm sticking with QT Creator at the moment is that it has some useful automatic JS checking for me.
Honestly, as long as it stays maintainable (unlike the original Sphere engine/editor at a certain point), I'm fine with either idea of it being Qt-based or Electron based. I'd just really like to see a cross-platform editor solution.

I do think it'd be more likely for more people to contribute directly to the project if it were coded in HTML/CSS/JS though, even for just tiny additions/fixes. Simply because the barrier of entry is that much lower.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on September 16, 2017, 07:44:31 am
A key reason I'm sticking with QT Creator at the moment is that it has some useful automatic JS checking for me.
Honestly, as long as it stays maintainable (unlike the original Sphere engine/editor at a certain point), I'm fine with either idea of it being Qt-based or Electron based. I'd just really like to see a cross-platform editor solution.

I do think it'd be more likely for more people to contribute directly to the project if it were coded in HTML/CSS/JS though, even for just tiny additions/fixes. Simply because the barrier of entry is that much lower.
Quick note, when I said that I'm "sticking with QT Creator" I did not mean I was developing an editor with it or particularly suggesting that anyone should, I was simply using QT Creator as my javascript editor of choice.

I'm now trying out Atom which seems quite nice too (I note that it's built on the aforementioned Elctron)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 16, 2017, 06:46:10 pm
Atom is nice, but I always felt like VS Code is a bit snappier and has less cruft. Which is surprising, considering the developer :P
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on September 17, 2017, 10:12:24 am
Atom is nice, but I always felt like VS Code is a bit snappier and has less cruft. Which is surprising, considering the developer :P
Wow VSCode is nice - trying it out today and really taken to it fast.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 18, 2017, 03:00:06 pm
Definitely. And it has a lot of plugins that make it even better, like a live Markdown preview pane, or various language-specific extensions. I don't know if you noticed, but it also has a built-in terminal that defaults to bash in Linux (and presumably macOS) and Powershell in Windows.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Rhuan on September 18, 2017, 03:03:09 pm
Definitely. And it has a lot of plugins that make it even better, like a live Markdown preview pane, or various language-specific extensions. I don't know if you noticed, but it also has a built-in terminal that defaults to bash in Linux (and presumably macOS) and Powershell in Windows.
I haven't noticed the terminal

Also whilst I like the interface, two things it's not doing for me that I'd really like at the moment (I'm sure it can do them):

1. Highlight/underline undefined variables.
2. Highlight.underline duplicate definitions. (Both of these features were in QT Creator's text editor and were a key reason I used it for a while, but it can't cope with ES6 properly)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 18, 2017, 04:44:00 pm
I'm not sure about duplicate definitions, but it does, but there is a section that shows problems with your code.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on September 18, 2017, 09:54:37 pm
Actually, it looks like it does show a problem if you declare a variable with let twice, but not with var.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on September 18, 2017, 10:09:37 pm
That makes sense actually: Duplicate let is a runtime error (in a compliant engine anyway--transpilers don't tend to enforce it), duplicate var is completely legal.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on March 28, 2018, 05:49:11 pm
I've resurrected and completed two dead projects so far (robotfindskitten-sphere and Sphere6502), so let's see if I can keep this fun train rolling. After messing around in Java and Vala with the intention of creating an editor solely for Sphere formats, I've decided that I would be better off working on QtSphere IDE again but completely dropping all of the source related stuff. Since I won't be using QScintilla, it should be much easier to build, since you won't have to go around and search for libraries.

Since QSI won't have a source editor, I'm going to work on a Visual Studio Code extension for miniSphere API completion/documentation and possibly for interfacing with SSj.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Radnen on March 29, 2018, 12:22:15 am
Since QSI won't have a source editor, I'm going to work on a Visual Studio Code extension for miniSphere API completion/documentation and possibly for interfacing with SSj.

I like this Visual Studio Code idea!
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 08, 2018, 09:21:07 pm
And here's a long overdue update. It isn't much of an editor yet, but I'm making progress and starting with spritesets.
(https://raw.githubusercontent.com/Eggbertx/QtSphere-IDE/master/screenshots/spriteset1.png)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on April 09, 2018, 03:57:59 am
The fact that you've got those sprites loaded and displaying is already very promising! :)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 11, 2018, 12:42:41 am
I know it isn't much of an update, buuuuut QtSphere IDE's file tabs now respond to Ctrl+PageDown/PageUp. Can Radnen's IDE do that? Didn't think so! That's to say nothing of its cross-platformyness and overall prettierness. Neener neener neener!

In all seriousness, considering C/C++ isn't my strongsuit, I think QSI is making decent progress. Now that it's (relatively) stable and I'm pretty sure that it isn't going to blow up in your face if you breath on it wrong, I think it has a pretty decent foundation, even if a fair chunk of it was aesthetically ripped straight from Radnen's IDE and to a lesser extent, VS Code :P
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on April 11, 2018, 01:51:39 am
I know it isn't much of an update, buuuuut QtSphere IDE's file tabs now respond to Ctrl+PageDown/PageUp. Can Radnen's IDE do that? Didn't think so! That's to say nothing of its cross-platformyness and overall prettierness. Neener neener neener!

It can't, but it *does* respond to Ctrl+Tab and Shift+Ctrl+Tab (I think it might be buggy though?).  I admit I wasn't aware of Ctrl+PageUp/Down at all, probably because MSVC doesn't respond to those either.  That's a nifty shortcut!
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 11, 2018, 12:39:08 pm
It can't, but it *does* respond to Ctrl+Tab and Shift+Ctrl+Tab (I think it might be buggy though?).
Huh, I just checked and apparently QTabWidget responds to those key combinations by default. And Firefox does as well. Oh well, I've always associated Ctrl+PageDown/PageUp with switching tabs, and it's more ergonomically convenient, so I'll just leave them there.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Radnen on April 11, 2018, 11:53:57 pm
Same with Fat Cerberus. I didn't know Ctrl+PageUp/PageDown was a thing! I just tried in Chrome and it worked. Guess you learn something new every day.

I do use Shift+Insert to paste all the time, however. On a nice full keyboard, at least, it feels nicer with just the right hand.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on April 12, 2018, 02:02:58 pm
I had to get used to Ctrl+PgUp and Ctrl+PgDown myself because some programs on Linux support only those. So luckily, that means I was used to both anyway... I'm glad that your editor supports both by default. :)

Quote
more ergonomically convenient
This I don't get... You only need one hand to press Ctrl+Tab and Ctrl+Shift+Tab while PgUp and PgDown are all the way on the other side of the keyboard. I guess you use right Ctrl a lot? :P And I guess it saves one extra keystroke.

Anyway, I'm actually quite stoked on the recent progress on this. Been waiting for Sphere to truly enter cross-platform territory; not just with its engine but with its editor as well!
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 13, 2018, 11:47:25 am
This I don't get... You only need one hand to press Ctrl+Tab and Ctrl+Shift+Tab while PgUp and PgDown are all the way on the other side of the keyboard. I guess you use right Ctrl a lot? :P And I guess it saves one extra keystroke.
I don't really use right ctrl a lot. changing tabs is pretty much the only time I ever really use it.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on April 13, 2018, 05:15:41 pm
Feature request: An option to summon eaty pigs :pig_nose: and integrate them into your project somehow.

Okay but seriously, work on a new editor has me thinking... maybe now would be a good time to think about replacing the venerable Sphere 1.x formats with something cleaner and more modern...
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 13, 2018, 06:01:16 pm
Feature request: An option to summon eaty pigs :pig_nose: and integrate them into your project somehow.
Sounds like a fun Easter egg.

Okay but seriously, work on a new editor has me thinking... maybe now would be a good time to think about replacing the venerable Sphere 1.x formats with something cleaner and more modern...
Aww man, after all of the work I put (and am still putting) into getting 1.x formats to work? :P
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 14, 2018, 01:18:05 am
Well I could be working on proper spriteset functionality, but never mind that, QSI plays audio files now!
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on April 17, 2018, 04:17:44 pm
And of course, you use that song as a test. :smile:
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on April 17, 2018, 07:57:12 pm
And of course, you use that song as a test. :smile:

...wait, what'd I miss?
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 18, 2018, 01:58:59 pm
And of course, you use that song as a test. :smile:
Of course!

...wait, what'd I miss?
The song my IDE is playing in the screenshot I posted, The Ballad of Bilbo Baggins (https://www.youtube.com/watch?v=AGF5ROpjRAU)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Fat Cerberus on April 19, 2018, 09:16:21 am
No, I got that, I'm just trying to figure out what the significance of using that song in particular is.  Unless it's just because it's a really goofy song?  I'm confused.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 22, 2018, 11:21:34 am
I just figured it would be the perfect song to show off QSI's media player. Because.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on April 25, 2018, 05:36:24 pm
The spriteset editor is more developed now, and soon you'll soon be able to actually modify sprites. Modifying directions, frame placement and properties (e.g., frame delay), and base editing is an obvious must, but since there are plenty of external image editing tools like GIMP, Photoshop, Paint, etc, implementing a paint widget isn't going to be a priority until everything else works. Instead, you'll be able to import image files.

(https://i.imgur.com/JJw2pXU.png)
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: DaVince on April 28, 2018, 12:45:42 pm
No, I got that, I'm just trying to figure out what the significance of using that song in particular is.  Unless it's just because it's a really goofy song?  I'm confused.
There's no significance, I just love that he used one of those songs that happens to be very silly.
Title: Re: QtSphere IDE (working title) 0.2.3
Post by: Eggbertx on July 15, 2018, 10:48:07 am
Wow, I haven't updated this thread in a while. But QtSphere IDE is still under heavy development. I thought I posted this already, but apparently not. While it's a little buggy still (dropdowns act strangely with a QSS theme), QSI has a decent looking dark theme!
(https://i.imgur.com/7xK0XTh.png)
Title: Re: QtSphere IDE 0.2.5
Post by: DaVince on July 18, 2018, 10:04:03 am
I'm trying to get this built on my Ubuntu system (after having installed Qt 4, Qt 5 and Qt Creator) but I get stuck at the screen displayed in the attachment.

Compiling from source worked (after installing some multimedia and multimediawidget libraries), but the IDE seems to currently just crash on an "Error loading penguin.rss" and a subsequent segmentation fault. I guess that's still hardcoded in at this point.

(The README needs updating, by the way! Make sure to list required libraries and ./build/QtSphere should be ./build/QtSphereIDE. :)
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 19, 2018, 09:31:53 am
Oh oops, that penguine.rss is just for testing. I thought I removed it but apparently I forgot. Or maybe I did but I didn't push that change to the repo yet. You can just put your favorite spriteset in the same directory as the executable, run it, and it should work.
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 19, 2018, 04:06:49 pm
Alright, I fixed it and pushed the changes and the updated README.md
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 20, 2018, 12:01:18 am
Oh great, I just booted into Windows to try it out, and apparently MSVC is a lot stricter than GCC, so I'm getting a bunch of errors.
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 22, 2018, 02:39:25 pm
I'm working on importing spritesets from images. Unlike the original editor, which immediately saved the generated spriteset, QtSphere IDE just imports the image, so you can make changes before saving it, or in case it didn't come out right. Also as you can see, I combined the frame width/height and the transparency i/o dialogs into one for user convenience.
Title: Re: QtSphere IDE 0.2.5
Post by: Fat Cerberus on July 23, 2018, 01:29:39 am
That's a good idea, not saving the image right away to facilitate experimentation.  I've always been annoyed when an editor automatically saves something you just created that you might end up having to delete and start over; IDEs in particular are notorious for forcing you to save newly created projects (Sphere Studio also being an offender here).

As a suggestion for a future iteration it could be useful to see an actual preview of the generated spriteset before actually generating it; this would let the user fiddle with the values and see the results in realtime, before clicking OK.
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 23, 2018, 11:19:34 am
That's a good idea, not saving the image right away to facilitate experimentation.  I've always been annoyed when an editor automatically saves something you just created that you might end up having to delete and start over; IDEs in particular are notorious for forcing you to save newly created projects (Sphere Studio also being an offender here).
Yeah, it just always felt really awkward. The menu even says "Import", which generally implies that something is being included or generated without being saved automatically.

As a suggestion for a future iteration it could be useful to see an actual preview of the generated spriteset before actually generating it; this would let the user fiddle with the values and see the results in realtime, before clicking OK.
That should be pretty easy with Qt's slots/signals.

Right now I'm having an extremely frustrating issue with the direction objects in the direction list being corrupted/reset after the function that they're created in returns. I'm not sure if it's caused by my pointer handling or Qt's implicit sharing system (https://doc.qt.io/qt-5/implicit-sharing.html), but based on my experience with the same thing happening to individual QImage objects, I'm guessing it's the latter.
Title: Re: QtSphere IDE 0.2.5
Post by: Fat Cerberus on July 23, 2018, 02:09:49 pm
The way the system is described, it seems you're meant to pass around the shared object itself, rather than a pointer to it.  This ends up being efficient because the object is merely a wrapped pointer so there's no significant cost in making copies of it.

What I'm guessing is that you're creating the object on the stack and then returning a pointer to it.  This leaves you with a dangling pointer because the object itself goes out of scope.  A pointer doesn't count as a live reference, it's just a dumb memory address.

Code: (c++) [Select]
CSomeClass object(arg1, arg2);
return &object;  // dangling ptr, ticking time bomb
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 23, 2018, 03:08:02 pm
Uh...so it turns out  the directions being reset was caused by two really dumb mistakes. The direction.name was being reset because of what you described. Changing it from a char* to a QString fixed the issue.
As for the frames being "reset", I created each frame when looping through num_frames (an integer read from the .rss file), but forgot to actually add them to direction.frames!

Whatever, at least it works now, and importing is mostly finished, as you can see from the images. The spriteset in imported.png is ugly but it isn't meant to be pretty, since I was using it to make sure that the given color is being properly replaced with transparency (or another color if you don't need transparency).
Title: Re: QtSphere IDE 0.2.5
Post by: Fat Cerberus on July 23, 2018, 04:51:37 pm
Hehe, anti-aliasing and colorkeyed transparency indeed don't get along very well.
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 23, 2018, 06:15:00 pm
That was done deliberately in GIMP to see how the 1.x editor handles  similar shades of the given color. It's also why I added a gradient to the last frame.

Also importing works now, and the created file can be read by both QtSphere IDE and the original editor, though I don't know about Radnen's editor. sha256sum reports that the file generated by my editor has a different checksum from one generated by the original editor, but I suspect that's because of random junk in the reserved byte arrays.
Title: Re: QtSphere IDE 0.2.5
Post by: Fat Cerberus on July 23, 2018, 06:39:39 pm
Per spec (what little "spec" there is for the v1 formats...) I think the reserved bytes are always supposed to be zero'd.  Doing so helps with forward compatibility since the "default" for any new value can safely be assumed to be zero.

That said, it's unlikely those formats will be extended in any way going forward. :P
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on July 23, 2018, 08:46:02 pm
Alright, I zeroed out the reserved byte arrays and set the default frame delay to 8 (since I had it at 1), and now it creates a spriteset identical to one generated by the 1.x editor if you renamed the empty direction to "north", added "east", "south", and "west" directions, and gave each direction three frames.
Title: Re: QtSphere IDE 0.2.5
Post by: Eggbertx on October 31, 2018, 01:02:36 pm
This thread is in desperate need of an update since QtSphere IDE is still in development even though it isn't my main project. I'm currently working on the map editor, and even though it's still far from completion, it fully loads map files, and this is what the editor itself looks like so far:
(https://i.imgur.com/aq4KZWH.png)
It might end up being able to display the first frame of each entity as a preview, rather than a generic icon. I haven't decided yet.
Title: Re: QtSphere IDE 0.6.0
Post by: Eggbertx on November 01, 2018, 03:40:40 pm
And now the map editor is (slowly) starting to look like a map editor! Thanks @Fat Cerberus for helping with the weird tileset quirk.