dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Imtui

Open 20k opened this issue 3 years 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

dfoverlay.webm

Lots more progress, putting together a basic overlay config example

20k avatar Dec 18 '22 01:12 20k

overlayintegrations.webm

Current state: the high level integration is mostly (entirely?) done, barring any bugs or unknown unknowns. ImGui windows respect viewscreen sorting, and the technical/architectural work is mostly done. So the current state is that there are a couple of minor local bugfixes, and lots of widgets to add. And the code needs a lot of cleanup

I've been more thoroughly keeping track of what I'm working on over here in case anyone wants more detail of what's to be done generally

https://trello.com/b/zW9Oc48o/df

20k avatar Dec 23 '22 04:12 20k

saving this work in DFHack/dfhack/imtui

myk002 avatar May 02 '24 20:05 myk002