Browse Source

Tidying up

pull/291/head
ocornut 9 years ago
parent
commit
abf823c6f6
  1. 4
      imgui.cpp
  2. 3
      imgui_draw.cpp
  3. 12
      imgui_internal.h

4
imgui.cpp

@ -468,7 +468,6 @@
#include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_FUNCTIONS
#include "imgui_internal.h"
#include <ctype.h> // toupper, isprint
@ -5798,8 +5797,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
SetActiveID(id, window);
FocusWindow(window);
const bool is_ctrl_down = g.IO.KeyCtrl;
if (tab_focus_requested || is_ctrl_down)
if (tab_focus_requested || g.IO.KeyCtrl)
{
start_text_input = true;
g.ScalarAsInputTextId = 0;

3
imgui_draw.cpp

@ -14,9 +14,8 @@
#include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_FUNCTIONS
#include "imgui_internal.h"
#include <stdio.h> // vsnprintf, sscanf, printf
#include <new> // new (ptr)
#if defined(_MSC_VER) || defined(__MINGW32__)

12
imgui_internal.h

@ -3,16 +3,12 @@
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
// Implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)
// #define IMGUI_ENABLE_MATH_OPERATORS
// Implement maths functions:
// #define IMGUI_ENABLE_MATH_FUNCTIONS
// #define IMGUI_DEFINE_MATH_OPERATORS
#pragma once
#include <stdio.h> // FILE*
#ifdef IMGUI_DEFINE_MATH_FUNCTIONS
#include <math.h> // sqrtf()
#endif
//-----------------------------------------------------------------------------
// Forward Declarations
@ -35,7 +31,7 @@ typedef int ImGuiLayoutType; // enum ImGuiLayoutType_
typedef int ImGuiButtonFlags; // enum ImGuiButtonFlags_
//-------------------------------------------------------------------------
// STB libraries implementation
// STB libraries
//-------------------------------------------------------------------------
namespace ImGuiStb
@ -113,7 +109,6 @@ static inline ImVec2& operator/=(ImVec2& lhs, const float rhs)
static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-lhs.w); }
#endif
#ifdef IMGUI_DEFINE_MATH_FUNCTIONS
static inline int ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; }
static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; }
static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; }
@ -129,10 +124,9 @@ static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t)
static inline float ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; }
static inline float ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; }
static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; }
#endif
//-----------------------------------------------------------------------------
// Declarations
// Types
//-----------------------------------------------------------------------------
enum ImGuiButtonFlags_

Loading…
Cancel
Save