GithubHelp home page GithubHelp logo

imspinner's People

Contributors

azurehaze21 avatar dalerank avatar dcnieho avatar inobelar avatar madman10k avatar pthom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imspinner's Issues

Typo?

On line 1671 i see SpinnerTrianglesSeletor is that a typo and should be SpinnerTrianglesSelector?

Compile errors

When trying to compile, I get the following errors:

  • [E0028] Expression must have a constant value (Line 46)
  • [E0028] Expression must have a constant value (Line 47)
  • [E0028] Expression must have a constant value (Line 48)
    image

Missing `min` prevents compiling.

Howdy!

First, thanks for these fantastic spinners, I absolutely love them. (Quick aside: do you have a ko-fi or other similar for a one-time donation?)

So my issue is really sortof a non-issue, and I imagine is probably more related to my platform and toolchain than anything, but I just was hoping to get your opinion on the "proper" way to solve it.

I'm using Microsoft's toolchain, (particularly cl 19.33.31630 with the win 10 sdk v10.0.19041,) targeting an x86_64 platform. When I include imspinner.h, there's no global min symbol defined, so compiling fails.

I could obviously define one before including it or etc, but I was just mostly curious if there's a specific min macro/method you're invoking there. Perhaps if you're intending to use std::min, a patch like this may clarify intent?

diff --git a/imspinner.h b/imspinner.h
index ac274f5..4e160fb 100644
--- a/imspinner.h
+++ b/imspinner.h
@@ -28,6 +28,7 @@
 
 #include <functional>
 #include <array>
