Skip to main content

Crate blinc_platform

Crate blinc_platform 

Source
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 abstraction
  • Window - Window management and properties
  • EventLoop - Event handling and application lifecycle

§Platform Implementations

  • blinc_platform_desktop - Desktop platforms (macOS, Windows, Linux) using winit
  • blinc_platform_android - Android using NDK
  • blinc_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§

assets
Cross-platform asset loading
prelude
Prelude module for convenient imports

Structs§

KeyboardEvent
Keyboard event
Modifiers
Modifier key state
WindowConfig
Window configuration

Enums§

ControlFlow
Control flow after handling an event
Cursor
Cursor icons
Event
Platform events
InputEvent
Input events
Key
Key codes
KeyState
Key press/release state
LifecycleEvent
Application lifecycle events
MouseButton
Mouse buttons
MouseEvent
Mouse events
PlatformError
Platform-related errors
ScrollPhase
Scroll gesture phase (for trackpad/touchpad scrolling)
TouchEvent
Touch events for touchscreens
WindowEvent
Window events

Traits§

EventLoop
Event loop abstraction
Platform
Platform abstraction trait
Window
Window abstraction trait

Type Aliases§

Result
Result type for platform operations