In the case this is a thread_local variable it is best to avoid fetching too many times.
Either way local caching tends to be beneficial as a non-local variable would often be fetched multiple times.
* Use snprintf instead of sprintf in implot_demo.cpp
* Enlarged text buffer
Co-authored-by: BenBE <BenBE@geshi.org>
Co-authored-by: BenBE <BenBE@geshi.org>
* implot_items.cpp: support types customization
You can customize the supported types in two ways:
1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
-DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)"
Details:
- `CALL_INSTANTIATE_FOR_NUMERIC_TYPES` will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types. It uses a trick to be able to loop on the type list `IMPLOT_NUMERIC_TYPES`
- `INSTANTIATE_MACRO` needs to be defined, then undefined before and after each template instantiation
* CI: link example app, with null backend
Github's CI will now compile ImGui, compile ImPlot, link and run an example application (with no backend).
It serves as a proof that an app can be built, linked, and run, with type customization.
- .github/example_implot.cpp is an example app built with Dear ImGui and ImPlot
This app uses implot and imgui, but does not output to any backend!
If `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` is active, it will test that `long double` is supported.
- Corrected arch matrix options:
32 bits or 64 bits for win and linux
x86_64 or arm64 for mac (32 bits is deprecated on macs, and will not link with recent XCode)
- Added `IMPLOT_NUMERIC_SETIMPLOT_NUMERIC_SET` as a switch to CMakeList
This switch is currently not used in CI, but can be used during development.
It could be later be used in the matrix options, at the cost of increasing the number of build
per workflow.
Note: support for MingW 32 bits was commented out. MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries. As a result, the windows matrix was spearated into Windows_MSVC and Windows_MingW
* implot_items: INSTANTIATE_FOR_NUMERIC_TYPES / add long & long double (Fix#319)
- INSTANTIATE_FOR_NUMERIC_TYPES is a macro which instantiates templated plotting functions for numeric types.
This macro helps reduce some boilerplate code for template functions instantiations.
- Added optional support for more numeric types (long and long double)
The numeric type list does not include "long", "unsigned long" and "long double".
Most of the time, it is not an issue when linking statically.
However, when linking dynamically, issues related to undefined functions can arise:
although those types might have the same size, they are considered separate.
define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES) in order to define versions for those types
In this case, the compilation time for this specific file will be 33% longer
- implot_internal.h / ImMean and ImStdDev: added cast to double
(suppress MSVC warning about downcasting)
- Notes about numeric types "synonyms":
Even if "long double" and "double" might occupy the same size,
they are not complete synonyms, and it is legal to define overloads for both double and long double.
On some platforms, "unsigned long" might be the same size as "unsigned long long",
but it is nonetheless a separate type: see https://godbolt.org/z/1KWv5re7q (example with GCC 64 bits)
On some other platforms, "long double" might be the same size as "double", but it is nonetheless a separate type: see https://godbolt.org/z/ae71P7rqG (example with MSVC 64 bits)
* IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES: disabled by default
* uppercase template instantiatation macros & group them
* implot_items.cpp: reword comments on IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES
* README.md: mention compile-time option IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES
* Github CI: IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES=1