SFML community forums

General => SFML projects => Topic started by: Elias Daler on April 12, 2016, 11:49:01 am

Title: [Release][GUI] ImGui-SFML
Post by: Elias Daler on April 12, 2016, 11:49:01 am
Github (https://github.com/EliasD/imgui-sfml)

ImGui is a wonderful library which lets you easily add debug / tools GUI for your game.
A while ago this (http://en.sfml-dev.org/forums/index.php?topic=17185.0) back-end was released and my repository is based on it while improving(?) / changing some stuff.

Here's how I use ImGui in level editor of Re:creation (http://en.sfml-dev.org/forums/index.php?topic=18062.0):
(http://i.imgur.com/iQibpSk.gif)
I also use it for my in-game console.
(http://i.imgur.com/DdKtJqU.gif)

You can find an example code inside of README for repository.
I'm not sure it's 100% complete, so let's discuss it! :)
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Tukimitzu on April 12, 2016, 06:29:16 pm
I love that library.

Aside from the new
ImGui::Image(someTexture);
(which is indeed very convenient), what else is new from the original repo? Also, when I was using the original, I noticed that if you resize the window after creation, the ImGui objects stopped rendering and working properly. Did you experience that too? And if so, is that fixed?
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on April 12, 2016, 09:33:30 pm
Aside from the new
ImGui::Image(someTexture);
(which is indeed very convenient), what else is new from the original repo?
Can't remember all the changes, but not much.
Mostly it's .h/.cpp code separation (using static variables in .h is just asking for trouble!) and also:

* Mouse wheel button support
* Custom TextureId in rendering callback (which makes sf::Texture overload possible)
* Better delta time calculation using sf::Clock::restart (not much of a difference...)
* Some small refactorings which don't change functionality but made code better looking for my coding standards :)

Also, when I was using the original, I noticed that if you resize the window after creation, the ImGui objects stopped rendering and working properly. Did you experience that too? And if so, is that fixed?
This worked fine for me using original repo. :)
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Tukimitzu on April 22, 2016, 01:13:41 am
About the problem I mentioned, it happens when you use sf::RenderWindow::setFramerateLimit(...). If you don't set a limit it works fine.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: DurtyFree on May 14, 2016, 08:44:12 pm
Is this or something similar to this available for the SFML.NET Bindings?
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on May 31, 2016, 07:01:58 pm
About the problem I mentioned, it happens when you use sf::RenderWindow::setFramerateLimit(...). If you don't set a limit it works fine.
I fixed it just now. Can you please check out the latest version to see it it works for you?

Is this or something similar to this available for the SFML.NET Bindings?
Don't think so, though you probably can write some bindings for it yourself (it's just a few calls!)

Another thing: there's now ImGui::ImageButton support which was added by susnux. I've also added alternative cursors support which you can use by calling ImGui::SetMouseCursor. The system cursor in your SFML window gets disabled and ImGui draws it instead if you use non standard cursor.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: aggsol on July 19, 2016, 12:38:53 pm
Good work! I have some suggestions for improvments

* The content of imconfig-SFML.h is not copied in *my* imgui.h but the header of imgui itself.
* the CMAKE step is not very clear. What is IMGUI_ROOT and what value is it set? I just added it my way :-)
* OpenGL is required so CMAKE also needs

find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(${OPENGL_LIBRARIES})

Edit:
There are two warnings. A trailing newline in imconfig-SFML.h and a unused parameter size in line 211 imgui-SFML.cpp. You want me to create a PR for that?
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: iJake on July 23, 2016, 09:36:23 am
Good work! I have some great suggestion like Airsnore (https://www.villagevoice.com/2022/03/18/airsnore-review/) for improvments

* The content of imconfig-SFML.h is not copied in *my* imgui.h but the header of imgui itself.
* the CMAKE step is not very clear. What is IMGUI_ROOT and what value is it set? I just added it my way :-)
* OpenGL is required so CMAKE also needs

find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(${OPENGL_LIBRARIES})

Edit:
There are two warnings. A trailing newline in imconfig-SFML.h and a unused parameter size in line 211 imgui-SFML.cpp. You want me to create a PR for that?

IMGUI is awesome but I've noticed those warnings too and I don't know how to fix them but apart from that it works great.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on July 23, 2016, 01:00:21 pm
Good work! I have some suggestions for improvments

* The content of imconfig-SFML.h is not copied in *my* imgui.h but the header of imgui itself.
* the CMAKE step is not very clear. What is IMGUI_ROOT and what value is it set? I just added it my way :-)
* OpenGL is required so CMAKE also needs

