1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Tweaks, more consistent #define names

This commit is contained in:
ocornut 2014-08-14 14:31:13 +01:00
parent a905505cca
commit f30d23a502
3 changed files with 16 additions and 12 deletions

View File

@ -4,18 +4,22 @@
#pragma once
// Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h
//---- Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h
//#include <vector>
//#define ImVector std::vector
//#define ImVector MyVector
// Define assertion handler. Default to calling assert().
// #define IM_ASSERT(_EXPR) MyAssert(_EXPR)
//---- Define assertion handler. Defaults to calling assert().
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
// Tell ImGui to not implement default clipboard handlers for Windows (so as not to link with OpenClipboard(), etc.)
// #define IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS
//---- Don't implement default clipboard handlers for Windows (so as not to link with OpenClipboard(), etc.)
//#define IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS
// Define implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
//---- If you are loading a custom font, ImGui expect to find a pure white pixel at (0,0)
// Change it's UV coordinate here if you can't have a white pixel at (0,0)
//#define IMGUI_FONT_TEX_UV_FOR_WHITE ImVec2(0.f/256.f,0.f/256.f)
//---- Define implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
/*
#define IM_VEC2_CLASS_EXTRA \
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
@ -26,8 +30,8 @@
operator MyVec4() const { return MyVec4(x,y,z,w); }
*/
// Freely implement extra functions within the ImGui:: namespace.
// e.g. you can create variants of the ImGui::Value() helper for your low-level math types.
//---- Freely implement extra functions within the ImGui:: namespace.
//---- e.g. you can create variants of the ImGui::Value() helper for your low-level math types.
/*
namespace ImGui
{

View File

@ -101,7 +101,7 @@
- if you want to use a different font than the default
- create bitmap font data using BMFont. allocate ImGui::GetIO().Font and use ->LoadFromFile()/LoadFromMemory(), set ImGui::GetIO().FontHeight
- load your texture yourself. texture *MUST* have white pixel at UV coordinate 'IMDRAW_TEX_UV_FOR_WHITE' (you can #define it in imconfig.h), this is used by solid objects.
- load your texture yourself. texture *MUST* have white pixel at UV coordinate 'IMGUI_FONT_TEX_UV_FOR_WHITE' (you can #define it in imconfig.h), this is used by solid objects.
- tip: the construct 'if (IMGUI_ONCE_UPON_A_FRAME)' will evaluate to true only once a frame, you can use it to add custom UI in the middle of a deep nested inner loop in your code.
- tip: you can call Render() multiple times (e.g for VR renders), up to you to communicate the extra state to your RenderDrawListFn function.
@ -4703,7 +4703,7 @@ void ImDrawList::AddVtx(const ImVec2& pos, ImU32 col)
{
vtx_write->pos = pos;
vtx_write->col = col;
vtx_write->uv = IMDRAW_TEX_UV_FOR_WHITE;
vtx_write->uv = IMGUI_FONT_TEX_UV_FOR_WHITE;
vtx_write++;
}

View File

@ -509,8 +509,8 @@ struct ImDrawCmd
ImVec4 clip_rect;
};
#ifndef IMDRAW_TEX_UV_FOR_WHITE
#define IMDRAW_TEX_UV_FOR_WHITE ImVec2(0,0)
#ifndef IMGUI_FONT_TEX_UV_FOR_WHITE
#define IMGUI_FONT_TEX_UV_FOR_WHITE ImVec2(0.f,0.f)
#endif
// sizeof() == 20