← Back

ofxCodeEditorKit

github.com/ofxyz/ofxCodeEditorKit · @ofxyz
OF 0.12 GUI

ofxKit Code Editor

0 0 Last commit 2mo ago Created 2mo ago

README

ofxCodeEditorKit



preview

ofxKit Runtime glue that wires the ofxImGuiTextEdit code editor panel into an ofxKit app.

Usage



#include "ofxCodeEditorKit.h"

class ofApp : public ofBaseApp {
    ofxCodeEditorKit::CodeEditorKit m_codeKit;
public:
    void setup() override {

        // The entire integration: dialogs + window + font, wired once.
        ofxCodeEditorKit::CodeEditorKit::Options opts;
        opts.windowVisible = true;
        m_codeKit.registerWith(runtime(), opts);

        // Talk to the panel directly
        m_codeKit.panel().setText(src, TextEditor::LanguageDefinitionId::Glsl);
    }
};


m_codeKit.registerWith() is safe to call once from ofApp::setup(), before or after runtime().attach() — the editor font loads via the Runtime post-setup

API



namespace ofxCodeEditorKit {
class CodeEditorKit {
    struct Options { bool registerWindow=true, windowVisible=false, loadFont=true; float fontSize=14.f; };
    void registerWith(ofkitty::Runtime&);
    void registerWith(ofkitty::Runtime&, const Options&);
    TextEditorPanel&       panel();
    const TextEditorPanel& panel() const;
    ImFont* font() const;
    void    draw(bool& visible);   // when registerWindow=false
};
}


Dependencies



ofxKit, ofxImGuiTextEdit, ofxImGuiStyle, ofxImGui

Reference example



example-codeEditor — attaches the Runtime, registers the kit, and seeds the editor.

License



MIT ofKitty

Get this addon

HTTPS
SSH