| 239 | }; |
| 240 | |
| 241 | struct WindowContext |
| 242 | { |
| 243 | const sf::Window* window; |
| 244 | ImGuiContext* imContext{ImGui::CreateContext()}; |
| 245 | |
| 246 | std::optional<sf::Texture> fontTexture; // internal font atlas which is used if user doesn't set |
| 247 | // a custom sf::Texture. |
| 248 | |
| 249 | bool windowHasFocus; |
| 250 | bool mouseMoved{false}; |
| 251 | bool mousePressed[3] = {false}; |
| 252 | ImGuiMouseCursor lastCursor{ImGuiMouseCursor_COUNT}; |
| 253 | |
| 254 | bool touchDown[3] = {false}; |
| 255 | sf::Vector2i touchPos; |
| 256 | |
| 257 | unsigned int joystickId{getConnectedJoystickId()}; |
| 258 | ImGuiKey joystickMapping[sf::Joystick::ButtonCount] = {ImGuiKey_None}; |
| 259 | StickInfo dPadInfo; |
| 260 | StickInfo lStickInfo; |
| 261 | StickInfo rStickInfo; |
| 262 | TriggerInfo lTriggerInfo; |
| 263 | TriggerInfo rTriggerInfo; |
| 264 | |
| 265 | std::optional<sf::Cursor> mouseCursors[ImGuiMouseCursor_COUNT]; |
| 266 | |
| 267 | #ifdef ANDROID |
| 268 | #ifdef USE_JNI |
| 269 | bool wantTextInput{false}; |
| 270 | #endif |
| 271 | #endif |
| 272 | |
| 273 | WindowContext(const sf::Window* w) : window(w), windowHasFocus(window->hasFocus()) |
| 274 | { |
| 275 | } |
| 276 | ~WindowContext() |
| 277 | { |
| 278 | ImGui::DestroyContext(imContext); |
| 279 | } |
| 280 | |
| 281 | WindowContext(const WindowContext&) = delete; // non construction-copyable |
| 282 | WindowContext& operator=(const WindowContext&) = delete; // non copyable |
| 283 | }; |
| 284 | |
| 285 | std::vector<std::unique_ptr<WindowContext>> s_windowContexts; |
| 286 | WindowContext* s_currWindowCtx = nullptr; |
nothing calls this directly
no test coverage detected