MCPcopy Create free account
hub / github.com/SFML/imgui-sfml / WindowContext

Class WindowContext

imgui-SFML.cpp:241–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239};
240
241struct 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
285std::vector<std::unique_ptr<WindowContext>> s_windowContexts;
286WindowContext* s_currWindowCtx = nullptr;

Callers

nothing calls this directly

Calls 1

getConnectedJoystickIdFunction · 0.85

Tested by

no test coverage detected