Browse Source

Go back to glfw checks for frame buffer size so that resizeable widows work again.

Jeff Myers 1 year ago
parent
commit
c71a02530c
2 changed files with 17 additions and 9 deletions
  1. BIN
      examples/resources/parrots.png
  2. 17 9
      rlImGui.cpp

BIN
examples/resources/parrots.png


+ 17 - 9
rlImGui.cpp

@@ -89,14 +89,18 @@ static void rlImGuiNewFrame()
 		io.DisplaySize.y = float(GetScreenHeight());
 	}
 
-	int width = rlGetFramebufferWidth();
-	int height = rlGetFramebufferHeight();
-	if (width > 0 && height > 0) {
-		io.DisplayFramebufferScale = ImVec2(width / io.DisplaySize.x, height / io.DisplaySize.y);
-	}
-	else {
-		io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
-	}
+    int width = int(io.DisplaySize.x), height = int(io.DisplaySize.y);
+#ifdef PLATFORM_DESKTOP
+    glfwGetFramebufferSize(glfwGetCurrentContext(), &width, &height);
+#endif
+    if (width > 0 && height > 0) 
+	{
+        io.DisplayFramebufferScale = ImVec2(width / io.DisplaySize.x, height / io.DisplaySize.y);
+    }
+    else 
+	{
+        io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
+    }
 
 	io.DeltaTime = GetFrameTime();
 
@@ -460,7 +464,11 @@ void rlImGuiSetup(bool dark)
 	icons_config.MergeMode = true;
 	icons_config.PixelSnapH = true;
 	icons_config.FontDataOwnedByAtlas = false;
-	io.Fonts->AddFontFromMemoryCompressedTTF((void*)fa_solid_900_compressed_data, fa_solid_900_compressed_size, FONT_AWESOME_ICON_SIZE, &icons_config, icons_ranges);
+
+	icons_config.GlyphRanges = icons_ranges;
+
+	io.Fonts->AddFontFromFileTTF("resources/fa-solid-900.ttf", FONT_AWESOME_ICON_SIZE, &icons_config, nullptr);
+	//io.Fonts->AddFontFromMemoryCompressedTTF((void*)fa_solid_900_compressed_data, fa_solid_900_compressed_size, FONT_AWESOME_ICON_SIZE, &icons_config, icons_ranges);
 #endif
 
 	rlImGuiEndInitImGui();