View Single Post
  #4  
Old 04-10-2020, 13:22
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 409
Rept. Given: 10
Rept. Rcvd 16 Times in 14 Posts
Thanks Given: 41
Thanks Rcvd at 155 Times in 61 Posts
WhoCares Reputation: 17
thanks for sharing this

Quote:
Originally Posted by atom0s View Post
Some comments on what you've suggested so far. (I'm very familiar with ImGui and use it in multiple game-related projects.)

1. You can cut down the 'bloat' as well by disabling the demo code.
Code:
#define IMGUI_DISABLE_DEMO_WINDOWS
4. Would recommend avoiding file loads of fonts to remove on-disk/installed font requirements. Instead, use ImGui's memory based loaders and store the font in the programs resources or as a raw static array.
Code:
AddFontFromMemoryTTF
AddFontFromMemoryCompressedTTF
AddFontFromMemoryCompressedBase85TTF
5. Keep in mind, the Win32 implementation of this does add some extra things and is part of the example projects and not the core of ImGui. You can find the code for it here:
https://github.com/ocornut/imgui/blob/master/examples/imgui_impl_win32.cpp#L344

Using this setup will also link against gdi32.dll as an extra import.

As for the scaling of things, ImGui has a means of doing these steps globally instead of having to track and handle the scaling yourself per-object/per-font.

For fonts, the ImGui::IO object holds a setting value for this called:
Code:
ImGui::GetIO().FontGlobalScale
For objects, you can alter this to up-scale objects by altering the 'DisplaySize' and adjusting the render buffer while drawing. You can see an explanation of that here:
https://github.com/ocornut/imgui/issues/1786#issuecomment-523332319


As for handling rendering, ImGui is designed for games but can be implemented into [virtually] anything as you are in control of how it renders. There used to be a GDI/GDI+ renderer for it but was discontinued as time went on. For a keygen, this would probably be the ideal framework to use as the renderer instead of Direct3D/OpenGL/SDL to keep resources low (if that matters to you). GDI/GDI+ is also back-supported since Windows XP so it should work on any Windows machine, so the total support coverage will be easier to deal with.

You can find a pull request that is for a GDI renderer here:
https://github.com/ocornut/imgui/pull/2724

I'd recommend using GDI+ instead though for the newer features and better performance.

Along with that, you can also introduce layered window usage if need be to completely remove the window and make things transparent by doing this. You can render ImGui to a GDI+ bitmap/surface and use UpdateLayeredWindow to do the final draw/blit with transparency as needed. (Be sure to render the ImGui scene with the needed transparent color key so the unused/background area is the proper color etc.)
__________________
AKA Solomon/blowfish.
Reply With Quote