Skip to main content

Crate app

Crate app 

Source
Expand description

§App

With the app crate is possible to create multi-platform, native apps and windows.

With the app structure you can create windows, connect them to a rendering pipeline and manage events. The app structure is divided in three main modules, macOS, windows and linux (with both wayland and x11 support). By default it uses SSD or the native decoration method with fallback to CSD when unsuported.

§Examples

use app::{App, Event, SurfaceWrapper};
use renderer::Renderer;
use debug::info;

struct MyApp;

impl EventHandler for MyApp
{
	fn handle_events(e: Event)
	{
		match e {
			Event::CloseRequest => info!("closing now"),
			Event::WindowResized { window: w, .. } => info!("Resizing window: {:?}", w.title),
			Event::ThemeChange { new_theme: theme } => info!("changed: {:?}", theme),
			_ => {},
		}
	}
}

fn main() {
	let mut app = App::new(MyApp);
	app.set_blur(true);

	let mut window = app.new_window("walkie talkie", (600.0, 500.0));
	let renderer = Renderer::new(&mut window.get_backend())
		.expect("Vulkan inicialization failed");
	window.connect_surface(SurfaceWrapper::new(renderer.surface));

	app.init();
}

Structs§

App
The default structure to handle and manage apps
Color
RGB color implementation reference: https://github.com/seancroach/hex_color/blob/main/src/lib.rs
Cursor
Default cursor struct
Decoration
Default struct for window Decorations
Surface
Abtraction layer for multiple OS support
ThemeDefault
Theme struct
Window
Window interface

Enums§

CursorType
List of possible types for the cursor
DecorationMode
Detect if the current system prefers CSDs or SSDs By default, prefer server side decorations
Event
List of Events

Traits§

EventHandler
This is the bridge between system events and the lib events
NativeDecoration
NativeDecoration provides the necessary abstraction used inside the platform modules