UXPlatform
UXPlatform gives an application the driver for the backend its build links.
With it in the build, new UXApplication() installs that driver, so main()
names no platform:
#import "UXPlatform.xc"
void main(void) { UXApplication* app = new UXApplication(); app.setDelegate(new Controller()); app.run();}Overview
Section titled “Overview”The backend follows the target where the target decides it: win64 is Win32,
wasm32 the web, arm9 GEM, ios-sim and ios iOS, android Android. Otherwise
the build names it with -D UX_GTK or -D UX_GEM (GEM on a host). With
neither, an arm64 build is the Mac’s AppKit and an x86_64 build is GTK on Linux.
Only the driver the build uses is imported.
Import UXPlatform.xc before the other UXKit files (#use <UXKit> does this),
so the application’s constructor sees it. A program that has set gDriver, or
calls setDriver itself, keeps
the driver it chose.
A build script may differ per platform, in its link flags, its shims and these
defines. The .xc source does not.
Topics
Section titled “Topics”The backend · driver · fillsScreen · displayName · name
driver
Section titled “driver”static UXViewDriver* driver(void)A new driver for the backend this build links, for
UXApplication.setDriver.
fillsScreen
Section titled “fillsScreen”static bool fillsScreen(void)Whether an application’s main window is the whole screen: true on iOS and Android, where an app has one window that fills the display, and false on the desktops, where a window opens at a size of its own.
displayName
Section titled “displayName”static u8* displayName(void)The platform’s name for a title or an about box: "macOS", "Windows",
"Linux", "iOS", "Android", "the web" or "GEM".
static u8* name(void)The backend’s name for a log line: "appkit", "gtk", "win32", "web",
"ios", "android" or "gem".
See also
Section titled “See also”UXApplication:setDriver,setHeadless,run,stopUXViewDriver: the protocol every driver implements