diff --git a/README.md b/README.md index 23bdec5b..e3bba8e1 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This README is being written.
* Added `uiWindowContentSize()`, `uiWindowSetContentSize()`, and `uiWindowOnContentSizeChanged()` methods for manipulating uiWindow content sizes. Note the use of "content size"; the size you work with does NOT include window decorations (titlebars, menus, etc.). * Added `uiWindowFullscreen()` and `uiWindowSetFullscreen()` to allow making fullscreen uiWindows, taking advantage of OS facilities for fullscreen and without changing the screen resolution (!). * Added `uiWindowBorderless()` and `uiWindowSetBorderless()` for allowing borderless uiWindows. + * Added `uiMainSteps()`. You call this instead of `uiMain()` if you want to run the main loop yourself. You pass in a function that will be called; within that function, you call `uiMainStep()` repeatedly until it returns 0, doing whatever you need to do in the meantime. (This was needed because just having `uiMainStep()` by itself only worked on some systems.) * **15 June 2016** * Added `uiFormDelete()`; thanks to @emersion. diff --git a/TODO.md b/TODO.md index 981deef1..d91a3eab 100644 --- a/TODO.md +++ b/TODO.md @@ -93,3 +93,8 @@ notes - group and tab should act as if they have no child if the child is hidden on windows + + + +- a way to do recursive main loops + - how do we handle 0 returns from non-recursive uiMainStep() calls that aren't the main loop? (event handlers, for instance) diff --git a/doc/mainsteps b/doc/mainsteps new file mode 100644 index 00000000..f572b21c --- /dev/null +++ b/doc/mainsteps @@ -0,0 +1 @@ +the function passed to mainsteps must not return until uiQuit itself has been called; otherwise the results are undefined diff --git a/windows/main.cpp b/windows/main.cpp index 1db790cb..5cc34332 100644 --- a/windows/main.cpp +++ b/windows/main.cpp @@ -77,6 +77,11 @@ void uiMain(void) ; } +void uiMainSteps(void (*f)(void *), void *data) +{ + (*f)(data); +} + static int peekMessage(MSG *msg) { BOOL res;