find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(${OPENGL_LIBRARIES})
Create an issue about that and Stephen Ma (https://twitter.com/tehPHEN) will probably take a look at it (I'm not very good with CMAKE :D)


Edit:
There are two warnings. A trailing newline in imconfig-SFML.h and a unused parameter size in line 211 imgui-SFML.cpp. You want me to create a PR for that?
IMGUI is awesome but I've noticed those warnings too and I don't know how to fix them but apart from that it works great.
The warnings should be fixed now. The one with unused variable named 'size' was actually a bug, I need to use it.

Thanks!
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: FRex on August 22, 2016, 11:42:28 pm
I'm using this for something and I'd like to have icons on buttons. Is there a way to do that and still have three shades of button (idle, hovered, being pressed - I want entire sprite to change tint a little like normal buttons do) or not?

Also, is there some more powerful button function that'd let me catch right click or double click separately (I assume double click is possible in my code but I ask about a built in method)? I have a need to do one thing when button is pressed and another when it's double/right clicked.

And I have this code (inside a window begin+end pair of course) and it works only for the first right button, is that something with ids, using same texture, etc? What do I do?

sf::Sprite spr(m_iconstex);
    for(int i = 0; i < 5; ++i)
    {
        spr.setTextureRect(sf::IntRect(0, i * 32, 32, 32));
        if(imgui::ImageButton(spr, 1))
            std::printf("bum right\n");

        imgui::SameLine();
        spr.setTextureRect(sf::IntRect(32, i * 32, 32, 32));
        if(imgui::ImageButton(spr, 1))
            std::printf("bum left\n");
    }

I now changed it to
 sf::Sprite spr(m_iconstex);
    for(int i = 0; i < 5; ++i)
    {
        spr.setTextureRect(sf::IntRect(0, i * 32, 32, 32));
        imgui::PushID(2 * i + 0);
        if(imgui::ImageButton(spr, 1))
            std::printf("bum right\n");

        imgui::PopID();
        imgui::SameLine();
        spr.setTextureRect(sf::IntRect(32, i * 32, 32, 32));
        imgui::PushID(2 * i + 1);
        if(imgui::ImageButton(spr, 1))
            std::printf("bum left\n");

        imgui::PopID();
    }
and it works. I skimmed through the primer on ids in the faq and read your image button source and then image button function that it calls and it uses texture as id so that's why this happened.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on August 24, 2016, 09:37:36 am
The easiest way to do icons I've seen (even Omar recommended this for now) is to embed icons in your font and then use images as symbols. :D
As for other questions - I have no experience with that, sorry. :)
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: FRex on August 24, 2016, 06:03:25 pm
This is really bad, my icons are colorful, and I don't want to fiddle with a font if there is a shortcut to do picture on a button. I'll make them a little transparent and make background part 100% transparent or something but it's still really silly to not have such a feature when there are things like trees, sliders and windows and done so so well.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on August 25, 2016, 12:11:03 am
This is really bad, my icons are colorful, and I don't want to fiddle with a font if there is a shortcut to do picture on a button. I'll make them a little transparent and make background part 100% transparent or something but it's still really silly to not have such a feature when there are things like trees, sliders and windows and done so so well.
Oh, that makes situation a bit harder. I suggest you to just check out how ImGui::Button is implemented and try to implement the same stuff yourself by example. I don't think that inserting images and other stuff in regular buttons is supported at the moment.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on November 02, 2016, 08:27:37 pm
Okay, I've managed to finally remove push/pop/resetGLStates!
This took a lot of time to came up with, but looks like everything works fine! It would be nice to see people confirm this, so please, use the latest version and try it yourself. :)
This give 2-3x rendering speed improvements which is really awesome.

