s7-imgui icon indicating copy to clipboard operation
s7-imgui copied to clipboard

Using s7 scheme alongside Dear ImGui to (interactively) build (cross platform) GUI apps.

Deprecated This project will not receive any updates! Glad if it helps as a skeleton to your own projects though

  • S7 & ImGui

    Using [[https://ccrma.stanford.edu/software/snd/snd/s7.html][s7 scheme]] alongside [[https://github.com/ocornut/imgui][Dear ImGui]] to (interactively) build (cross platform) GUI apps.

    You can see a video demonstration (of =0.1.0=) [[https://youtu.be/MgHsl0u26MY][here]].

    [[https://youtu.be/MgHsl0u26MY][file:img/youtube-preview.png]]

    Cross platform build: linux & windows with [[https://mesonbuild.com/][meson]] build system

    Tested under

    • Windows 10 x64 \ using =msys2= for =meson= & =ninja= but I guess normal windows builds exist
    • Ubuntu 20.04
  • Docs Some preliminary documentation of the provided namespaces is at [[file:docs/ns-doc.md]] \ Auto-generated from the output of [[file:test/scheme/gen-doc.scm]]

  • Building See [[file:dev.org][dev.org]]

    If you use emacs I recommend the [[https://github.com/diadochos/org-babel-eval-in-repl][org-babel-eval-in-repl]] package to make the most out of the snippets in that file.

** Windows Meson can generate the =visual studio= project for you, so you can build/run/debug there.

** Linux Eclipse CDT has meson support which I got working without too much fuss. The [[file:.cproject][.cproject]] file is in the repo cause I couldn't get eclipse to generate it automatically. The [[file:.project][.project]] could be omitted. Generally, what was needed to be done was to manually add the following =natures= in the project:

  • meson
  • c
  • c++

Again, the =.cproject= was needed for the indexer to work. I copied it from a new generated meson project.

Also I've found that =KDevelop= works quite well. This is what I'm using lately.

** TODO macOS Feel free to test it & make a PR. I don't have any mac/hackintosh.

** TODO Cross compiling Meson has cross compiling support. Haven't tested it at all though.

  • Rationale After discovering =clojure= and enjoying the satisfaction of working with a REPL, I wanted to have something like this for native desktop applications (and specifically with c/c++ for specific applications, so no java/clojure).

    Also, building things is still not fun for c/c++ projects. Some short-lived explorations with =Juce= got me scratching my head: you have to use a tool (named =projucer=) to generate the visual studio/xcode project files.. I didn't like this process, confused me.

    Recently I stumbled upon =meson= and, without usince c++ since 2013, I was glad to see how quickly I could use some libraries & even write build definitions for existing projects. It was a nice opportunity to see how things work & not use ready frameworks.

    So there you go.

  • Testing ** C++ (gtest)

    • [ ] fix/think about the needed =pwd= while running the tests (for loading scheme files & testing screenshots etc)

    right now you have to be in the =build/test= dir (assuming =build= is the directory you configured meson with)

** Scheme I'm running the =build/repl src/scheme/test-all.scm= command

  • tests normal scheme things (see [[file:src/scheme/aod/test.scm]] file for how it's impleneted)
  • tests also a GUI window against snapshots: see [[file:src/scheme/aod/components/sxs-wheel.scm]] which tests against [[file:test/scheme/assets/sxs-wheel-snapshot.png]]

for example.

  • Roadmap
    • [X] proof of concept
      • embed =s7= and draw something with imgui from =s7=
      • use a REPL and work with =cmuscheme= in =emacs=
    • [X] (semi)complete the bindings of imgui for s7: checkboxes, lists, menubar etc
    • [X] video demonstration / getting started: windows and/or linux \ I'm thinking of doing a really basic text editor (open - edit - save) with imgui/scheme etc. Live coding using the REPL see https://youtu.be/MgHsl0u26MY
    • [ ] create a documentation of the =namespaces= from C bindings but as well from provided scheme files. \
      • see the generated [[file:docs/ns-doc.el]] for now
      • the idea is to generate an =org= or =markadown= file from this
      • hide "private" things from the documentation (probably names that start with =-=)
    • [ ] Think (again) about the =namespaces=. See https://github.com/actonDev/s7-imgui/issues/3 . Any input from schemers would be greatly appreciated