Skip to content

Commit

Permalink
Update docs / 2024-01-30 / 22:00:54
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Jan 30, 2024
1 parent 3c8879a commit dc9b42e
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 16 deletions.
31 changes: 31 additions & 0 deletions docs/book/_sources/doc_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ See [hello_imgui_font.h](https://github.com/pthom/hello_imgui/blob/master/src/he
// if true, the font will be loaded and then FontAwesome icons will be merged to it
// (deprecated, use mergeToLastFont instead, and load in two steps)
// This will use an old version of FontAwesome (FontAwesome 4)
bool mergeFontAwesome = false;
ImFontConfig fontConfigFontAwesome = ImFontConfig();
};
Expand All @@ -110,6 +111,36 @@ See [hello_imgui_font.h](https://github.com/pthom/hello_imgui/blob/master/src/he
const FontLoadingParams & params = {});
// Note: if you want to use a more recent version of Font Awesome,
// ===============================================================
// see example at src/hello_imgui_demos/hello_imgui_demo_fontawesome6
//
// The principle is summarized below:
// - Download Font_Awesome_6_Free-Solid-900.otf from https://fontawesome.com/download
// - Download IconsFontAwesome6.h from https://raw.githubusercontent.com/juliettef/IconFontCppHeaders/main/IconsFontAwesome6.h
//
// Code:
//
// // Prevent HelloImGui from loading Font Awesome 4 definitions, since we will load FontAwesome 6
// #define HELLOIMGUI_NO_FONT_AWESOME4
// #include "hello_imgui/hello_imgui.h"
// #include "IconsFontAwesome6.h"
//
// ...
//
// // Load the default font + merge it with Font Awesome 6
// HelloImGui::RunnerParams runnerParams;
// runnerParams.callbacks.LoadAdditionalFonts = []
// {
// // Load the default font
// HelloImGui::LoadFont("fonts/DroidSans.ttf", 15.0f);
//
// // Merge FontAwesome6 with the default font
// HelloImGui::FontLoadingParams fontParams;
// fontParams.mergeToLastFont = true;
// fontParams.useFullGlyphRange = true;
// HelloImGui::LoadFont("fonts/Font_Awesome_6_Free-Solid-900.otf", 15.0f, fontParams);
// };
```

----
Expand Down
12 changes: 5 additions & 7 deletions docs/book/_sources/doc_params.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,16 @@ struct RunnerCallbacks
// but you can copy and customize it.
// (LoadDefaultFont_WithFontAwesome will load fonts from assets/fonts/
// but reverts to the ImGui embedded font if not found)
VoidFunction LoadAdditionalFonts =
(VoidFunction)(ImGuiDefaultSettings::LoadDefaultFont_WithFontAwesomeIcons);
VoidFunction LoadAdditionalFonts = (VoidFunction)ImGuiDefaultSettings::LoadDefaultFont_WithFontAwesomeIcons;
// `SetupImGuiConfig`: default=_ImGuiDefaultSettings::SetupDefaultImGuiConfig*.
// If needed, change ImGui config via SetupImGuiConfig
// (enable docking, gamepad, etc)
VoidFunction SetupImGuiConfig =
(VoidFunction)(ImGuiDefaultSettings::SetupDefaultImGuiConfig);
VoidFunction SetupImGuiConfig = (VoidFunction)ImGuiDefaultSettings::SetupDefaultImGuiConfig;
// `SetupImGuiStyle`: default=_ImGuiDefaultSettings::SetupDefaultImGuiConfig*.
// If needed, set your own style by providing your own SetupImGuiStyle callback
VoidFunction SetupImGuiStyle =
(VoidFunction)(ImGuiDefaultSettings::SetupDefaultImGuiStyle);
VoidFunction SetupImGuiStyle = (VoidFunction)ImGuiDefaultSettings::SetupDefaultImGuiStyle;
// `RegisterTests`: A function that is called once ImGuiTestEngine is ready
// to be filled with tests and automations definitions.
Expand Down Expand Up @@ -748,7 +745,8 @@ struct ImGuiWindowParams
ImGuiTheme::ImGuiTweakedTheme tweakedTheme;

// backgroundColor:
// This is the "clearColor", visible if defaultImGuiWindowType!=ProvideFullScreenWindow.
// This is the "clearColor", i.e. the app window background color, is visible *only if*
// runnerParams.imGuiWindowParams.defaultImGuiWindowType = NoDefaultWindow
// Alternatively, you can set your own RunnerCallbacks.CustomBackground to have full
// control over what is drawn behind the Gui.
ImVec4 backgroundColor = ImVec4(0.f, 0.f, 0.f, 0.f);
Expand Down
33 changes: 33 additions & 0 deletions docs/book/doc_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ <h1>Load fonts<a class="headerlink" href="#load-fonts" title="Permalink to this

<span class="w"> </span><span class="c1">// if true, the font will be loaded and then FontAwesome icons will be merged to it</span>
<span class="w"> </span><span class="c1">// (deprecated, use mergeToLastFont instead, and load in two steps)</span>
<span class="w"> </span><span class="c1">// This will use an old version of FontAwesome (FontAwesome 4)</span>
<span class="w"> </span><span class="kt">bool</span><span class="w"> </span><span class="n">mergeFontAwesome</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">false</span><span class="p">;</span>
<span class="w"> </span><span class="n">ImFontConfig</span><span class="w"> </span><span class="n">fontConfigFontAwesome</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ImFontConfig</span><span class="p">();</span>
<span class="w"> </span><span class="p">};</span>
Expand All @@ -526,6 +527,38 @@ <h1>Load fonts<a class="headerlink" href="#load-fonts" title="Permalink to this
<span class="w"> </span><span class="c1">// see FontLoadingParams and ImFontConfig</span>
<span class="w"> </span><span class="n">ImFont</span><span class="o">*</span><span class="w"> </span><span class="nf">LoadFont</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="n">fontFilename</span><span class="p">,</span><span class="w"> </span><span class="kt">float</span><span class="w"> </span><span class="n">fontSize</span><span class="p">,</span>
<span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">FontLoadingParams</span><span class="w"> </span><span class="o">&amp;</span><span class="w"> </span><span class="n">params</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{});</span>


<span class="w"> </span><span class="c1">// Note: if you want to use a more recent version of Font Awesome,</span>
<span class="w"> </span><span class="c1">// ===============================================================</span>
<span class="w"> </span><span class="c1">// see example at src/hello_imgui_demos/hello_imgui_demo_fontawesome6</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// The principle is summarized below:</span>
<span class="w"> </span><span class="c1">// - Download Font_Awesome_6_Free-Solid-900.otf from https://fontawesome.com/download</span>
<span class="w"> </span><span class="c1">// - Download IconsFontAwesome6.h from https://raw.githubusercontent.com/juliettef/IconFontCppHeaders/main/IconsFontAwesome6.h</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// Code:</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// // Prevent HelloImGui from loading Font Awesome 4 definitions, since we will load FontAwesome 6</span>
<span class="w"> </span><span class="c1">// #define HELLOIMGUI_NO_FONT_AWESOME4</span>
<span class="w"> </span><span class="c1">// #include &quot;hello_imgui/hello_imgui.h&quot;</span>
<span class="w"> </span><span class="c1">// #include &quot;IconsFontAwesome6.h&quot;</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// ...</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// // Load the default font + merge it with Font Awesome 6</span>
<span class="w"> </span><span class="c1">// HelloImGui::RunnerParams runnerParams;</span>
<span class="w"> </span><span class="c1">// runnerParams.callbacks.LoadAdditionalFonts = []</span>
<span class="w"> </span><span class="c1">// {</span>
<span class="w"> </span><span class="c1">// // Load the default font</span>
<span class="w"> </span><span class="c1">// HelloImGui::LoadFont(&quot;fonts/DroidSans.ttf&quot;, 15.0f);</span>
<span class="w"> </span><span class="c1">//</span>
<span class="w"> </span><span class="c1">// // Merge FontAwesome6 with the default font</span>
<span class="w"> </span><span class="c1">// HelloImGui::FontLoadingParams fontParams;</span>
<span class="w"> </span><span class="c1">// fontParams.mergeToLastFont = true;</span>
<span class="w"> </span><span class="c1">// fontParams.useFullGlyphRange = true;</span>
<span class="w"> </span><span class="c1">// HelloImGui::LoadFont(&quot;fonts/Font_Awesome_6_Free-Solid-900.otf&quot;, 15.0f, fontParams);</span>
<span class="w"> </span><span class="c1">// };</span>
</pre></div>
</div>
</section>
Expand Down
12 changes: 5 additions & 7 deletions docs/book/doc_params.html
Original file line number Diff line number Diff line change
Expand Up @@ -742,19 +742,16 @@ <h2>RunnerCallbacks<a class="headerlink" href="#runnercallbacks" title="Permalin
<span class="w"> </span><span class="c1">// but you can copy and customize it.</span>
<span class="w"> </span><span class="c1">// (LoadDefaultFont_WithFontAwesome will load fonts from assets/fonts/</span>
<span class="w"> </span><span class="c1">// but reverts to the ImGui embedded font if not found)</span>
<span class="w"> </span><span class="n">VoidFunction</span><span class="w"> </span><span class="n">LoadAdditionalFonts</span><span class="w"> </span><span class="o">=</span>
<span class="w"> </span><span class="p">(</span><span class="n">VoidFunction</span><span class="p">)(</span><span class="n">ImGuiDefaultSettings</span><span class="o">::</span><span class="n">LoadDefaultFont_WithFontAwesomeIcons</span><span class="p">);</span>
<span class="w"> </span><span class="n">VoidFunction</span><span class="w"> </span><span class="n">LoadAdditionalFonts</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">VoidFunction</span><span class="p">)</span><span class="n">ImGuiDefaultSettings</span><span class="o">::</span><span class="n">LoadDefaultFont_WithFontAwesomeIcons</span><span class="p">;</span>

<span class="w"> </span><span class="c1">// `SetupImGuiConfig`: default=_ImGuiDefaultSettings::SetupDefaultImGuiConfig*.</span>
<span class="w"> </span><span class="c1">// If needed, change ImGui config via SetupImGuiConfig</span>
<span class="w"> </span><span class="c1">// (enable docking, gamepad, etc)</span>
<span class="w"> </span><span class="n">VoidFunction</span><span class="w"> </span><span class="n">SetupImGuiConfig</span><span class="w"> </span><span class="o">=</span>
<span class="w"> </span><span class="p">(</span><span class="n">VoidFunction</span><span class="p">)(</span><span class="n">ImGuiDefaultSettings</span><span class="o">::</span><span class="n">SetupDefaultImGuiConfig</span><span class="p">);</span>
<span class="w"> </span><span class="n">VoidFunction</span><span class="w"> </span><span class="n">SetupImGuiConfig</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">VoidFunction</span><span class="p">)</span><span class="n">ImGuiDefaultSettings</span><span class="o">::</span><span class="n">SetupDefaultImGuiConfig</span><span class="p">;</span>

<span class="w"> </span><span class="c1">// `SetupImGuiStyle`: default=_ImGuiDefaultSettings::SetupDefaultImGuiConfig*.</span>
<span class="w"> </span><span class="c1">// If needed, set your own style by providing your own SetupImGuiStyle callback</span>
<span class="w"> </span><span class="n">VoidFunction</span><span class="w"> </span><span class="n">SetupImGuiStyle</span><span class="w"> </span><span class="o">=</span>
<span class="w"> </span><span class="p">(</span><span class="n">VoidFunction</span><span class="p">)(</span><span class="n">ImGuiDefaultSettings</span><span class="o">::</span><span class="n">SetupDefaultImGuiStyle</span><span class="p">);</span>
<span class="w"> </span><span class="n">VoidFunction</span><span class="w"> </span><span class="n">SetupImGuiStyle</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">VoidFunction</span><span class="p">)</span><span class="n">ImGuiDefaultSettings</span><span class="o">::</span><span class="n">SetupDefaultImGuiStyle</span><span class="p">;</span>

<span class="w"> </span><span class="c1">// `RegisterTests`: A function that is called once ImGuiTestEngine is ready</span>
<span class="w"> </span><span class="c1">// to be filled with tests and automations definitions.</span>
Expand Down Expand Up @@ -1174,7 +1171,8 @@ <h2>ImGuiWindowParams<a class="headerlink" href="#imguiwindowparams" title="Perm
<span class="w"> </span><span class="n">ImGuiTheme</span><span class="o">::</span><span class="n">ImGuiTweakedTheme</span><span class="w"> </span><span class="n">tweakedTheme</span><span class="p">;</span>

<span class="w"> </span><span class="c1">// backgroundColor:</span>
<span class="w"> </span><span class="c1">// This is the &quot;clearColor&quot;, visible if defaultImGuiWindowType!=ProvideFullScreenWindow.</span>
<span class="w"> </span><span class="c1">// This is the &quot;clearColor&quot;, i.e. the app window background color, is visible *only if*</span>
<span class="w"> </span><span class="c1">// runnerParams.imGuiWindowParams.defaultImGuiWindowType = NoDefaultWindow</span>
<span class="w"> </span><span class="c1">// Alternatively, you can set your own RunnerCallbacks.CustomBackground to have full</span>
<span class="w"> </span><span class="c1">// control over what is drawn behind the Gui.</span>
<span class="w"> </span><span class="n">ImVec4</span><span class="w"> </span><span class="n">backgroundColor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ImVec4</span><span class="p">(</span><span class="mf">0.f</span><span class="p">,</span><span class="w"> </span><span class="mf">0.f</span><span class="p">,</span><span class="w"> </span><span class="mf">0.f</span><span class="p">,</span><span class="w"> </span><span class="mf">0.f</span><span class="p">);</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/book/get_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ <h2>Starter template<a class="headerlink" href="#starter-template" title="Permal

<span class="c"># Build your app</span>
<span class="c"># ==============</span>
<span class="nb">hello_imgui_add_app</span><span class="p">(</span><span class="s">hello_world</span><span class="w"> </span><span class="s">hello_world.main.cpp</span><span class="p">)</span>
<span class="nb">hello_imgui_add_app</span><span class="p">(</span><span class="s">hello_world_</span><span class="w"> </span><span class="s">hello_world.main.cpp</span><span class="p">)</span>
</pre></div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion docs/book/searchindex.js

Large diffs are not rendered by default.

0 comments on commit dc9b42e

Please sign in to comment.