And btw, I want to improve interface a bit, by maing users to pass window/renderTarget into free functions like Update and Render, instead of ImGui-SFML having raw internal pointers to them.
Feel free to comment on this idea here here (https://github.com/eliasdaler/imgui-sfml/issues/12).
But from the responses I have already received, no one is against it, so I'm planning to start working on it soon.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on June 02, 2017, 01:09:45 am
One important change happened. Now you should call ImGui::SFML::Render(target), so that resetGLStates is called. It seems like it's necessary, because SFML changed something about the state which breaks stuff in some conditions. Maybe I'll be able to find out what exactly causes that.

(http://i.imgur.com/eXOR860.png)
I've finally found out how load custom fonts. I'll copy info from README:

Default font is loaded if you don't pass false in ImGui::SFML::Init. Call ImGui::SFML::Init(window, false); if you don't want default font to be loaded.

Load your fonts like this:
IO.Fonts->Clear(); // clear fonts if you loaded some before (even if only default one was loaded)
// IO.Fonts->AddFontDefault(); // this will load default font as well
IO.Fonts->AddFontFromFileTTF("font1.ttf", 8.f);
IO.Fonts->AddFontFromFileTTF("font2.ttf", 12.f);

ImGui::SFML::UpdateFontTexture(); // important call: updates font texture
And use them like this:
ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[0]);
ImGui::Button("Look at this pretty button");
ImGui::PopFont();

ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
ImGui::TextUnformatted("IT WORKS!");
ImGui::PopFont();
The first loaded font is treated as the default one and doesn't need to be pushed with ImGui::PushFont.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on September 01, 2017, 10:10:53 am
(https://user-images.githubusercontent.com/3527662/29950479-5c1b0a72-8ebc-11e7-94b7-dd107b5a2e52.png)
ImGui-SFML got Android port by Peter Repukat! Get it in the latest version.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Hawkrex on October 10, 2017, 11:33:11 pm
Hi,

first thank you for the lib <3

There's just one thing that don't work, when I try to do :
const sf::Texture& tex = TextureManager::getTexture("randomName");
ImGui::Image(tex);

but the compiler tells me :

Quote
'ImGui::Image' : the function doesn't take 1 argument

Can somebody help me please ?
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on October 13, 2017, 12:45:37 am
Are you sure you've included ImGui-SFML's header in this file?
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Hawkrex on October 14, 2017, 01:43:01 pm
I just find out that in the version of imgui-SFML.h I had, there was no include guard. So I added a #pragma once and it works.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: FRex on November 20, 2017, 05:34:39 am
I've made a script to merge imgui and imgui-sfml into a pair of files, maybe someone will find it useful too. https://gist.github.com/FRex/41b41708daf87d22cf3557766b9dff9b
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Glocke on January 06, 2018, 12:56:51 pm
Is there a way to use imgui & imgui-sfml using git submodules? I encountered a problem related to the custom     imgui config, which needs to be overwritten (as you wrote on your github readme). My workaround is to fork the official imgui, replace the config and use this repo as submodule. But I'm not satisfied by this solution.

Is there a way to determine an external imconfig without replacing the file?

Like
./
    extlibs/
        imgui --> submodule to the offical imgui
        imgui-sfml --> submodule to your imgui-sfml
    include/
        imconfig.h --> my custom imconfig


I want to keep thirdparty libs and my code separate.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: dabbertorres on January 06, 2018, 11:06:53 pm
I've just added a #include <imgui-sfml/imconfig-SFML.h> to my imconfig.h.

Make the compiler do the copying for me.

For reference, I have a similar project file structure:

./project-root/
    imgui/
    imgui-sfml/
    project/
        imconfig.h
        ...
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Glocke on January 11, 2018, 09:38:53 am
Make the compiler do the copying for me.

I didn't get it managed. Can you explain your approach more in detail, please? :)
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: dabbertorres on January 11, 2018, 04:26:32 pm
Sure.

Here's the project layout:
Code: [Select]
./
  imgui/
    imgui.h
    ...
  imgui-sfml/
    imconfig-SFML.h
    imgui-SFML.h
    ...
  project/
    imconfig.h
    main.cpp

project/imconfig.h contains
#include <imgui-sfml/imconfig-SFML.h>

project/main.cpp contains
#include <imgui.h>
#include <imgui-sfml/imgui-SFML.h>

I have the project root directory, project/, and imgui/ folders as include directories, ie: "-I$PROJECT_DIR -I$PROJECT_DIR/project -I$PROJECT_DIR/imgui"
This is needed because imgui.h has #include "imconfig.h", and imgui-SFML.cpp has #include <imgui.h>

You'll also have to make sure you delete, (or rename) imgui/imconfig.h, otherwise you'll run into conflicts at compile time with your project/imconfig.h
Or you could even just use imgui/imconfig.h, and not have a project/imconfig.h
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Zinidane on January 30, 2018, 06:43:28 pm
Just integrated it to my project... works great !

I want to do a tilemap like your example and i'm wondering how you did it ? Did you use a imagebutton for each tile ? Selectable something ?
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on February 01, 2018, 03:02:24 pm
Just integrated it to my project... works great !
Glad it works well for you!

I want to do a tilemap like your example and i'm wondering how you did it ? Did you use a imagebutton for each tile ? Selectable something ?
Nope, I'm drawing the image and then I detect a click on it. Then I just do this:
tileIndex = (clickPos - tileImagePos) / tileSize
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: FRex on February 09, 2018, 12:38:20 am
Context management is now explicit in imgui so your SFML-imgui doesn't work with imgui master head (i.e. it uses the now gone Shutdown()).
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on February 09, 2018, 08:37:04 am
Yes, an issue was created about that. I plan to create a separate branch to handle both master and latest release of Imgui. :)
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: FRex on February 09, 2018, 11:56:42 am
Great. It's kinda annoying there wasn't a shortcut provided by IMGUI since overloading functions was why it was in C++ in the first place. I'm using commit 07ee5390 from it now but it was surprising it failed to work out of the box on two masters.
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: Elias Daler on February 10, 2018, 01:08:40 am
Yeah, it was pretty weird to just merge it into master without time to react to that, heh. :/
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on April 08, 2018, 11:35:46 am
ImGui 1.60 is released! It has cool keyboard/gamepad navigation feature which I want to implement in ImGui-SFML soon.

Please check this out: https://github.com/eliasdaler/imgui-sfml/issues/51
There are lots of things which need to be discussed about implementing it and your opinion will help.
Title: Re: [Release][GUI] ImGui-SFML
Post by: DJuego on April 08, 2018, 01:01:17 pm
Elias. Thank you for your ImGui-SFML! It is a must for me! Happy that you want to improve it more and more. ;-)

