Skip to content

Commit

Permalink
Update docs / 2024-01-09 / 16:47:15
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Jan 9, 2024
1 parent 9965d54 commit eb2c32b
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 109 deletions.
1 change: 0 additions & 1 deletion docs/book/00_00_intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@




<li class="toctree-l1"><a class="reference internal" href="doc_params.html">Application parameters</a></li>


Expand Down
1 change: 0 additions & 1 deletion docs/book/05_05_get_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@




<li class="toctree-l1"><a class="reference internal" href="doc_params.html">Application parameters</a></li>


Expand Down
1 change: 0 additions & 1 deletion docs/book/60_05_build.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@




<li class="toctree-l1"><a class="reference internal" href="doc_params.html">Application parameters</a></li>


Expand Down
91 changes: 48 additions & 43 deletions docs/book/_sources/doc_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ struct AssetFileData
// LoadAssetFileData(const char *assetPath)`
// Will load an entire asset file into memory. This works on all platforms,
// including android.
// You *have* to call FreeAssetFileData to free the memory, except if you use
// ImGui::GetIO().Fonts->AddFontFromMemoryTTF, which will take ownership of the
// data and free it for you.
AssetFileData LoadAssetFileData(const char *assetPath);

// FreeAssetFileData(AssetFileData *)
Expand Down Expand Up @@ -227,7 +230,50 @@ ImVec2 ImageProportionalSize(const ImVec2& askedSize, const ImVec2& imageSize);
----
# Ini settings location
# Utility functions
```cpp
// `FrameRate(durationForMean = 0.5)`: Returns the current FrameRate.
// May differ from ImGui::GetIO().FrameRate, since one can choose the duration
// for the calculation of the mean value of the fps
// Returns the current FrameRate. May differ from ImGui::GetIO().FrameRate,
// since one can choose the duration for the calculation of the mean value of the fps
// (Will only lead to accurate values if you call it at each frame)
float FrameRate(float durationForMean = 0.5f);
// `ImGuiTestEngine* GetImGuiTestEngine()`: returns a pointer to the global instance
// of ImGuiTestEngine that was initialized by HelloImGui
// (iif ImGui Test Engine is active).
ImGuiTestEngine* GetImGuiTestEngine();
```

