@ -236,6 +236,18 @@ static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_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 ; }
static inline ImVec2 ImMul ( const ImVec2 & lhs , const ImVec2 & rhs ) { return ImVec2 ( lhs . x * rhs . x , lhs . y * rhs . y ) ; }
// Helper: ImBoolVector. Store 1-bit per value.
// Note that Resize() currently clears the whole vector.
struct ImBoolVector
{
ImVector < int > Storage ;
ImBoolVector ( ) { }
void Resize ( int sz ) { Storage . resize ( ( sz + 31 ) > > 5 ) ; memset ( Storage . Data , 0 , ( size_t ) Storage . Size * sizeof ( Storage . Data [ 0 ] ) ) ; }
void Clear ( ) { Storage . clear ( ) ; }
bool GetBit ( int n ) const { int off = ( n > > 5 ) ; int mask = 1 < < ( n & 31 ) ; return ( Storage [ off ] & mask ) ! = 0 ; }
void SetBit ( int n , bool v ) { int off = ( n > > 5 ) ; int mask = 1 < < ( n & 31 ) ; if ( v ) Storage [ off ] | = mask ; else Storage [ off ] & = ~ mask ; }
} ;
// Helper: ImPool<>. Basic keyed storage for contiguous instances, slow/amortized insertion, O(1) indexable, O(Log N) queries by ID over a dense/hot buffer,
// Honor constructor/destructor. Add/remove invalidate all pointers. Indexes have the same lifetime as the associated object.
typedef int ImPoolIdx ;