Secretchronicles / TSC

An open source two-dimensional platform game.
https://secretchronicles.org/
GNU General Public License v3.0
205 stars 49 forks source link

Better script editor #54

Open Quintus opened 10 years ago

Quintus commented 10 years ago

As of 92e2597518a5f497b4c510f0f8d54352fe03409c, we have an in-game script editor utilizing CEGUI’s multi-line editbox. But that is very bare. There should at least be syntax highlighting, ideally also the line number is shown on the left. The script editor also requires a monospaced font.

Valete, Quintus

Quintus commented 10 years ago

I did some investigation on this, and I know this will support @Luiji’s view of CEGUI. Setting a monospaced font seems to be the maximum of what is possible with CEGUI’s multiline edit box. No line numbers, no colors for different parts of text. As long as we use CEGUI and do not contribute a sophisticated text widget to CEGUI itself, there can’t be a properly styled script editor.

Vale, Quintus

Quintus commented 10 years ago

@DarkAceZ found this nice page: http://cegui.org.uk/wiki/Formatting_Tags_in_CEGUI

If we could apply this not only to StaticText, but to a MultilineTextBox, the rest would probably be trivial.

Vale, Quintus

Luiji commented 10 years ago

I have no doubt this could be implemented with CEGUI. My main grievance with CEGUI is how complicated it is. One of the things it has going for it is its pretty good rich text support.

Quintus commented 10 years ago

I’ve asked this question on the CEGUI forums: http://cegui.org.uk/forum/viewtopic.php?f=10&t=6790

DarkAceZ commented 10 years ago

Are we going to have a better copy/paste in this "Better script editor"? (is this even the place to request it?) Currently, copy/paste works... only inside the game. It has its own clipboard, so you can't really copy text from outside the game, and paste it in the game. (you could just use an external editor, of course, though)

Quintus commented 10 years ago

@DarkAceZ that is probably a CEGUI question. I don’t know if CEGUI is capable of accessing the system’s clipboard, but I can assure you that different OSes handle clipboard very different. X.org’s clipboard implementation is the worst of them, I think. I once tried to write a Ruby wrapper for it, but gave up due to the complexity of Xlib (whose documentation uses still pre-ANSI C directly from the 1980ies).

As an advanced GUI library, I would expect CEGUI to support clipboard access. I will have to look into that, but you should probably open a separate issue on this, as it is not directly related to the script editor.

Vale, Quintus

Quintus commented 10 years ago

@Luiji I’ve recevied an answer from the CEGUI team. CEGUI doesn’t support this currently, but somewhere in the future™ they might do.

Therefore, this is undoable currently with CEGUI. I tag this issue with dependencies for now and leave it alone, we can’t do anything about it. Closing seems not appropriate to me as this is a valid feature request we might get into sometime.

Vale, Quintus

ghost commented 10 years ago

If you can spare the time you could look at how the frogatto/anura dev team does this. Their engine has the best built-in editor I've come across so far. It uses SDL as well. https://github.com/anura-engine/anura/tree/master/src

DarkAceZ commented 10 years ago

Discuss the tab button? Will it ever do anything? Currently, I'm switching between both the in-game editor and an external editor, but the in-game one doesn't recognize tab spaces...