Expand description
Blinc Platform Abstraction Layer
This crate provides platform-agnostic traits and types for windowing, input handling, and application lifecycle management.
§Architecture
The platform abstraction is built around three main traits:
Platform- The top-level platform abstractionWindow- Window management and propertiesEventLoop- Event handling and application lifecycle
§Platform Implementations
blinc_platform_desktop- Desktop platforms (macOS, Windows, Linux) using winitblinc_platform_android- Android using NDKblinc_platform_ios- iOS using UIKit (planned)
§Example
ⓘ
use blinc_platform::*;
use blinc_platform_desktop::DesktopPlatform;
fn main() -> Result<(), PlatformError> {
let platform = DesktopPlatform::new()?;
let event_loop = platform.create_event_loop()?;
event_loop.run(|event, window| {
match event {
Event::Frame => {
// Render frame
}
Event::Window(WindowEvent::CloseRequested) => {
return ControlFlow::Exit;
}
_ => {}
}
ControlFlow::Continue
})
}Re-exports§
pub use assets::AssetLoader;pub use assets::AssetPath;pub use assets::FilesystemAssetLoader;
Modules§
Structs§
- Keyboard
Event - Keyboard event
- Modifiers
- Modifier key state
- Window
Config - Window configuration
Enums§
- Control
Flow - Control flow after handling an event
- Cursor
- Cursor icons
- Event
- Platform events
- Input
Event - Input events
- Key
- Key codes
- KeyState
- Key press/release state
- Lifecycle
Event - Application lifecycle events
- Mouse
Button - Mouse buttons
- Mouse
Event - Mouse events
- Platform
Error - Platform-related errors
- Scroll
Phase - Scroll gesture phase (for trackpad/touchpad scrolling)
- Touch
Event - Touch events for touchscreens
- Window
Event - Window events
Traits§
Type Aliases§
- Result
- Result type for platform operations