Parcourir la source

(Breaking) Fonts: renamed AddCustomRectRegular() -> AddCustomRect().

ocornut il y a 5 mois
Parent
commit
f40274702d
2 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 3 1
      imgui.h
  2. 2 2
      imgui_draw.cpp

+ 3 - 1
imgui.h

@@ -3612,9 +3612,10 @@ struct ImFontAtlas
     // - (Pre-1.92 names) ------------> (1.92 names)
     //   - GetCustomRectByIndex()   --> Use GetCustomRect()
     //   - CalcCustomRectUV()       --> Use GetCustomRectUV()
+    //   - AddCustomRectRegular()   --> Renamed to AddCustomRect()
     //   - AddCustomRectFontGlyph() --> Prefer using custom ImFontLoader inside ImFontConfig
     //   - ImFontAtlasCustomRect    --> ImTextureRect
-    IMGUI_API int                   AddCustomRectRegular(int width, int height);    // Register a rectangle. Return -1 on error.
+    IMGUI_API int                   AddCustomRect(int width, int height);           // Register a rectangle. Return -1 on error.
     IMGUI_API const ImTextureRect*  GetCustomRect(int id);                          // Get rectangle coordinate in current texture. Valid immediately, never store this (read above)!
     IMGUI_API void                  GetCustomRectUV(const ImTextureRect* r, ImVec2* out_uv_min, ImVec2* out_uv_max) const; // Get UV coordinates for a given rectangle. Valid immediately, never store this (read above)!
 
@@ -3666,6 +3667,7 @@ struct ImFontAtlas
     // [Obsolete]
 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
     // Legacy: You can request your rectangles to be mapped as font glyph (given a font + Unicode point), so you can render e.g. custom colorful icons and use them as regular glyphs. --> Prefer using a custom ImFontLoader.
+    IMGUI_API int                       AddCustomRectRegular(int width, int height) { return AddCustomRect(width, height); } // RENAMED in 1.92.X
     IMGUI_API int                       AddCustomRectFontGlyph(ImFont* font, ImWchar codepoint, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0, 0)); // OBSOLETED in 1.92.X: Use custom ImFontLoader in ImFontConfig
     IMGUI_API int                       AddCustomRectFontGlyphForSize(ImFont* font, float font_size, ImWchar codepoint, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0, 0)); // OBSOLETED in 1.92.X
     inline const ImTextureRect*         GetCustomRectByIndex(int id) { return GetCustomRect(id); } // OBSOLETED in 1.92.X

+ 2 - 2
imgui_draw.cpp

@@ -2498,7 +2498,7 @@ void ImTextureData::DestroyPixels()
 // - ImFontAtlas::RemoveFont()
 // - ImFontAtlasBuildNotifySetFont()
 //-----------------------------------------------------------------------------
-// - ImFontAtlas::AddCustomRectRegular()
+// - ImFontAtlas::AddCustomRect()
 // - ImFontAtlas::AddCustomRectFontGlyph()
 // - ImFontAtlas::GetCustomRect()
 // - ImFontAtlas::GetCustomRectUV()
@@ -3223,7 +3223,7 @@ void ImFontAtlas::RemoveFont(ImFont* font)
     ImFontAtlasBuildNotifySetFont(this, font, new_current_font);
 }
 
-int ImFontAtlas::AddCustomRectRegular(int width, int height)
+int ImFontAtlas::AddCustomRect(int width, int height)
 {
     IM_ASSERT(width > 0 && width <= 0xFFFF);
     IM_ASSERT(height > 0 && height <= 0xFFFF);