ImGui::Text() assumes that the incoming text is intended to be
formatted, but we don't actually use it to format anything. We can be
explicit by using the relevant function.
This also has a plus of not needing to go through the formatter itself,
but the gains from that are probably minimal.
Previously these functions were declared without the static specifier,
giving them external linkage, which isn't really ideal.
Instead, we can place these functions up by the relevant file-scope
variables and place them inside an anonymous namespace with said variables,
giving them internal linkage.
Now that the std::map less-than comparitor is capable of being used with
heterogenous lookup, we're able to convert many of the querying
functions that took std::string references over to std::string_view.
Now these functions may be used without potentially allocating a
std::string instance unnecessarily.
Previously, when performing find() operations or indexing operations on
the section map, it would need to operate on a std::string key.
This means cases like:
map.find(some_string_view)
aren't usable, which kind of sucks, especially given for most cases, we
use regular string literals to perform operations in calling code.
However, since C++14, it's possible to use heterogenous lookup to avoid
needing to construct exact key types. In otherwords, we can perform the
above or use string literals without constructing a std::string instance
around them implicitly.
We simply need to specify a member type within our comparison struct
named is_transparent, to allow std::map to perform automatic type
deduction.
We also slightly alter the algorithm to an equivalent compatible with
std::string_view (which need not be null-terminated), as strcasecmp
requires null-terminated strings.
While we're at it, we can also provide a helper function to the struct
for comparing string equality rather than only less than. This allows
removing other usages of strcasecmp in other functions, allowing for the
transition of them to std::string_view.
fmt diverges from printf in that '.' as a precision specifier may only
be used for floating-point values (makes sense, given it's indicating
precision after the decimal point).
This fixes the problem where OBS game capture only grabs the region
inside an ImGui window whenever one is open, when using the OpenGL
backend. Shouldn't have any negative effects, as the scissor would've
been something completely arbitrary anyways.
This may affect other capture software that uses the same hooking
method, but I've only tested OBS.
Begins the transition to using fmt for string formatting where
applicable. Given fmt supports formatting std::string instances out of
the box, we can remove now-unnecessary calls to .c_str() and .data().
Note that this change does not touch the actual logging subsystem aside
from converting the final StringFromFormat call in the process over to
fmt::format. Given our logging system is heavily used throughout the
entire codebase, and converting that over will be quite a large change
by itself, this will be tackled near the end of the conversion process.