ADDED src/0dev.org/imgui/design.txt Index: src/0dev.org/imgui/design.txt ================================================================== --- /dev/null +++ src/0dev.org/imgui/design.txt @@ -0,0 +1,32 @@ +Design of an immediate graphical user interface api with managed layouts + +Terms: + +1. Canvas - a drawing area with a managed layout + +User stories + +1. I would like to call UI-rendering functions without specifying dimensions and locations +2. I would like to call custom UI-rendering functions while specifying dimensions and locations + +Story 2 needs a way to get a proper starting location or a bounding box If 1 is in place. + +Consider the single method Layout interface: + +type Layout interface { + // Advances the layout and returns a starting point + // for an element based on the last ending point. + Next(Point) Point +} + +Story 1 necessitates that library-aware UI-rendering functions acquire their starting locations +on their own. This allows for the following two approaches (more are possible of course) + +* Store the ending point of the last element. New calls can get it and pass it to the layout + + does not advance the layout unless required, saving cpu + +* Store the next starting point by calling Next() at the end of the element drawing routine. +The next drawing can continue from it. + - advancing the layout costs cpu + - the user might want an out of layer render +