Skip to main content

gizmo_engine/
lib.rs

1//! # Gizmo Engine
2//!
3//! `gizmo-engine` is the all-in-one facade crate of the Gizmo game engine. It
4//! re-exports the individual subsystem crates (core ECS, math, app loop,
5//! physics, renderer, windowing, audio, scene, editor, UI, animation and AI)
6//! and adds an ergonomic, Bevy-like convenience layer on top: [`Color`],
7//! ready-made [`bundles`], a [`spawner`] API and prefabricated scene helpers.
8//!
9//! Note that the published *package* is named `gizmo-engine`, while the *library*
10//! (and thus the crate path used in `use` statements and examples) is simply
11//! `gizmo`.
12//!
13//! ## Feature flags
14//!
15//! Subsystems are gated behind Cargo features so you only compile what you need:
16//!
17//! - `window` — windowing via `winit`.
18//! - `render` — the `wgpu`-based renderer (implies `window`).
19//! - `audio` — audio playback.
20//! - `physics`, `physics-dynamics`, `physics-soft` — physics subsystems.
21//! - `scene` — scene (de)serialization.
22//! - `editor` — the `egui`-based in-engine editor (implies `render`).
23//! - `ui` — the UI subsystem.
24//! - `animation` — skeletal/property animation.
25//! - `scripting` — scripting support.
26//! - `network` — networking / P2P deterministic rollback via `gizmo-net`.
27//! - `headless` — run the app loop without a window (e.g. for servers/tests).
28//!
29//! The `default` feature enables a full desktop game setup (`window`, `render`,
30//! `audio`, `physics`, `scene`, `editor`, `ui`, `animation`, `network`).
31//!
32//! ## Re-exported third-party crates
33//!
34//! For convenience the facade re-exports the external crates that appear in its
35//! public API so downstream users do not have to add them separately:
36//! [`wgpu`] and [`bytemuck`] (with `render`), [`egui`] (with `editor`) and
37//! [`winit`] (with `window`).
38
39pub mod asset_server;
40pub mod bundles;
41pub mod color;
42pub mod plugins;
43pub mod prelude;
44pub mod spawner;
45pub mod systems;
46
47// === Motor Alt Sistemleri ===
48pub use gizmo_ai as ai;
49#[cfg(feature = "analysis")]
50pub use gizmo_analysis as analysis;
51pub use gizmo_app as app;
52pub use gizmo_core as core;
53pub use gizmo_math as math;
54pub mod physics;
55#[cfg(feature = "render")]
56pub use gizmo_renderer as renderer;
57
58#[cfg(feature = "window")]
59pub use gizmo_window as window;
60
61// Sık kullanılan matematik tiplerini lib.rs'ten doğrudan aç:
62pub use math::{Mat4, Quat, Vec2, Vec3, Vec4};
63
64#[cfg(feature = "window")]
65pub mod simple;
66#[cfg(feature = "window")]
67pub use simple::*;
68
69// === Opsiyonel Modüller ===
70#[cfg(feature = "audio")]
71pub use gizmo_audio as audio;
72
73#[cfg(feature = "editor")]
74pub use gizmo_editor as editor;
75
76#[cfg(feature = "scripting")]
77pub use gizmo_scripting as scripting;
78
79#[cfg(feature = "scene")]
80pub use gizmo_scene as scene;
81#[cfg(feature = "scene")]
82pub use gizmo_scene::ron;
83
84/// A [`scene::registry::SceneRegistry`] pre-populated with the engine's built-in
85/// components **and** the scripting layer's `Script` component.
86///
87/// `gizmo-scene` intentionally does not depend on `gizmo-scripting` (so scene
88/// save/load stays GPU-free), and therefore its
89/// [`scene::registry::default_scene_registry`] omits `Script`. Use this facade
90/// helper when you want scenes that round-trip script components.
91#[cfg(all(feature = "scene", feature = "scripting"))]
92pub fn full_scene_registry() -> scene::registry::SceneRegistry {
93    let mut reg = scene::registry::default_scene_registry();
94    scripting::register_script_components(&mut reg);
95    reg
96}
97
98#[cfg(feature = "ui")]
99pub use gizmo_ui as ui;
100
101#[cfg(feature = "animation")]
102pub use gizmo_animation as animation;
103
104#[cfg(feature = "network")]
105pub use gizmo_net as net;
106
107// === 3. Parti Re-Export (Kullanıcının ayrıca eklemesine gerek kalmasın) ===
108pub use gizmo_core::gizmo_log;
109
110/// 1.0 kontratı: aşağıdaki dış grafik/pencere tipleri (`wgpu`, `bytemuck`,
111/// `egui`, `winit`) bilinçli olarak public API'nin parçasıdır. Sürümleri ilgili
112/// renderer/window crate'inin semver'ine bağlıdır; bu dış crate'lerde yapılan
113/// bir major sürüm yükseltmesi facade için de kırıcı (breaking) sayılır.
114#[cfg(feature = "render")]
115pub use bytemuck;
116
117/// 1.0 kontratı: bu dış grafik tipi bilinçli olarak public API'nin parçasıdır;
118/// sürümü ilgili UI crate'inin semver'ine bağlıdır. `egui` feature'ı ile
119/// (overlay UI / editör) açılır.
120#[cfg(feature = "egui")]
121pub use egui;
122
123/// 1.0 kontratı: bu dış grafik tipi bilinçli olarak public API'nin parçasıdır;
124/// sürümü renderer crate'inin semver'ine bağlıdır.
125#[cfg(feature = "render")]
126pub use wgpu;
127
128/// 1.0 kontratı: bu dış pencere tipi bilinçli olarak public API'nin parçasıdır;
129/// sürümü window crate'inin semver'ine bağlıdır.
130#[cfg(feature = "window")]
131pub use winit;