Skip to main content

game_toolkit/
lib.rs

1//! game-toolkit: a game-jam toolkit for 2D and 3D.
2//!
3//! This is the umbrella entry-point crate. Depend on `game-toolkit` and write
4//! `use game_toolkit::prelude::*;` to pull in the runtime types from the `game-toolkit-*`
5//! crates behind one dependency. Optional features: `ui`, `aseprite`, `ecs`, `synth`,
6//! `vector`.
7//!
8//! New here? The [`guide`] walks through the whole API on one page.
9
10#![forbid(unsafe_code)]
11
12#[cfg(feature = "aseprite")]
13mod aseprite_ext;
14
15pub mod guide;
16
17/// Everything you need to write a game: `use game_toolkit::prelude::*;`.
18pub mod prelude {
19    pub use anyhow;
20    pub use anyhow::Result;
21    pub use winit;
22
23    pub use game_toolkit_assets::Assets;
24    pub use game_toolkit_audio::{
25        Audio, AudioError, AudioStream, PlayOptions, SoundHandle, SoundId, StreamHandle, kira,
26    };
27    pub use game_toolkit_core::{AppConfig, Context, Game, GameEvent, Rng, Time, asset_root, run};
28    pub use game_toolkit_gfx::{
29        Align, BlendMode, Camera, Camera2D, Camera3D, CircleInstance, Color, Frame, Graphics,
30        Layer, Mat4, MeshId, MeshInstance, MeshVertex, Painter, SpriteInstance, TextureId,
31        TextureWrap, Tilemap, transform, wgpu,
32    };
33    pub use game_toolkit_input::{Axis, Button, Gamepad, GamepadId, Input, Key, MouseButton};
34
35    #[cfg(feature = "ui")]
36    pub use game_toolkit_ui::{self, Ui, egui};
37
38    #[cfg(feature = "aseprite")]
39    pub use crate::aseprite_ext::LoadAseprite;
40    #[cfg(feature = "aseprite")]
41    pub use game_toolkit_aseprite::{
42        self, Animation, AnimationPlayer, Direction, FrameRect, SpriteSheet,
43    };
44
45    #[cfg(feature = "synth")]
46    pub use game_toolkit_audio::{Synth, synthie};
47
48    #[cfg(feature = "ecs")]
49    pub use game_toolkit_ecs::{self, ChannelQueue, Vec2};
50
51    #[cfg(feature = "vector")]
52    pub use game_toolkit_gfx::vello;
53}