Page 1 of 1

[DONE] Embed Ace editor into GD5 / collapsable code events

PostPosted: Mon 26 Feb 2018, 15:46
by Wendigo
Proposal 1: Add Ace editor as javascript editor into GD5:
https://github.com/ajaxorg/ace

Ace is a javascript text editor that was made to be easily embedded into websites.
It is developed under the BSD license and offers syntax highlighting and code completion for javascript, c++ (and other languages).

Proposal 2: Collapsable code events:
Code events take up quite some space in the event sheet. Game Maker handles this issue quite nicely:
If the first line in the code event is a comment then it only displays the comment instead of the code.
Since GD5 is a web page you could also add functionality to show the first few lines of code when you hover the mouse over the code event (in a hovering div) and only show the code editor when you click on the code event.

By the way:
I started using JS in my Sakawochi game for the first time and it totally rocks. You should mention this functionality under features on the homepage. This might attract some more advanced game developers. If you create compex logic / math calculations with lots of temporary variables just with event blocks the event sheet gets quite convoluted. Code events solve this issue perfectly.

Re: Embed Ace editor into GD5 / collapsable code events

PostPosted: Sat 10 Mar 2018, 21:23
by Wendigo
There is also a react module for ace:
https://www.npmjs.com/package/react-ace

And a playground:
https://securingsincity.github.io/react-ace/

I have tried to include the editor myself but am a little overwhelmed by the react framework.
While I could embed the editor the theme and settings were not respected. I also need to figure out how to feed the edited JavaScript code back into the js-event.
Quite complex the whole thing. :(

Re: Embed Ace editor into GD5 / collapsable code events

PostPosted: Sat 10 Mar 2018, 21:33
by ddabrahim
Would be nice but I haven't seen 4ian being active in the feature request topic for a while, you may be better off posting this on GitHub or send him a pm.

Re: Embed Ace editor into GD5 / collapsable code events

PostPosted: Sun 11 Mar 2018, 21:44
by 4ian
I've answered on GitHub (good idea to post on the issue a link to the forum page so I can write here that I've answered).

Basically, it's something that I want to add later. Not sure which editor would be used, see my answer for more information about the characteristics that are important for an editor to be added.

Re: Embed Ace editor into GD5 / collapsable code events

PostPosted: Sat 17 Mar 2018, 18:48
by ddabrahim
4ian wrote:see my answer for more information about the characteristics

One of the characteristics you mention is to be fast and light to be able to display multiple editor at the same time, my personal opinion is that it is not necessary. I would be totally fine to be able to see and edit only one script at the time.

So in the event editor we would see only an event similar to Group or External event saying "Script: Name" And when we click it, it would open up the referenced script inside an editor. I think it would be fine in case it is the cost to have the more advanced editor in GD.

But in case you manage to find one that is advanced and it is also light and fast, then I think each script should open in their own editor window that we can move around, resize, minimize, maximize and so in case we need to have two script open, we could even put them side by side....

The point is, I don't think it necessary to display code inside the event editor as it is now in case this is what you have in mind when you say "display multiple editor"...