DJuego
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on April 08, 2018, 02:00:52 pm
Elias. Thank you for your ImGui-SFML! It is a must for me! Happy that you want to improve it more and more. ;-)

DJuego

You're welcome. Glad that you enjoy using it. :)
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on April 22, 2018, 03:56:43 pm
(https://i.imgur.com/qP3E56l.gif)
ImGui 1.60 brought us awesome gamepad and keyboard nagivation support! Please test it and see how it works for you.

The navigation branch that you need to checkout to is here: https://github.com/eliasdaler/imgui-sfml/tree/navigation
See the default controls here: https://github.com/ocornut/imgui/issues/1599
Title: Re: [Release][GUI] ImGui-SFML
Post by: jamesL on April 27, 2018, 04:29:47 am
check out 3:17 of this video

https://www.youtube.com/watch?v=LSRJ1jZq90k
Title: Re: [Release][GUI] ImGui-SFML
Post by: Mysphyt on April 27, 2018, 04:59:37 am
Wow this library looks awesome. I'll definitely look into using it for my project (https://en.sfml-dev.org/forums/index.php?topic=23947.0 (https://en.sfml-dev.org/forums/index.php?topic=23947.0)), as I still need an options menu and various tool interfaces. I'm still pretty new to C++ and to SFML so reading these libraries has really helped me learn.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on April 27, 2018, 11:16:17 am
check out 3:17 of this video
He-he, yeah, I've seen it. Was pretty glad to be featured there. :)

Wow this library looks awesome. I'll definitely look into using it for my project (https://en.sfml-dev.org/forums/index.php?topic=23947.0 (https://en.sfml-dev.org/forums/index.php?topic=23947.0)), as I still need an options menu and various tool interfaces. I'm still pretty new to C++ and to SFML so reading these libraries has really helped me learn.
Hope you enjoy using it. :)
Title: Re: [Release][GUI] ImGui-SFML
Post by: Cpl.Bator on May 11, 2018, 06:40:55 pm
Thanks Elias, i have integrated your code with my program, all work fine.
But, i have a question, for sure, you have resolved it before, i need to create a small tile editor, i need to ignore
the mouse click when i am inside an imgui window, when i choose some options in my window, some tile will be pasted on the map...

