Skip to main content

Module window

Module window 

Source
Expand description

A desktop window: eframe on wgpu, with the renderer set up by gpu and a CJK font behind egui’s own.

run is the whole of opening an app’s desktop window; open is its lower half, for an entry that builds its own eframe::NativeOptions. With the android feature, run_android opens the window on an Android phone. The sapphire apps and asteria open their windows through here, so a renderer fix reaches all of them.

On iOS, an app built with the iOS 27 SDK must declare a scene in its Info.plist, with IOS_SCENE_DELEGATE as the scene’s delegate: iOS 27 stops at launch an app that does not, and winit 0.30 does not put its window in a scene by itself (#37).

UIApplicationSceneManifest:
  UIApplicationSupportsMultipleScenes: false
  UISceneConfigurations:
    UIWindowSceneSessionRoleApplication:
      - UISceneConfigurationName: Default
        UISceneDelegateClassName: CorundumSceneDelegate
use corundum_framework_gui::{eframe, egui, window};

struct Example;

impl eframe::App for Example {
    fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
        ui.label("Hello");
    }
}

fn main() -> eframe::Result<()> {
    window::run(
        window::WindowOptions::new("Example").inner_size([800.0, 500.0]),
        |_cc| Box::new(Example),
    )
}

Structs§

WindowOptions
A desktop window: its title, its size, its fonts and the app’s entry in the OS’s app menu.

Constants§

IOS_SCENE_DELEGATE
The class of the scene delegate an iOS app names in its Info.plist’s scene manifest (UISceneDelegateClassName). It shows the window once the app’s scene connects.

Functions§

open
Run eframe with native as the caller built it, building the app with create once the window exists: reports the renderer (gpu::on_render_state) and installs fonts, or the default ones when None. run is this for a desktop window.
run
Open a desktop window and run it until it closes.

Type Aliases§

InstallFonts
Sets the egui context’s fonts, once, before the app is built.