Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: ImGui-SFML / problem with resizing cursor  (Read 2439 times)

0 Members and 1 Guest are viewing this topic.

binbinhfr

  • Newbie
  • *
  • Posts: 21
    • View Profile
ImGui-SFML / problem with resizing cursor
« on: April 28, 2020, 11:39:21 pm »
Hi,

this thread is about a problem encountered in ImGUI-SFML, a backend to the wonderful ImGUI, written using SFML by @eliasdaler.
https://github.com/eliasdaler/imgui-sfml
https://github.com/ocornut/imgui

the problem is described here :
https://github.com/eliasdaler/imgui-sfml/issues/119
and also here with screenshots :
https://github.com/eliasdaler/imgui-sfml/pull/110

It concerns the resizing cursor that does not show anymore on the main window borders, when the cursor is handled by the ImGui-SFML (on ImGUI widgets only, not on the rest of the app). It does not show, but the resizing still works.

As you can read, I got in touch with @eliasdaler to solve this problem, but he thinks that it comes from SFML, so we will see if people around here can find an idea...  ;)


binbinhfr

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: ImGui-SFML / problem with resizing cursor
« Reply #1 on: April 30, 2020, 11:36:58 pm »
no one encounters this problem of resize cursor (double arrow) not appearing correctly on window borders ? I really don't understand why it does not appear anymore when I'm using ImGui-SFML...

Elias Daler

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
    • Blog
    • Email
Re: ImGui-SFML / problem with resizing cursor
« Reply #2 on: May 01, 2020, 12:19:34 am »
This is a relatively minor problem with no easy fix. In the past I've devoted something like 6 hours trying to find the solution, but didn't find any.
Tomb Painter, Re:creation dev | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

binbinhfr

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: ImGui-SFML / problem with resizing cursor
« Reply #3 on: May 01, 2020, 11:41:21 am »
Yes it's a minor problem, but in window mode, it was not easy to resize the main window anymore. Not clean.

But I just found a workaround. For those who may need it, it consists in switching the ImGuiConfigFlags_NoMouseCursorChange flag when ImGui really needs it.

Here is the code (it's a raw copy of my code, just to understand the principle, you'll have to adapt to your own code). It must be set between the events polling and the ImGUI update.

Quote
      static ImGuiIO& ioImgui = ImGui::GetIO();

      static bool imguiHasCursorPrev = true;
      bool imguiHasCursor = ioImgui.WantCaptureMouse || ioImgui.WantCaptureKeyboard;

      if (imguiHasCursor != imguiHasCursorPrev)
      {
         if (imguiHasCursor)
         {
            ioImgui.ConfigFlags &= !ImGuiConfigFlags_NoMouseCursorChange;
         }
         else
         {
            ioImgui.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
            window.setMouseCursor(cursorDefault);
         }
         imguiHasCursorPrev = imguiHasCursor;
      }


note : "window" is my main sfml window.
and    cursorDefault.loadFromSystem(sf::Cursor::Arrow);
« Last Edit: May 01, 2020, 06:18:57 pm by binbinhfr »

 

anything