ferravex_render/
native.rs1use crate::{Batch, Color, Conf};
5
6#[derive(Clone, Copy, Debug, PartialEq)]
9pub enum Event {
10 Key(u32, bool),
11 MouseMove(f32, f32),
12 MouseDelta(f32, f32),
13 MouseButton(u32, bool),
14 Wheel(f32),
15 Resize(u32, u32),
16 Focus(bool),
17 Suspend(bool),
18 Touch { id: u64, phase: u32, x: f32, y: f32 },
19 Quit,
20}
21
22mod gl;
23mod gpu;
24#[cfg(target_os = "linux")]
25mod linux;
26pub use gpu::NativeWindow;
27#[cfg(target_os = "linux")]
28use linux as host;
29
30#[cfg(target_os = "windows")]
31mod windows;
32#[cfg(target_os = "windows")]
33use windows as host;
34
35#[cfg(target_os = "macos")]
36mod macos;
37#[cfg(target_vendor = "apple")]
38mod objc;
39#[cfg(target_os = "macos")]
40use macos as host;
41
42#[cfg(target_os = "ios")]
43pub(crate) mod ios;
44#[cfg(target_os = "ios")]
45use ios as host;
46
47#[cfg(target_vendor = "apple")]
48fn apple_key(c: char) -> u32 {
49 match c {
50 '\u{1b}' => 0xff1b,
51 '\r' | '\n' => 0xff0d,
52 '\t' => 0xff09,
53 '\u{7f}' => 0xff08,
54 '\u{f700}' => 0xff52,
55 '\u{f701}' => 0xff54,
56 '\u{f702}' => 0xff51,
57 '\u{f703}' => 0xff53,
58 '\u{f704}'..='\u{f70f}' => 0xffbe + c as u32 - 0xf704,
59 '\u{f728}' => 0xffff,
60 c if c.is_ascii() => c.to_ascii_lowercase() as u32,
61 _ => 0,
62 }
63}
64
65#[cfg(not(any(
66 target_os = "linux",
67 target_os = "windows",
68 target_os = "macos",
69 target_os = "ios"
70)))]
71mod unsupported;
72#[cfg(not(any(
73 target_os = "linux",
74 target_os = "windows",
75 target_os = "macos",
76 target_os = "ios"
77)))]
78use unsupported as host;