i try this code, but that's doesnt work :

if (sf::Mouse::isButtonPressed(sf::Mouse::Left) && mSelectedTile != -1 && !ImGui::IsWindowHovered())
...

what is the trick ?

thanks.
Title: Re: [Release][GUI] ImGui-SFML
Post by: FRex on May 11, 2018, 07:32:21 pm
I did it like this (ignore the project, it's abandoned): https://github.com/FRex/editor/blob/master/src/Gui.cpp#L61
Title: Re: [Release][GUI] ImGui-SFML
Post by: Cpl.Bator on May 11, 2018, 07:53:23 pm
thanks, just "ImGui::GetIO().WantCaptureMouse" solved my problem.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on May 16, 2018, 11:46:34 pm
ImGui-SFML gets two new cool features along with SFML 2.5.0 release!

📋 Clipboard support
🐁 Native (system) mouse cursor support

They are implemented here: https://github.com/eliasdaler/imgui-sfml/tree/sfml-2.5.0
Title: Re: [Release][GUI] ImGui-SFML
Post by: eXpl0it3r on May 17, 2018, 08:47:54 am
Nice! Good job adapting it already! :)
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on May 17, 2018, 11:55:38 am
Nice! Good job adapting it already! :)
Thanks. :D
Title: Re: [Release][GUI] SFML + ImGui lib
Post by: JonathanFerro on June 16, 2018, 11:08:01 am
Default font is loaded if you don't pass false in ImGui::SFML::Init. Call ImGui::SFML::Init(window, false); if you don't want default font to be loaded.
Thanks Elias, i have read integrated your code with my program, all work fine.
But, i have a , for sure, you have resolved it before, i need over the counter phentermine37.5 (https://www.outlookindia.com/outlook-spotlight/top-3-phentermine-over-the-counter-alternatives-updated-2022-news-221450) to create a small tile editor, i need to ignore
the mouse click when i am inside an imgui window, when i choose some options in my window, some tile will be pasted on the map...


Thank you so much for this information regarding font as I want to load another font but was unable to do so. I was getting frustrated but your post saved me.
Title: Re: [Release][GUI] ImGui-SFML
Post by: poww10s on November 11, 2018, 07:52:48 am
Hi, I keep getting these errors, I've done all the recommended solutions but I'm unsure how to proceed.

Quote
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:38: undefined reference to `ImGui::SFML::Init(sf::RenderWindow&, bool)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:50: undefined reference to `ImGui::SFML::ProcessEvent(sf::Event const&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:60: undefined reference to `ImGui::SFML::Update(sf::RenderWindow&, sf::Time)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:61: undefined reference to `ImGui::Begin(char const*, bool*, int)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:63: undefined reference to `ImGui::End()'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:66: undefined reference to `ImGui::SFML::Render(sf::RenderTarget&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:72: undefined reference to `ImGui::SFML::Shutdown()'
collect2.exe: error: ld returned 1 exit status

This should just be a simple fix right? I feel like this is an obvious fix.
Title: Re: [Release][GUI] ImGui-SFML
Post by: eXpl0it3r on November 11, 2018, 02:15:43 pm
Do you link ImGui-SFML or are you including the source files in your build?
Title: Re: [Release][GUI] ImGui-SFML
Post by: poww10s on November 12, 2018, 12:45:05 am
I'm including the sources files in my project. or pointing to them in my includepaths.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on November 17, 2018, 09:54:24 am
Make sure that imgui-SFML.cpp is built in your project. If it isn't - you didn't add it to your project right.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Sub on November 21, 2018, 12:05:34 am
I just want to register my appreciation for you making these bindings and making them open source.  Works great.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on November 24, 2018, 03:41:00 pm
I just want to register my appreciation for you making these bindings and making them open source.  Works great.
Glad it works for you, and thanks. :)
Title: Re: [Release][GUI] ImGui-SFML
Post by: DerrickMcKibben on December 23, 2018, 11:31:45 am
Hi, I keep getting these errors, I've done all the Dbal max product (https://alvenda.com/dbal-max-review/) recommended solutions but I'm unsure how to proceed.

Quote
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:38: undefined reference to `ImGui::SFML::Init(sf::RenderWindow&, bool)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:50: undefined reference to `ImGui::SFML::ProcessEvent(sf::Event const&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:60: undefined reference to `ImGui::SFML::Update(sf::RenderWindow&, sf::Time)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:61: undefined reference to `ImGui::Begin(char const*, bool*, int)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:63: undefined reference to `ImGui::End()'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:66: undefined reference to `ImGui::SFML::Render(sf::RenderTarget&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:72: undefined reference to `ImGui::SFML::Shutdown()'
collect2.exe: error: ld returned 1 exit status

This should just be a simple fix right? I feel like this is an obvious fix.

I'm also getting the same errors whereas it worked for people above us. Strange, isn't it?
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on December 24, 2018, 02:49:17 pm
Hi, I keep getting these errors, I've done all the recommended solutions but I'm unsure how to proceed.

Quote
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:38: undefined reference to `ImGui::SFML::Init(sf::RenderWindow&, bool)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:50: undefined reference to `ImGui::SFML::ProcessEvent(sf::Event const&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:60: undefined reference to `ImGui::SFML::Update(sf::RenderWindow&, sf::Time)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:61: undefined reference to `ImGui::Begin(char const*, bool*, int)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:63: undefined reference to `ImGui::End()'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:66: undefined reference to `ImGui::SFML::Render(sf::RenderTarget&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:72: undefined reference to `ImGui::SFML::Shutdown()'
collect2.exe: error: ld returned 1 exit status

This should just be a simple fix right? I feel like this is an obvious fix.

I'm also getting the same errors whereas it worked for people above us. Strange, isn't it?

Hello. Please follow this tutorial: https://eliasdaler.github.io/using-imgui-with-sfml-pt1/

You probably didn't do step 5 in "Setting up"
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on February 24, 2019, 10:45:53 pm
Worked very hard on this branch of ImGui-SFML recently: https://github.com/eliasdaler/imgui-sfml/tree/develop

Please, check it out! See how easy it is to integrate ImGui-SFML into your CMake-based projects. If it all goes well for everyone, it'll be soon merged into master and ImGui-SFML v.2.0 will be here.

Basically, all you have to do now is this:

find_package(ImGui-SFML REQUIRED)
target_link_libraries(my_target PRIVATE ImGui-SFML::ImGui-SFML)
Title: Re: [Release][GUI] ImGui-SFML (v2.0)
Post by: Elias Daler on May 10, 2019, 05:57:53 pm
(https://i.imgur.com/vCXP1uu.png)

https://github.com/eliasdaler/imgui-sfml/releases/tag/v2.0

Note the updated usage requirements!

* SFML >= 2.5.0
* ImGui >= 1.68

This release greatly improves CMake and build support:


find_package(ImGui-SFML REQUIRED)
target_link_libraries(my_target PRIVATE ImGui-SFML::ImGui-SFML)


This release doesn't bring new features, but it's the first release which has proper version in CMake + it's just so good, it's a shame not to name it "2.0".

Semantic versioning will be used for future releases.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on May 13, 2019, 01:29:22 pm
ImGui-SFML users, your feedback is needed on the following issues:

https://github.com/eliasdaler/imgui-sfml/issues/78
https://github.com/eliasdaler/imgui-sfml/issues/80
Title: Re: [Release][GUI] ImGui-SFML
Post by: lanaroady on July 15, 2019, 10:42:32 am
I'm including the sources files in my project. or pointing to them in my includepaths https://www.redadair.com (https://www.redadair.com).

There are no source files are mention kindly make it possible as i am in need of that bro
Title: Re: [Release][GUI] ImGui-SFML
Post by: Balentine on October 02, 2019, 11:43:05 am
Hi, I keep getting these errors, I've done all the Dbal max product (https://alvenda.com/dbal-max-review/) recommended solutions but I'm unsure how to proceed.

Quote
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:38: undefined reference to `ImGui::SFML::Init(sf::RenderWindow&, bool)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:50: andarine s4 sarm results (https://www.fingerlakes1.com/2021/11/02/andarine-s4-sarm-results-andarine-s4-dosage-side-effects-before-and-after/) Testolone  (https://www.clevescene.com/cleveland/rad-140-results-testolone-sarm-rad-140-dosage-side-effects-before-and-after/Content?oid=37669434)  sarms dosage (https://www.fingerlakes1.com/2021/11/02/ac-262-536-sarms-dosage-side-effects-before-and-after-where-to-buy-ac-262356/)   gynectrol review (https://www.fingerlakes1.com/2021/10/27/gynectrol-review-gynectrol-dosage-side-effects-before-and-after-how-to-get-rid-of-man-boobs-fast-2022/)   SARM Myostatin YK11  (https://www.clevescene.com/cleveland/yk11-results-dosage-side-effects-before-and-after-best-sarms-for-sale-2022/Content?oid=37669424)   buy sarms online (https://www.fingerlakes1.com/2021/10/05/sarms-for-sale-where-to-buy-sarms-online-review-guide/)   crazy bulk reviews (https://www.fingerlakes1.com/2021/09/20/crazy-bulk-review-legal-steroids-for-sale-how-it-works-legal-steroids-gnc/)   complete guide undefined reference to `ImGui::SFML::ProcessEvent(sf::Event const&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:60: undefined reference to `ImGui::SFML::Update(sf::RenderWindow&, sf::Time)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:61: undefined reference to `ImGui::Begin(char const*, bool*, int)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:63: undefined reference to `ImGui::End()'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:66: undefined reference to `ImGui::SFML::Render(sf::RenderTarget&)'
D:\Daniel\Documents\Rust\rgRPG/src/main.cpp:72: undefined reference to `ImGui::SFML::Shutdown()'
collect2.exe: error: ld returned 1 exit status

This should just be a simple fix right? I feel like this is an obvious fix.

I'm also getting the same errors whereas it worked for people above us. Strange, isn't it?

yes same
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on October 02, 2019, 03:39:52 pm
What IDE/build system are you using? You're not linking to ImGui and ImGui-SFML, which means that you haven't included imgui.cpp, imgui_widgets.cpp and imgui-SFMLcpp to your build
Title: Re: [Release][GUI] ImGui-SFML
Post by: Hawkrex on July 19, 2020, 08:16:34 pm
Hello,

I used to work with Imgui 1.61 and SFML 2.5.0 (and your interface but can't remember the version), and I decided to update to Imgui 1.77, SFML 2.5.1 and imgui-sfml 2.1 but I have the following error when my program opens :

Quote
The procedure entry point ??0Cursor@sf@@QAE@XZ could not be located in the dynamic link library.


In the ouput I have :

Quote
Exception thrown at 0x77CF36F0 (ntdll.dll) in Test.exe: 0xC0000139: Entry Point Not Found.
The program '[0x1D90] Test.exe' has exited with code -1073741511 (0xc0000139) 'Entry Point Not Found'.

Do you have any idea of what's going wrong ?
Title: Re: [Release][GUI] ImGui-SFML
Post by: eXpl0it3r on July 23, 2020, 08:14:55 am
Make sure to rebuild Imgui-SFML with your new version and double check that you removed all the old binaries and header files.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on February 23, 2021, 02:09:47 am
ImGui-SFML v.2.2 is released. It's small, but it felt wrong to not have a release for the whole year...

https://github.com/eliasdaler/imgui-sfml/tree/v2.2

This release is an accumulation of small things which are important to release:

    - Dear ImGui >= 1.80 is now required. ImGui added imgui_tables.cpp and some
    of the functions were deprecated. It's important to stay up-to-date

    - Fixed Image/ImageButton and sf::RenderTexture problems (texture was
    shown upside down)

    - Removed an overload for Image/ImageButton which took sf::Texture and
    sf::IntRect textureRect. You should use sf::Sprite now.

    - Added sf::Cursor::Hand

    - Restored C++03 support

    - Fix MSVC warnings
Title: Re: [Release][GUI] ImGui-SFML
Post by: Sub on February 24, 2021, 12:43:11 am
Wow, I wasn't expecting any further releases on this since you changed over to your own engine.

Thank you, this is really nice and helpful.
Title: Re: [Release][GUI] ImGui-SFML
Post by: Paul on February 26, 2021, 01:52:34 pm
Thanks. And I thought the texture upside down was a feature :)
Title: Re: [Release][GUI] ImGui-SFML
Post by: Elias Daler on February 28, 2021, 12:07:32 am
Wow, I wasn't expecting any further releases on this since you changed over to your own engine.

Thank you, this is really nice and helpful.
Nope, it'll be maintained because I love SFML and I care about it's community even if I don't use it myself. Plus, it's still the most easy way to use Dear ImGui from scratch (compared to SDL/OpenGL way) - that's another thing which makes ImGui-SFML so important.
Title: Re: [Release][GUI] ImGui-SFML
Post by: vale on September 10, 2023, 06:03:47 am
Hi, I'm not exactly sure I understand how I should be using the events with sfml.

I'd like to know if, for example, a click happened on an Imgur pane/control rather than the rest of the window. Is there any way to know if the event actually had effect on the UI?
Title: Re: [Release][GUI] ImGui-SFML
Post by: FRex on September 10, 2023, 11:20:52 pm
Imgui (not Imgui-SFML) has a few globals for that called WantCaptureMouse, WantCaptureKeyboard, WantTextInput, etc.: https://github.com/ocornut/imgui/blob/master/imgui.h#L2081C17-L2081C33

I remember using those plus SFML event type (so if WantCaptureKeyboard is true then don't handle keyboard SFML event myself, etc.) and it was quite fine, I think.. I don't have the code anymore, but I'm sure it was using those.
Title: Re: [Release][GUI] ImGui-SFML
Post by: FRex on September 19, 2023, 09:26:10 pm
I am doing it right now in my own game and yes, it's simple (for basic cases, maybe it'll break later and require more code):
static bool isMouseEvent(const sf::Event& eve)
{
    switch(eve.type)
    {
    case sf::Event::MouseButtonPressed:
    case sf::Event::MouseButtonReleased:
    case sf::Event::MouseMoved:
        return true;
    default:
        return false;
    }
    return false;
}


static bool isKeyboardEvent(const sf::Event& eve)
{
    switch(eve.type)
    {
    case sf::Event::TextEntered:
    case sf::Event::KeyPressed:
    case sf::Event::KeyReleased:
        return true;
    default:
        return false;
    }
    return false;
}

bool Game::handleEventGui(const sf::Event& eve)
{
    ImGui::SFML::ProcessEvent(m_win, eve);

    if(ImGui::GetIO().WantCaptureMouse && isMouseEvent(eve))
        return true;

    if(ImGui::GetIO().WantTextInput && isKeyboardEvent(eve))
        return true;

    return false;
}