Skip to content

Commit

Permalink
Tools: binary_to_compressed_c.cpp : comments + link to precompiled bi…
Browse files Browse the repository at this point in the history
…naries
  • Loading branch information
ocornut committed Nov 13, 2016
1 parent 3085716 commit 9c6048f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -37,11 +37,11 @@ _A common misunderstanding is that some people think immediate mode gui == immed

ImGui allows you create elaborate tools as well as very short-lived ones. On the extreme side of short-liveness: using the Edit&Continue feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, etc.

Demo
----
Binaries/Demo
-------------

You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at the features of ImGui, you can download Windows binaries of the demo app here.
- [imgui-demo-binaries-20160410.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20160410.zip) (Windows binaries, ImGui 1.48+ 2016/04/10, 4 executables, 534 KB)
- [imgui-demo-binaries-20161113.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20161113.zip) (Windows binaries, ImGui 1.49+ 2016/11/13, 5 executables, 588 KB)


Gallery
Expand Down
16 changes: 11 additions & 5 deletions extra_fonts/binary_to_compressed_c.cpp
@@ -1,12 +1,18 @@
// ImGui - binary_to_compressed_c.cpp
// Helper tool to turn a file into a C array.
// The data is first compressed with stb_compress() to reduce source code size.
// Then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data into 5 bytes of source code (suggested by @mmalex)
// (If we used 32-bits constants it would require take 11 bytes of source code to encode 4 bytes.)
// Useful if you want to embed fonts into your code.
// Helper tool to turn a file into a C array, if you want to embed font data in your source code.

// The data is first compressed with stb_compress() to reduce source code size,
// then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data into 5 bytes of source code (suggested by @mmalex)
// (If we used 32-bits constants it would require take 11 bytes of source code to encode 4 bytes, and be endianness dependent)
// Note that even with compression, the output array is likely to be bigger than the binary file..
// Load compressed TTF fonts with ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF()

// Single file application, build with:
// # cl.exe binary_to_compressed_c.cpp
// # gcc binary_to_compressed_c.cpp
// etc.
// You can also find a precompiled Windows binary in the binary/demo package available from https://github.com/ocornut/imgui

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
Expand Down

0 comments on commit 9c6048f

Please sign in to comment.