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
//! Shared utility types and trait boundaries for the Cotis ecosystem.
//!
//! This crate contains cross-cutting primitives used by layout managers, renderers,
//! and interactivity layers:
//! - math types such as [`math::Vector2`] and [`math::BoundingBox`]
//! - renderer frame/window contracts in [`traits`]
//! - keyboard and mouse provider traits in [`interactivity`]
//! - text measuring hooks in [`text`]
//! - font registry helpers in [`font_manager`]
//! - runtime element inspection traits in [`element_state`]
//!
//! Unlike `cotis`, this crate does not define app orchestration or layout/renderer
//! interfaces. Unlike `cotis-defaults`, it does not define concrete element config
//! or render command structs.
//!
//! # Features
//!
//! - `serialization`: enables `serde` derives for [`math`] structs (`Vector2`,
//! `Dimensions`, and `BoundingBox`).
//!
//! # Text and fonts (evolving API)
//!
//! The text, font, and text-measuring APIs are functional today but are planned for
//! refactoring. Integrators should treat `font_id` assignment, [`font_manager::FontManager`],
//! [`text::RendererTextMeasuringProvider`], and [`text::LayoutTextMeasuring`] as
//! subject to change across minor versions until that refactor lands.
//!
//! # Quick start
//!
//! ```rust,ignore
//! use cotis_utils::interactivity::mouse::{MouseButton, MouseProvider};
//! use cotis_utils::math::{Dimensions, Vector2};
//! use cotis_utils::traits::{CotisFrameContext, CotisRenderContext, CotisWindowContext};
//!
//! struct MyRenderer;
//!
//! impl CotisWindowContext for MyRenderer {
//! fn window_dimensions(&self) -> Dimensions {
//! Dimensions::new(1280.0, 720.0)
//! }
//! }
//!
//! impl CotisFrameContext for MyRenderer {
//! fn get_delta_time(&self) -> f32 {
//! 1.0 / 60.0
//! }
//! }
//!
//! // CotisRenderContext is implemented automatically.
//!
//! impl MouseProvider for MyRenderer {
//! fn get_mouse_position(&self) -> Vector2 {
//! Vector2::new(0.0, 0.0)
//! }
//!
//! fn mouse_button_down(&self, _button: MouseButton) -> bool {
//! false
//! }
//!
//! fn get_mouse_wheel_move_v(&self) -> Vector2 {
//! Vector2::new(0.0, 0.0)
//! }
//! }
//! ```
/// Element-state query traits used by hit-testing and debug tools.
/// Thread-safe font registry and holder abstractions.
/// Keyboard/mouse input traits and key/button enums.
/// Math primitives used by layout, rendering and input providers.
/// Text measurement provider traits shared by layout and renderers.
/// Renderer context traits for window state and frame timing.