hugoam / kiui

Auto-layout Ui library, lightweight, skinnable and system agnostic, with an OpenGL backend
zlib License
749 stars 71 forks source link

[feature request] source code widget #25

Open ghost opened 9 years ago

ghost commented 9 years ago

Something that is really missing in existing game GUI widget sets so far is a source code editor component with line numbers and being able to define parsers for syntax highlighting as plugins or by something like User Defined Language from Notepad++.

Use case is scripting in game editors. For example, games like TSC would preferably have that instead some normal text box.

ocornut commented 9 years ago

Chiming in. For ProDGB Daniel choose to use Scintilla which is a full-featured widget and adapt it for rendering in ImGui. Scintilla is a rather complex but does everything.

See sc_platform_bgfx.cpp and ui_sc_editor* https://github.com/emoon/ProDBG/tree/master/src/prodbg/ui

Same approach could be used to adapt it to other systems. Afaik few people have bothered creating a new "platform" for Scintilla but with that code above as a base it should be much easier to extract it. Would be worthy to make a standalone app using Scintilla with bgfx/kiui/ImGui sample because it's an often desired feature, once it's standalone it's easy for anyone to port it somewhere else.

If you only want keyword highlighting without much awareness of the language it's probably easier to do it directly inside kiui.

ghost commented 9 years ago

If you only want keyword highlighting without much awareness of the language it's probably easier to do it directly inside kiui.

@ocornut Scintilla really seems like an overkill to me. For an actual IDE you'd use a "normal" toolkit, wouldn't you?