Comments (6)
Michael,
This a mistake / misleading point, I will correct it. The current library requires a C++ compiler. It is "C friendly" in the sense that the API is rather flat and it doesn't overly use C++ features, but it does use some (namespaces, default parameters, function overload, and templates for ImVector<>).
We could possibly get rid of namespace and the template ImVector<> class, but the use of default parameters and function overload are intimately connected to making the api simple and terse, so a straight C would require more entry points.
Note that it doesn't include any C++ header and AFAIK should link without the C++ standard library but I haven't tested that.
from imgui.
AFAIK should link without the C++ standard library but I haven't tested that.
Not that I've managed to actually use this yet--I'm mostly confused--but I have attempted to compile imgui.cpp
:
[ tup ] [0.275s] Executing Commands...
* 1) gcc imgui.o -o test -lm
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
imgui.o: In function `ImGuiWindow::ImGuiWindow(char const*, ImVec2, ImVec2)':
imgui.cpp:(.text+0x2767): undefined reference to `operator new(unsigned long)'
imgui.cpp:(.text+0x2791): undefined reference to `operator delete(void*)'
imgui.o: In function `ImGuiWindow::~ImGuiWindow()':
imgui.cpp:(.text+0x2817): undefined reference to `operator delete(void*)'
imgui.o: In function `ImGui::FindWindowSettings(char const*)':
imgui.cpp:(.text+0x2c29): undefined reference to `operator new(unsigned long)'
imgui.o: In function `ImGui::LoadSettings()':
imgui.cpp:(.text+0x2db7): undefined reference to `operator new[](unsigned long)'
imgui.cpp:(.text+0x2e11): undefined reference to `operator delete[](void*)'
imgui.cpp:(.text+0x3081): undefined reference to `operator delete[](void*)'
imgui.o: In function `ImGui::NewFrame()':
imgui.cpp:(.text+0x3435): undefined reference to `operator new(unsigned long)'
imgui.cpp:(.text+0x3d90): undefined reference to `operator delete(void*)'
imgui.o: In function `ImGui::Shutdown()':
imgui.cpp:(.text+0x3dff): undefined reference to `operator delete(void*)'
imgui.cpp:(.text+0x3eae): undefined reference to `operator delete(void*)'
imgui.cpp:(.text+0x3f67): undefined reference to `operator delete(void*)'
imgui.o: In function `ImGui::Begin(char const*, bool*, ImVec2, float, unsigned int)':
imgui.cpp:(.text+0x5d6d): undefined reference to `operator new(unsigned long)'
imgui.cpp:(.text+0x5e16): undefined reference to `operator new(unsigned long)'
imgui.cpp:(.text+0x7ee0): undefined reference to `operator delete(void*)'
imgui.cpp:(.text+0x7ef6): undefined reference to `operator delete(void*)'
imgui.o: In function `ImDrawList::AddArc(ImVec2 const&, float, unsigned int, int, int, bool, ImVec2 const&)':
imgui.cpp:(.text+0x15702): undefined reference to `__cxa_guard_acquire'
imgui.cpp:(.text+0x1573f): undefined reference to `__cxa_guard_release'
imgui.o: In function `ImGui::ShowTestWindow(bool*)':
imgui.cpp:(.text+0x19193): undefined reference to `__cxa_guard_acquire'
imgui.cpp:(.text+0x191b0): undefined reference to `__cxa_guard_release'
imgui.cpp:(.text+0x19e78): undefined reference to `__cxa_guard_acquire'
imgui.cpp:(.text+0x19e95): undefined reference to `__cxa_guard_release'
imgui.cpp:(.text+0x19fa8): undefined reference to `__cxa_guard_acquire'
imgui.cpp:(.text+0x19fcb): undefined reference to `__cxa_guard_release'
imgui.cpp:(.text+0x1a15e): undefined reference to `__cxa_guard_abort'
imgui.o:(.eh_frame+0x18b): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
You need both libm
and libstdc++
in the link list to get it to compile. Maybe should mention it in the README (would pull request this, but not sure where to put it.)
from imgui.
Thanks for trying it out. I have now removed the misleading suggestion that the lib may be suitable to raw C compilation, it isn't. What are you confused about?
from imgui.
Oh, basically everything 😄 There's some conceptual leaps--I haven't looked through all the immediate mode GUI references. And I'm not really interested in graphics programming, so I'm not sure what to make of the examples (is a D3D or GL context required to use this?)
But all that's not really relevant to this issue.
from imgui.
Can you build and run the examples?
When your application has ImGui setup you can run UI code in your application loop. Something like:
ImGui::Begin("My window"); // create window
if (ImGui::Button("Load"))
{
// call your loading code
}
ImGui::SameLine();
if (ImGui::Button("Save"))
{
// call your saving code
}
ImGui::End()
The idea is that the UI controls only "exist" when you call them. A button doesn't store any extra information, the button logic is processed immediately and ImGui output vertices so they can be rendered (later). This way of working reduce the amount of synchronisation between your data and your UI because you will always create the UI with the correct data. As opposed to a typcial retained mode UI where you have to create a control, react to event, destroy the control, and update its state if your underlynig data changed (this last step is typically causing lots of bugs).
Some references about the concept
http://www.cse.chalmers.se/edu/year/2011/course/TDA361/Advanced%20Computer%20Graphics/IMGUI.pdf
http://sol.gfxile.net/imgui/
https://mollyrocket.com/861
from imgui.
This is also a good read about ImGui
http://www.johno.se/book/imgui.html
I have added all those links in the README file.
from imgui.
Related Issues (20)
- Drag and Drop from Menubar HOT 5
- What's the proper way to render custom text or custom items in the "key"/"label" of a TreeNode? HOT 8
- Begin() to append doesn't set LastItemData for title-bar/tab (was `BeginItemTooltip` may react to wrong widgets?) HOT 2
- Glfw + Vulkan: backend don't properly handle when vkQueuePresentKHR & vkAcquireNextImageKHR produce VK_ERROR_OUT_OF_DATE_KHR HOT 2
- SetWindowFocus and Open/BeginPopup on right click breaks IsItemDeactivated HOT 1
- How to make hover highlighting on (many) overlapping InputTexts? HOT 14
- WebGPU sampler set to WGPUAddressMode_Repeat causes image rendering issues HOT 2
- SDL3 SDL_KeyCode no longer an enum HOT 2
- Frame hover glitch when moving on adjacent item border, with SetNextItemAllowOverlap HOT 2
- Frame hover glitch when moving on overlapping item border, with SetNextItemAllowOverlap HOT 2
- Dummy does not respect SetNextItemAllowOverlap HOT 2
- Cancelling of touchpad double-tap dragging by keyboard gets lost
- Edit ImGui's Window Title to add a button HOT 1
- HiDPI with Emscripten and GLFW
- ImGui not using the entire screen surface with Android NDK HOT 2
- Windows + V doesn't paste value using SDL HOT 4
- DragFloat: incorrect work of clamp value, when we set it by ctrl+click HOT 1
- Strange endian behaviour causing ImU32 colors to be flipped HOT 5
- How to know why glad failed to load. HOT 1
- Can't hide "Hide tab bar" button when window is in dock HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.