Internals: Added ImLinearSweep() helper.

This commit is contained in:
omar 2017-10-19 19:29:59 +02:00
parent 370a48c10b
commit d3c2e904d8
2 changed files with 2 additions and 0 deletions

View File

@ -236,6 +236,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL) - misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
- misc: provide HoveredTime and ActivatedTime to ease the creation of animations. - misc: provide HoveredTime and ActivatedTime to ease the creation of animations.
- misc: fix for compilation settings where stdcall isn't the default (e.g. vectorcall) (#1230) - misc: fix for compilation settings where stdcall isn't the default (e.g. vectorcall) (#1230)
- misc: detect user not calling Render() and suggest to call EndFrame()?
- remote: make a system like RemoteImGui first-class citizen/project (#75) - remote: make a system like RemoteImGui first-class citizen/project (#75)
- demo: add vertical separator demo - demo: add vertical separator demo

View File

@ -154,6 +154,7 @@ static inline float ImFloor(float f)
static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)v.x, (float)(int)v.y); } static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)v.x, (float)(int)v.y); }
static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; } static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); } static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax. // We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions. // Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.