dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Imtui

Open 20k opened this issue 1 year ago • 2 comments

Hello! This is a branch to potentially use the imtui fork of ImGui for DFHack scripts, so that they can have a nice modern UI behind them. Myk002 asked me to file a PR for this to keep a record

So far its all gone surprisingly smoothly:

button.webm

multiwin.webm

colourswork.webm

On a technical note, each viewscreen has its own imgui context, which means that every view is fully independent of every other view. The other alternative would be to have one global imgui context (which would allow different viewscreens to have interacting windows, for eg drag + drop), but this adds more complexity

Todo:

  • [X] Basic Text Rendering
  • [X] Colour internally
  • [X] Reference mechanism for APIs that take pointers

Basic widgets functionality:

  • [X] Button
  • [X] Checkbox
  • [X] PushStyleColor/PopStyleColor (necessary for eg coloured buttons)
  • [x] Selectable (necessary for full width buttons)
  • [x] Input boxes (for search)
  • [x] Rework current colour system to reuse existing lua constants

Tedious but easy widget functionality:

  • [x] IsItem* + IsWindow*

More difficult

  • [x] Keyboard Controls. ImGui has this built in, so I'm hopeful that we can piggyback off this

Things that will inherently never work:

  • [ ] Anything involving colour, like ColorPicker3

Technical Questions:

  • [x] Is one context per viewscreen the right approach?
  • [x] Overlay interop
  • [x] Non lua plugins

20k avatar Dec 17 '22 05:12 20k