|
Ultralight C++ API 2.0.0
|
#include <AppCore/App.h>
App-specific settings.
Public Attributes | |
| String | developer_name = "MyCompany" |
| The name of the developer of this app. | |
| String | app_name = "MyApp" |
| The name of this app, used with developer_name to build the per-app folders (see developer_name). | |
| String | file_system_path = "./assets/" |
| The root folder for file:/// URLs. | |
| bool | force_cpu_renderer = false |
| Whether or not to always use the CPU renderer. | |
| double | device_scale_override = 0.0 |
| Override the device scale factor for all windows. | |
| bool | auto_font_profile = true |
| Whether or not to pick the font-appearance preset from the operating system, so text matches the platform's native look (FontProfile::WindowsLike on Windows and Linux, FontProfile::MacOSLike on macOS). | |
| bool | auto_font_families = true |
| Whether or not to pick the default font families (serif, sans-serif, monospace, etc.) from the operating system, so generic CSS families resolve to the same fonts as the platform's browsers (eg, Menlo for monospace on macOS, Consolas on Windows). | |
| bool | match_native_editing_behavior = true |
| Whether or not text editing in the Views this app creates should follow the host OS's native conventions (eg, non-directional selections on macOS). | |
| double | idle_threshold = 0.5 |
| The minimum duration of user inactivity (in seconds) before idle detection begins. | |
| double | sustained_idle_time = 2.0 |
| The time (in seconds) the app must remain continuously idle before AppListener::OnIdle() fires, and the interval between repeated calls after that. | |
| double | idle_utilization_threshold = 0.5 |
| The thread CPU utilization (0.0-1.0) below which the app is considered idle. | |
| bool | enable_profiler = false |
| Whether or not to enable the built-in trace file profiler. | |
| uint32_t | headless_paint_fps = 0 |
| The paint rate (in frames per second) for windows created with WindowFlags::Hidden. | |
| bool | full_speed_loop = false |
| Whether or not to run the app's update loop at full speed, without sleeping between updates. | |
| bool | sync_animations_to_present = true |
| Whether or not to time animations for the moment each frame appears on screen. | |
| RefPtr< Bitmap > | app_icon |
| The application icon, as a 32-bit BGRA bitmap with straight (unpremultiplied) alpha. | |
The application icon, as a 32-bit BGRA bitmap with straight (unpremultiplied) alpha.
On macOS this is the Dock icon. On Windows and Linux it's the default icon for windows that haven't set their own with Window::SetIcon(). Leave it null to keep the platform default.
| String app_name = "MyApp" |
The name of this app, used with developer_name to build the per-app folders (see developer_name).
| bool auto_font_families = true |
Whether or not to pick the default font families (serif, sans-serif, monospace, etc.) from the operating system, so generic CSS families resolve to the same fonts as the platform's browsers (eg, Menlo for monospace on macOS, Consolas on Windows).
This applies to Views created without an explicit ViewConfig. A config you pass to Container::AddPanel() keeps its own font families– start from Window::default_view_config() to inherit them. Set this to false to keep the platform-neutral families everywhere.
| bool auto_font_profile = true |
Whether or not to pick the font-appearance preset from the operating system, so text matches the platform's native look (FontProfile::WindowsLike on Windows and Linux, FontProfile::MacOSLike on macOS).
This only applies while Config::font_profile is FontProfile::Default– a profile you set yourself always wins. Set this to false to keep the Default profile's platform-neutral appearance everywhere.
| String developer_name = "MyCompany" |
The name of the developer of this app.
Together with app_name, this generates the per-app folders where the library keeps the log file (ultralight.log), profiler traces, and session data (cookies, cached resources, databases). A Config::cache_path you set yourself takes over the session data. The log and traces stay in the diagnostics folder either way.
| double device_scale_override = 0.0 |
Override the device scale factor for all windows.
When this is 0 or less (the default), the device scale is auto-detected from the monitor's DPI. Set a positive value (eg, 1.0, 1.5, 2.0) to use that scale for every window instead.
| bool enable_profiler = false |
Whether or not to enable the built-in trace file profiler.
When enabled, the library writes a Perfetto trace file that can be opened in https://ui.perfetto.dev to visualize Ultralight's internal performance.
Traces are written to a profiler_traces folder inside the app's diagnostics directory, alongside the log file (see developer_name for where that is). Read App::profiler_trace_path() for the exact file. This folder is the app's own, not the Config::cache_path you may have set.
| String file_system_path = "./assets/" |
The root folder for file:/// URLs.
You should set this to the relative path where all of your app data is (eg, file:///page.html loads page.html from this folder).
| bool force_cpu_renderer = false |
Whether or not to always use the CPU renderer.
By default the library uses the GPU renderer when it finds a compatible GPU.
| bool full_speed_loop = false |
Whether or not to run the app's update loop at full speed, without sleeping between updates.
By default the loop sleeps between updates, which keeps CPU usage low but paces how quickly page work (resource loading, script, layout) advances. Enable this to update continuously instead, so that work completes as fast as the CPU allows. Display refresh and hidden-window painting are still paced (see headless_paint_fps) and painting stays invalidation-driven, so animation timing is unchanged.
| uint32_t headless_paint_fps = 0 |
The paint rate (in frames per second) for windows created with WindowFlags::Hidden.
Hidden windows receive no paint events from the OS, so by default they're never painted. Set this to a positive value to paint them at a fixed rate instead, which is what offscreen and headless capture need. The rate is independent of any monitor's refresh rate, so time-based content advances the same on every host.
| double idle_threshold = 0.5 |
The minimum duration of user inactivity (in seconds) before idle detection begins.
| double idle_utilization_threshold = 0.5 |
The thread CPU utilization (0.0-1.0) below which the app is considered idle.
| bool match_native_editing_behavior = true |
Whether or not text editing in the Views this app creates should follow the host OS's native conventions (eg, non-directional selections on macOS).
This applies to Views created without an explicit ViewConfig. A config you pass to Container::AddPanel() uses its own ViewConfig::match_native_editing_behavior instead. Set this to false for editing behavior that is identical on every platform.
| double sustained_idle_time = 2.0 |
The time (in seconds) the app must remain continuously idle before AppListener::OnIdle() fires, and the interval between repeated calls after that.
| bool sync_animations_to_present = true |
Whether or not to time animations for the moment each frame appears on screen.
A frame appears one or more display refreshes after the refresh that started it. With this on (the default), window.requestAnimationFrame() timestamps, CSS animations, and smooth scrolling use the time the frame will appear, which avoids lag while scrolling. Set this to false to use the time of the refresh instead.