-
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! :)
-
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?
-
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. :)
-
About the problem I mentioned, it happens when you use sf::RenderWindow::setFramerateLimit(...). If you don't set a limit it works fine.
-
Is this or something similar to this available for the SFML.NET Bindings?
-
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.
-
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?
-
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.
-
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!
-
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.
-
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. :)
-
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.
-
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.
-
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.
-
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.
-
(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.
-
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 :
'ImGui::Image' : the function doesn't take 1 argument
Can somebody help me please ?
-
Are you sure you've included ImGui-SFML's header in this file?
-
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.
-
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
-
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.
-
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
...
-
Make the compiler do the copying for me.
I didn't get it managed. Can you explain your approach more in detail, please? :)
-
Sure.
Here's the project layout:
./
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
-
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 ?
-
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
-
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()).
-
Yes, an issue was created about that. I plan to create a separate branch to handle both master and latest release of Imgui. :)
-
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.
-
Yeah, it was pretty weird to just merge it into master without time to react to that, heh. :/
-
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.
-
Elias. Thank you for your ImGui-SFML! It is a must for me! Happy that you want to improve it more and more. ;-)
DJuego
-
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. :)
-
(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
-
check out 3:17 of this video
https://www.youtube.com/watch?v=LSRJ1jZq90k
-
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.
-
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. :)
-
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.
-
I did it like this (ignore the project, it's abandoned): https://github.com/FRex/editor/blob/master/src/Gui.cpp#L61
-
thanks, just "ImGui::GetIO().WantCaptureMouse" solved my problem.
-
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
-
Nice! Good job adapting it already! :)
-
Nice! Good job adapting it already! :)
Thanks. :D
-
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.
-
Hi, I keep getting these errors, I've done all the recommended solutions but I'm unsure how to proceed.
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.
-
Do you link ImGui-SFML or are you including the source files in your build?
-
I'm including the sources files in my project. or pointing to them in my includepaths.
-
Make sure that imgui-SFML.cpp is built in your project. If it isn't - you didn't add it to your project right.
-
I just want to register my appreciation for you making these bindings and making them open source. Works great.
-
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. :)
-
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.
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?
-
Hi, I keep getting these errors, I've done all the recommended solutions but I'm unsure how to proceed.
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"
-
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)
-
(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:
- Added versioning to CMake
- Added better install rules
- You can now easily link to ImGui-SFML - just do this:
find_package(ImGui-SFML REQUIRED)
target_link_libraries(my_target PRIVATE ImGui-SFML::ImGui-SFML)
- Can now build ImGui-SFML as shared library
- Can now provide path and name to custom imconfig if you don't want to use default imconfig-SFML.h
- Fixed some warnings on some compiers
- Check ImGui and SFML version in CMake
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.
-
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
-
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
-
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.
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
-
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
-
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 :
The procedure entry point ??0Cursor@sf@@QAE@XZ could not be located in the dynamic link library.
In the ouput I have :
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 ?
-
Make sure to rebuild Imgui-SFML with your new version and double check that you removed all the old binaries and header files.
-
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
-
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.
-
Thanks. And I thought the texture upside down was a feature :)
-
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.
-
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?
-
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.
-
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;
}