2
0
Эх сурвалжийг харах

Added stub for obsolete GetDefaultFontData() to help the user upgrading

ocornut 10 жил өмнө
parent
commit
56ac857cac
2 өөрчлөгдсөн 17 нэмэгдсэн , 3 устгасан
  1. 14 3
      imgui.cpp
  2. 3 0
      imgui.h

+ 14 - 3
imgui.cpp

@@ -185,18 +185,18 @@
  If you want to load a different font than the default (ProggyClean.ttf, size 13)
  If you want to load a different font than the default (ProggyClean.ttf, size 13)
 
 
      io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
      io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
-     io.Fonts->GetTexDataAs****()
+     io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
 
 
  If you want to load multiple fonts, use the font atlas to pack them into a single texture!
  If you want to load multiple fonts, use the font atlas to pack them into a single texture!
 
 
      ImFont* font0 = io.Fonts->AddFontDefault();
      ImFont* font0 = io.Fonts->AddFontDefault();
      ImFont* font1 = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
      ImFont* font1 = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
-     io.Fonts->GetTexDataAs****()
+     io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
 
 
  If you want to display Chinese, Japanese, Korean characters, pass custom Unicode ranges when loading a font:
  If you want to display Chinese, Japanese, Korean characters, pass custom Unicode ranges when loading a font:
 
 
      io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, io.Fonts->GetGlyphRangesJapanese());  // Load Japanese characters
      io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, io.Fonts->GetGlyphRangesJapanese());  // Load Japanese characters
-     io.Fonts->GetTexDataAs****()
+     io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
 
 
  If you want to input Japanese/Chinese/Korean in the text input widget:
  If you want to input Japanese/Chinese/Korean in the text input widget:
 
 
@@ -6359,6 +6359,17 @@ void    ImFontAtlas::Clear()
     Fonts.clear();
     Fonts.clear();
 }
 }
 
 
+void ImGui::GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size)
+{
+    printf("GetDefaultFontData() is obsoleted in ImGui 1.30.\n");
+    printf("Please use ImGui::GetIO().Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() functions to retrieve uncompressed texture data.\n");
+    if (fnt_data) *fnt_data = NULL;
+    if (fnt_size) *fnt_size = 0;
+    if (png_data) *png_data = NULL;
+    if (png_size) *png_size = 0;
+    IM_ASSERT(false);
+}
+
 void    ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
 void    ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
 {
 {
     // Lazily build
     // Lazily build

+ 3 - 0
imgui.h

@@ -320,6 +320,9 @@ namespace ImGui
     IMGUI_API const char*   GetStyleColName(ImGuiCol idx);
     IMGUI_API const char*   GetStyleColName(ImGuiCol idx);
     IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
     IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
 
 
+    // Obsolete (will be removed)
+    IMGUI_API void          GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
+
 } // namespace ImGui
 } // namespace ImGui
 
 
 // Flags for ImGui::Begin()
 // Flags for ImGui::Begin()