----
# Switch between several layouts
See [hello_imgui.h](https://github.com/pthom/hello_imgui/blob/master/src/hello_imgui/hello_imgui.h).

```cpp

// In advanced cases when several layouts are available, you can switch between layouts.
// See demo inside
// https://github.com/pthom/hello_imgui/tree/master/src/hello_imgui_demos/hello_imgui_demodocking/hello_imgui_demodocking.main.cpp

// `SwitchLayout(layoutName)`
// Changes the application current layout. Only used in advanced cases
// when several layouts are available, i.e. if you filled
// runnerParams.alternativeDockingLayouts.
void SwitchLayout(const std::string& layoutName);

// `CurrentLayoutName()`: returns the name of the current layout
std::string CurrentLayoutName();
```
----
# Ini settings
## Ini settings location
```cpp
Expand Down Expand Up @@ -296,48 +342,7 @@ void DeleteIniSettings(const RunnerParams& runnerParams);
----
# Utility functions
```cpp
// `FrameRate(durationForMean = 0.5)`: Returns the current FrameRate.
// May differ from ImGui::GetIO().FrameRate, since one can choose the duration
// for the calculation of the mean value of the fps
// Returns the current FrameRate. May differ from ImGui::GetIO().FrameRate,
// since one can choose the duration for the calculation of the mean value of the fps
// (Will only lead to accurate values if you call it at each frame)
float FrameRate(float durationForMean = 0.5f);
// `ImGuiTestEngine* GetImGuiTestEngine()`: returns a pointer to the global instance
// of ImGuiTestEngine that was initialized by HelloImGui
// (iif ImGui Test Engine is active).
ImGuiTestEngine* GetImGuiTestEngine();
```

----
# Switch between several layouts
See [hello_imgui.h](https://github.com/pthom/hello_imgui/blob/master/src/hello_imgui/hello_imgui.h).

```cpp

// In advanced cases when several layouts are available, you can switch between layouts.
// See demo inside
// https://github.com/pthom/hello_imgui/tree/master/src/hello_imgui_demos/hello_imgui_demodocking/hello_imgui_demodocking.main.cpp

// `SwitchLayout(layoutName)`
// Changes the application current layout. Only used in advanced cases
// when several layouts are available, i.e. if you filled
// runnerParams.alternativeDockingLayouts.
void SwitchLayout(const std::string& layoutName);

// `CurrentLayoutName()`: returns the name of the current layout
std::string CurrentLayoutName();
```
----
# Store user settings in the ini file
## Store user settings in the ini file
See [hello_imgui.h](https://github.com/pthom/hello_imgui/blob/master/src/hello_imgui/hello_imgui.h).
```cpp
Expand Down
65 changes: 58 additions & 7 deletions docs/book/_sources/doc_params.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ struct FpsIdling

See [runner_callbacks.h](https://github.com/pthom/hello_imgui/blob/master/src/hello_imgui/runner_callbacks.h).


**VoidFunctionPointer** can hold any void(void) function.
```cpp
using VoidFunction = std::function<void(void)>
```

**AnyEventCallback** can hold any bool(void *) function.
It is designed to handle callbacks for a specific backend.
```cpp
using AnyEventCallback = std::function<bool(void * backendEvent)>
```

**AppendCallback** can compose two callbacks. Use this when you want to set a callback and keep the (maybe) preexisting one.

```cpp
//
// RunnerCallbacks is a struct that contains the callbacks
Expand Down Expand Up @@ -251,6 +265,10 @@ struct RunnerCallbacks
// Also, remember to call ImGui::SameLine() between items.
VoidFunction ShowStatus = EmptyVoidFunction();

// EdgesToolbars: A map that contains the definition of toolbars
// that can be placed on the edges of the App window
std::map<EdgeToolbarType, EdgeToolbar> edgesToolbars;


// --------------- Startup sequence callbacks -------------------

Expand Down Expand Up @@ -343,19 +361,52 @@ struct RunnerCallbacks
};
```

## Edge Toolbars Callbacks
More details on `RunnerParams.edgesToolbars` (a dictionary of `EdgeToolbar`, per edge type)

**VoidFunctionPointer** can hold any void(void) function.
```cpp
using VoidFunction = std::function<void(void)>
struct RunnerCallbacks
{
...
// EdgesToolbars: A map that contains the definition of toolbars
// that can be placed on the edges of the App window
std::map<EdgeToolbarType, EdgeToolbar> edgesToolbars;
...
};
```

**AnyEventCallback** can hold any bool(void *) function.
It is designed to handle callbacks for a specific backend.
Where:
```cpp
using AnyEventCallback = std::function<bool(void * backendEvent)>
```

**AppendCallback** can compose two callbacks. Use this when you want to set a callback and keep the (maybe) preexisting one.
// EdgeToolbarType: location of an Edge Toolbar
enum class EdgeToolbarType
{
Top,
Bottom,
Left,
Right
};

// EdgeToolbar :a toolbar that can be placed on the edges of the App window
// It will be placed in a non-dockable window
struct EdgeToolbar
{
VoidFunction ShowToolbar = EmptyVoidFunction();

// height or width the top toolbar, in em units
// (i.e. multiples of the default font size, to be Dpi aware)
float sizeEm = 2.5f;

// Padding inside the window, in em units
ImVec2 WindowPaddingEm = ImVec2(0.3f, 0.3f);

// Window background color, only used if WindowBg.w > 0
ImVec4 WindowBg = ImVec4(0.f, 0.f, 0.f, 0.f);
};

std::vector<EdgeToolbarType> AllEdgeToolbarTypes();
std::string EdgeToolbarTypeName(EdgeToolbarType e);
```
## MobileCallbacks
Expand Down
Loading

0 comments on commit eb2c32b

Please sign in to comment.