+#include <algorithm>
 
 namespace ImSpinner
 {
@@ -317,7 +318,7 @@ namespace ImSpinner
         // Render
         float start = (float)ImGui::GetTime() * speed;
         const float bg_angle_offset = IM_PI * 2.f / dots;
-        dots = min(dots, 32);
+        dots = std::min(dots, (size_t)32);
 
         float def_nextdot = 0;
         float &ref_nextdot = nextdot ? *nextdot : def_nextdot;
@@ -354,7 +355,7 @@ namespace ImSpinner
         // Render
         float start = (float)ImGui::GetTime() * speed;
         const float bg_angle_offset = IM_PI * 2.f / dots;
-        dots = min(dots, 32);
+        dots = std::min(dots, (size_t)32);
 
         for (size_t i = 0; i <= dots; i++)
         {
@@ -1123,7 +1124,7 @@ namespace ImSpinner
       float astart = ImFmod(start, IM_PI / dots);
       start -= astart;
       const float bg_angle_offset = IM_PI / dots;
-      dots = min(dots, 32);
+      dots = std::min(dots, (size_t)32);
 
       for (size_t i = 0; i <= dots; i++)
       {

Cheers and hope you're well.

unneccesary conversion of colors in default arguments

The library has many instances of spinner with functions signatures such as this:

void SpinnerAng(const char *label, float radius, float thickness, const ImColor &color = 0xffffffff, const ImColor &bg = 0xffffff80, float speed = 2.8f, float angle = IM_PI)

I want to highlight the arguments like const ImColor &color = 0xffffffff. It is nice that you accept an ImColor and not an ImU32, as that gives much flexibility to users. However, using an unsigned int as default value triggers unnecessary conversion since ImColor stores colors internally as four floats. I propose to change these to signatures like const ImColor &color = {1.f,1.f,1.f,1.f}, which is slightly less compact but saves both the bitshift and division needed to perform the color conversion. I have looked through, and all the default color values can be types exactly with either 1.f or .5f, thats the only default component intensities specified in the library.

This may seem a change with small benefit for C++ users. However, I am helping @pthom out a bit with a project that provides an automatically generated python wrapper for imgui and popular imgui libraries including imspinner. There we ran into an issue with these default parameters. Long story short, we had to solve it by manually changing the generated code, which is a maintenance headache. So while it is a minor optimization for C++ users, it would have a large impact on us.

I am of course prepared to send a pull request implementing these changes. Would you be happy to receive that?

ImSpinner and Global Alpha Value

Hello, I am enjoying ImSpinner so far but there is one slight problem.
For some reason, all ImSpinners seem to ignore the global alpha value.
I am working on a fade transition effect. When I use my fade functions,
-which manipulate the global alpha value- everything is affected by
the alpha change except for ImSpinners. I would really appreciate some
input on this. Thanks in advance and amazing job with ImSpinner.

Spinner concept: HBO Max style

You seem to be adding lovely spinners regularly, so I figured I'd bring you a concept I noticed that you didn't quite have yet.

This is the spinner from HBO Max:

hbo-max-spinner

Looks sorta like a combination between ImSpinner::SpinnerFadeDots() and ImSpinner::SpinnerMovingDots(), with the exception that the dots only move or fade, never both at the same time. Kinda gives it a nifty little "3D" effect like they're circling around something. (May be interesting if they scaled instead of faded, too!)

Feel free to close if you're not interested; thanks for all the lovely animations!

Annoucing Dear ImGui Bundle including imspinner and many others; with support for C++, Python and emscripten

I'm happy to announce the first public release of Dear ImGui Bundle. Dear ImGui Bundle is a bundle for Dear ImGui, including many powerful libraries from its ecosystem. It enables to easily create ImGui applications in C++ and Python, under Windows, macOS, Linux, emscripten. It is aimed at application developers, researchers, and beginner developers who want to quickly get started.

imspinner is a included in the widgets provided with it.

@dalerank: sorry to hijack the issues list for this, and feel to close this issue; as this is just for your information. I informed @ocornut yesterday, and I plan to communicate about it in the ImGui gallery in the next hours.

Some suggestions to be closer to imgui coding style

Great job on this!

Some suggestions

  • It doesn't look like the bool return value are useful and they are inconsistent with how imgui uses bool. Maybe better to simply not return a value.
  • Replace using <array> with regular C array.
  • Use ImFmod() instead of fmodf, ImAbs(), ImMax(), ImMin()
  • Remove the two static variables in SpinnerRotateDots(), use ImGui::GetTime(). For velocity may use window storage (map id to float) or reformulate the logic to be stateless (should be possible).
  • Segments count can be calculated from size using the low-level helpers in imgui_draw.cpp

Structure (debatable)

  • May make sense to move things into a ImSpinner namspace.
  • May make sense to separate the code into a header file and a .cpp file, allowing the .cpp file to use #include "imgui_internal.h". A single spot user can still include both files from same location. Header file makes API more discoverable.

Sorry for the spam, hope some of those are useful :)

ISO-8859-1 encoding instead UTF-8

I found, that currently it imposible to edit imspiner.h from browser, since it's non-utf-8:

image

Can you please change encoding for it? This will be very useful, because now, even to edit single line, we need to clone the entire repository to the local machine, then edit and commit & push changes, instead of doing it in one-click from the browser :)

Can't Compile

Hi - Awesome work on these spinners.

Please bear with me, as I have been mostly developing with embedded style (mostly Arduino) c/c++ programming and have just started getting into desktop development and most recently into dear imgui.

I've been able to create an imgui environment with imgui, implot, imgui-knobs, etc in VS2022 on Win10. It compiles and runs just fine. Once I include imspinner.h, it is giving me tons of "identifier not found", "undeclared identifier", etc.

Here is my build output:
Build started... 1>------ Build started: Project: imgui-implot-knobs-template, Configuration: Debug x64 ------ 1>imgui-implot-knobs-template.cpp 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(51,5): error C3861: 'IM_PI': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(51,5): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(60,9): error C2065: 'ImGuiWindow': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(60,22): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(60,38): error C2039: 'GetCurrentWindow': is not a member of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(3226): message : see declaration of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(60,54): error C3861: 'GetCurrentWindow': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(61,13): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(64,28): error C2065: 'GImGui': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(65,36): error C2027: use of undefined type 'ImGuiContext' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(149): message : see declaration of 'ImGuiContext' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(65,33): error C2530: 'style': references must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(66,28): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(66,23): error C2737: 'id': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(68,15): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(71,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(71,22): error C2146: syntax error: missing ';' before identifier 'bb' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(71,22): error C3861: 'bb': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(72,16): error C2039: 'ItemSize': is not a member of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(3226): message : see declaration of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(72,25): error C2065: 'bb': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(72,24): error C3861: 'ItemSize': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(74,18): error C2065: 'bb': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(75,21): error C2039: 'ItemAdd': is not a member of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(3226): message : see declaration of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(75,29): error C2065: 'bb': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(75,12): error C3861: 'ItemAdd': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(113,9): error C2065: 'ImGuiWindow': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(113,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(113,9): error C2039: 'GetCurrentWindow': is not a member of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(3226): message : see declaration of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(113,9): error C3861: 'GetCurrentWindow': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(116,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(117,37): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(117,22): error C2737: 'num_segments': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(118,29): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(118,23): error C3861: 'ImAbs': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(120,29): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(120,21): error C2737: 'a_min': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(121,29): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(121,21): error C2737: 'a_max': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(126,13): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(126,60): error C3861: 'ImCos': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(127,53): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(129,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(132,172): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(134,9): error C2065: 'ImGuiWindow': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(134,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(134,9): error C2039: 'GetCurrentWindow': is not a member of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(3226): message : see declaration of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(134,9): error C3861: 'GetCurrentWindow': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(137,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(138,37): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(138,22): error C2737: 'num_segments': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(140,39): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(140,21): error C2737: 'bg_angle_offset': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(144,13): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(144,60): error C3861: 'ImCos': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(144,90): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(146,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(148,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(153,13): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(153,60): error C3861: 'ImCos': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(153,90): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(155,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(165,7): error C2065: 'ImGuiWindow': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(165,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(165,7): error C2039: 'GetCurrentWindow': is not a member of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(3226): message : see declaration of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(165,7): error C3861: 'GetCurrentWindow': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(168,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(169,35): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(169,20): error C2737: 'num_segments': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(171,37): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(171,19): error C2737: 'bg_angle_offset': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(175,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(175,56): error C3861: 'ImCos': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(175,86): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(177,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(179,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(179,59): error C3861: 'ImCos': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(179,93): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(180,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(180,59): error C3861: 'ImCos': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(180,106): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(185,7): error C2065: 'ImGuiWindow': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(185,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(185,7): error C2039: 'GetCurrentWindow': is not a member of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imgui\imgui.h(3226): message : see declaration of 'ImGui' 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(185,7): error C3861: 'GetCurrentWindow': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(187,31): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(188,33): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(188,21): error C2737: 'radiusbId': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(192,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(193,35): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(193,20): error C2737: 'num_segments': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(195,37): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(195,19): error C2737: 'bg_angle_offset': const object must be initialized 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(197,37): error C2065: 'IM_PI': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(197,23): error C3861: 'ImFmod': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(198,24): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(203,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(203,56): error C3861: 'ImCos': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(203,87): error C3861: 'ImSin': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(205,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(210,36): error C3861: 'ImMax': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(210,20): error C3861: 'ImMax': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(218,36): error C3861: 'ImMax': identifier not found 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(219,7): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(223,9): error C2065: 'window': undeclared identifier 1>C:\VSCode_git_repos\imgui-implot-knobs-template-vs\imspinner\imspinner.h(223,15): fatal error C1003: error count exceeds 100; stopping compilation 1>Done building project "imgui-implot-knobs-template.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

For reference, I am using the imgui-docker branch, the master branch of implot, and the master branch of imgui-knobs. This is using a very slightly modified version of the directx12 example code (to add in implot and imgui-knobs and of course imspinner) from imgui.

Am I including the header wrong, do I have to add something to this header or imgui-implot-knobs-template.cpp to make it work? I feel like I am missing some small #includes or something of that nature since I am getting so many errors.

So far I have tried including "imgui.h" to this header and while there are less errors, I am still getting the majority of the ones I pasted above.

Please let me know what further information you need and what I can provide for you so that I can get a push in the right direction in learning how this library interfaces with imgui.

Thank you,
Ryan

git history is a bit heavy

Hi,

Many thanks for this beautiful library which I find actually useful.
I'm working on integrating it into another open source library (https://github.com/pthom/imgui_bundle)

However, the git history of this repo is quite heavy, which makes it difficult to add it as a submodule.

> git clone https://github.com/dalerank/imspinner
Cloning into 'imspinner'...
remote: Enumerating objects: 303, done.
remote: Counting objects: 100% (56/56), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 303 (delta 31), reused 39 (delta 15), pack-reused 247
Receiving objects: 100% (303/303), 97.89 MiB | 9.94 MiB/s, done.
Resolving deltas: 100% (119/119), done.

(base) ➜  ramdisk cd imspinner
(base) ➜  imspinner git:(master) du -sh *
4.0K	LICENSE.txt
4.0K	README.md
104K	imspinner.h
1.8M	spinners.gif
(base) ➜  imspinner git:(master) du -sh .git
 98M	.git       # (!!!!)

Reducing the history size would mean rewriting the entire history and remove the commits that were adding large files which were then removed. Not very convenient, I guess.

However, this is not a very concerning issue. Feel free to close this if this is too much trouble.

Thanks and congrats again!

lack of examples

for a beginner, ImSpinner::demoSpinners(); is a bad example and its complicated.

damped_gravity

not all control paths of the damped_gravity(...) return a value

Compilation errors if included in multiple translation units

First of all thanks for the spinners, they're great!

About my device specs

Here is some information about the system I'm developing the application on:

  1. OS: Funtoo linux on the "next" branch
  2. GCC version: 11.3.0
  3. GNU libc version: 2.33
  4. Build system for the application: CMake using GCC and Ninja
  5. C++ Standard used for compilation: C++ 20
  6. Version of dear imgui: latest commit under the docking branch(synced to latest every 6 hours if new commits are available)

About the application

The application I'm developing is a GUI Application framework based on dear imgui. Because libraries such as this are in wide use I decided it would provide good user experience to the future users of the framework to have useful libraries such as this one compile option away

To make handling of includes and other utility code such as settings serialization, all libraries get included into a master "module manager" header file. Because of this when the compile option for imspinner is enabled the header for imspinner gets included in about 13 translation units. When compiling I get a multiple definitions error like this one:

/home/i-use-gentoo-btw/Documents/UntitledImGuiFramework/Projects/ude-session-logout/Framework/Modules/Spinners/ThirdParty/imspinner/imspinner.h:883: multiple definition of `ImSpinner::SpinnerBarsScaleMiddle(char const*, float, ImColor const&, float, unsigned long)'; CMakeFiles/UntitledImGuiFramework.dir/Framework/Core/Components/Instance.cpp.o:/home/i-use-gentoo-btw/Documents/UntitledImGuiFramework/Projects/ude-session-logout/Framework/Modules/Spinners/ThirdParty/imspinner/imspinner.h:883: first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/UntitledImGuiFramework.dir/Source/MainView.cpp.o: in function `ImSpinner::SpinnerAngTwin(char const*, float, float, float, ImColor const&, ImColor const&, float, float, unsigned long)':

and that's basically the only issue with compiling the application

How to resolve it

There are 2 ways to resolve this issue:

  1. Prepend inline to the start of every function definition
  2. Convert the library from a single header library to one with translation units

I have a working fork of the library that implements solution 1, because that's the simplest solution and because I want to be able to use the IMGUI_API macro to export the functions from a DLL if needed and that would mean that all functions will still need to be prefixed with something.

If you're fine with using option 1 I will happily make a merge request :)

Other compilation problems that might be good to fix

Even though this is not necessarily needed, it would be nice if imspinner also automatically included the imgui.h and imgui_internal.h files. Since these files are required by other libraries to be in the include path for the application so that the #include "imgui.h" call is successful from any header, it wouldn't be such a problem to also add these headers. This can be done like this:

#if __has_include(<imgui.h>)
    #include "imgui.h"
    #include "imgui_internal.h"
#else
    #error "Couldn't find imgui.h in the header include path, please add it to the path!"
#endif

Of course not having these includes is an understandable design decision so if you decide you don't want code that includes them like the one above, I'd recommend to at least add an entry to the README.md that tells the user about this, this can either be text or just a link to #3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.