()
| 166 | } |
| 167 | |
| 168 | static void WindowDemoStep() |
| 169 | { |
| 170 | if (!windowDemoShow) return; |
| 171 | |
| 172 | // Make a window for demo selection |
| 173 | UI.WindowBegin("Demos", ref windowDemoPose, new Vec2(demoWinWidth, 0)); |
| 174 | int start = 0; |
| 175 | float currWidthTotal = 0; |
| 176 | UISettings uiSettings = UI.Settings; |
| 177 | TextStyle style = UI.TextStyle; |
| 178 | for (int i = 0; i < demoNames.Count; i++) |
| 179 | { |
| 180 | float width = Text.Size(demoNames[i], style).x + uiSettings.padding * 2; |
| 181 | if (currWidthTotal + (width+uiSettings.gutter) > demoWinWidth) |
| 182 | { |
| 183 | float inflate = (demoWinWidth - (currWidthTotal-uiSettings.gutter+0.0001f)) / (i - start); |
| 184 | for (int t = start; t < i; t++) |
| 185 | { |
| 186 | float currWidth = Text.Size(demoNames[t], style).x + uiSettings.padding * 2 + inflate; |
| 187 | if (UI.Button(demoNames[t], new Vec2(currWidth, 0))) |
| 188 | Tests.SetDemoActive(t); |
| 189 | UI.SameLine(); |
| 190 | } |
| 191 | start = i; |
| 192 | } |
| 193 | if (start == i) |
| 194 | currWidthTotal = uiSettings.margin * 2; |
| 195 | currWidthTotal += width + uiSettings.gutter; |
| 196 | } |
| 197 | for (int t = start; t < demoNames.Count; t++) |
| 198 | { |
| 199 | float currWidth = Text.Size(demoNames[t], style).x + uiSettings.padding * 2; |
| 200 | if (UI.Button(demoNames[t], new Vec2(currWidth, 0))) |
| 201 | Tests.SetDemoActive(t); |
| 202 | UI.SameLine(); |
| 203 | } |
| 204 | UI.NextLine(); |
| 205 | UI.HSeparator(); |
| 206 | if (UI.ButtonImg("Exit", powerButton)) |
| 207 | SK.Quit(); |
| 208 | UI.WindowEnd(); |
| 209 | } |
| 210 | |
| 211 | /// :CodeSample: AppFocus SK.AppFocus |
| 212 | /// ### Checking for changes in application focus |
nothing calls this directly
no test coverage detected