1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! # Egor
//! A dead simple cross-platform 2D graphics engine
//!
//! ## Why Egor?
//! Egor is dead simple, lightweight and cross-platform.
//! The same code runs on native and web (WASM) with minimal boilerplate.
//! It’s built from small, composable crates on top of modern graphics
//! and windowing abstractions
//!
//! Egor gives you the essentials for 2D apps and games:
//! - Efficient 2D rendering (shapes, textures, text)
//! - Keyboard & mouse input
//! - Camera & world-space transforms
//! - Optional egui integration for tools and UIs
//! - Optional hot-reload during development
//!
//! ## Start Here
//! These are the main types Egor users interact with:
//! - [`app::App`] - application lifecycle and main loop
//! - [`render::Graphics`] - high-level 2D drawing API
//! - [`time::FrameTimer`] - frame timing and delta time
//! - [`input::Input`] - keyboard and mouse state
//!
//! ## Minimal Example: Draw a Rectangle
//! ```no_run
//! use egor::{app::{App, FrameContext}, render::Graphics};
//! App::new().run(|FrameContext { gfx, .. }| {
//! // start building a rectangle with some defaults
//! // draws automatically on `Drop` without an explicit `build()`
//! gfx.rect();
//! });
//! ```
//!
//! ## Crate Layout
//! `egor` is a meta crate that re-exports `egor_*` crates for convenience:
//! - [`egor_render`] - WGPU-based 2D rendering
//! - [`egor_app`] - windowing, input, & event loop
//! - [`egor_glue`] - opinionated layer over egor crates
//! ## Cargo Features
//! Feature | Description | Default
//! ---|---|---
//! `log` | Enable logging via `egor_app/log` | opt-in
//! `hot_reload` | Hot-reload support via `egor_glue/hot_reload` | opt-in
//! `ui` | Enable egui integration via `egor_glue/ui` | opt-in
//! `webgl` | WebGL backend for `egor_render` | opt-in
//! `angle` | ANGLE backend for `egor_render` | opt-in
//! `gles` | OpenGL ES backend for `egor_render` | opt-in
//! `vulkan` | Vulkan backend for `egor_render` | Linux default/opt-in
//!
//! Notes:
//! - Windows builds use DX12 by default, Linux builds use Vulkan by default, etc
//! - Optional backends can be enabled to override defaults or for cross-platform targeting
/// Invoke this by passing your main function as an argument.
/// Ensures unusual platforms like android get initialized properly.