mirror of
https://github.com/danbulant/cushy
synced 2026-07-05 03:00:43 +00:00
Directly depending on figures
While this was a workaround for a docs.rs issue (Px/Lp are not linked), I decided having the shorter import path would look better in the examples. It probably wasn't necessary to update all of the references in the internal code, but I decided it was worth the consistency.
This commit is contained in:
parent
98f8d3a43d
commit
2fe28729df
59 changed files with 145 additions and 144 deletions
|
|
@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `figures` is now directly re-exported at this crate's root. Kludgine still
|
||||||
|
also provides this export, so existing references through kludgine will
|
||||||
|
continue to work. This was added as an attempt to fix links on docs.rs (see
|
||||||
|
rust-lang/docs.rs#1588).
|
||||||
|
|
||||||
## v0.2.0
|
## v0.2.0
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
|
||||||
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -576,6 +576,7 @@ dependencies = [
|
||||||
"alot",
|
"alot",
|
||||||
"arboard",
|
"arboard",
|
||||||
"cushy-macros",
|
"cushy-macros",
|
||||||
|
"figures",
|
||||||
"image",
|
"image",
|
||||||
"intentional",
|
"intentional",
|
||||||
"interner",
|
"interner",
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ roboto-flex = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
kludgine = { version = "0.7.0", features = ["app"] }
|
kludgine = { version = "0.7.0", features = ["app"] }
|
||||||
|
figures = "0.2.0"
|
||||||
# kludgine = { git = "https://github.com/khonsulabs/kludgine", features = [
|
# kludgine = { git = "https://github.com/khonsulabs/kludgine", features = [
|
||||||
# "app",
|
# "app",
|
||||||
# ] }
|
# ] }
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use cushy::value::Dynamic;
|
||||||
use cushy::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use cushy::widgets::progress::Progressable;
|
use cushy::widgets::progress::Progressable;
|
||||||
use cushy::{Run, WithClone};
|
use cushy::{Run, WithClone};
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let animation = Dynamic::new(AnimationHandle::new());
|
let animation = Dynamic::new(AnimationHandle::new());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use cushy::widgets::Canvas;
|
use cushy::widgets::Canvas;
|
||||||
use cushy::{Run, Tick};
|
use cushy::{Run, Tick};
|
||||||
use kludgine::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size};
|
use figures::{Angle, IntoSigned, Point, Px2D, Rect, Size};
|
||||||
use kludgine::shapes::Shape;
|
use kludgine::shapes::Shape;
|
||||||
use kludgine::text::{Text, TextOrigin};
|
use kludgine::text::{Text, TextOrigin};
|
||||||
use kludgine::{Color, DrawableExt};
|
use kludgine::{Color, DrawableExt};
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ use cushy::widget::MakeWidget;
|
||||||
use cushy::widgets::container::ContainerShadow;
|
use cushy::widgets::container::ContainerShadow;
|
||||||
use cushy::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::figures::{Point, Size};
|
use figures::{Point, Size};
|
||||||
use kludgine::shapes::CornerRadii;
|
use kludgine::shapes::CornerRadii;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ use cushy::widget::{MakeWidget, WidgetInstance};
|
||||||
use cushy::widgets::container::ContainerShadow;
|
use cushy::widgets::container::ContainerShadow;
|
||||||
use cushy::window::ThemeMode;
|
use cushy::window::ThemeMode;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::figures::Point;
|
use figures::Point;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let theme_mode = Dynamic::default();
|
let theme_mode = Dynamic::default();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::string::ToString;
|
||||||
use cushy::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use cushy::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let counter = Dynamic::new(0i32);
|
let counter = Dynamic::new(0i32);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ use cushy::value::Dynamic;
|
||||||
use cushy::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED};
|
use cushy::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED};
|
||||||
use cushy::widgets::Custom;
|
use cushy::widgets::Custom;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::{Lp, UPx};
|
use figures::units::{Lp, UPx};
|
||||||
use kludgine::figures::{ScreenScale, Size};
|
use figures::{ScreenScale, Size};
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
|
|
@ -107,7 +107,7 @@ impl Widget for Toggle {
|
||||||
|
|
||||||
fn hit_test(
|
fn hit_test(
|
||||||
&mut self,
|
&mut self,
|
||||||
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
_location: figures::Point<figures::units::Px>,
|
||||||
_context: &mut cushy::context::EventContext<'_, '_>,
|
_context: &mut cushy::context::EventContext<'_, '_>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
true
|
true
|
||||||
|
|
@ -115,7 +115,7 @@ impl Widget for Toggle {
|
||||||
|
|
||||||
fn mouse_down(
|
fn mouse_down(
|
||||||
&mut self,
|
&mut self,
|
||||||
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
_location: figures::Point<figures::units::Px>,
|
||||||
_device_id: kludgine::app::winit::event::DeviceId,
|
_device_id: kludgine::app::winit::event::DeviceId,
|
||||||
_button: kludgine::app::winit::event::MouseButton,
|
_button: kludgine::app::winit::event::MouseButton,
|
||||||
_context: &mut cushy::context::EventContext<'_, '_>,
|
_context: &mut cushy::context::EventContext<'_, '_>,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use cushy::widgets::grid::{Grid, GridDimension, GridWidgets};
|
||||||
use cushy::widgets::input::{InputValue, MaskedString};
|
use cushy::widgets::input::{InputValue, MaskedString};
|
||||||
use cushy::widgets::Expand;
|
use cushy::widgets::Expand;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
|
|
||||||
/// This example is the same as login, but it has an explicit tab order to
|
/// This example is the same as login, but it has an explicit tab order to
|
||||||
/// change from the default order (username, password, cancel, log in) to
|
/// change from the default order (username, password, cancel, log in) to
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use cushy::widgets::input::InputValue;
|
||||||
use cushy::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use cushy::widgets::Custom;
|
use cushy::widgets::Custom;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let allow_blur = Dynamic::new(true);
|
let allow_blur = Dynamic::new(true);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use cushy::widgets::image::{Aspect, ImageScaling};
|
||||||
use cushy::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use cushy::widgets::Image;
|
use cushy::widgets::Image;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
use kludgine::include_texture;
|
use kludgine::include_texture;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use cushy::value::Dynamic;
|
||||||
use cushy::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use cushy::widgets::input::{InputValue, MaskedString};
|
use cushy::widgets::input::{InputValue, MaskedString};
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Px;
|
use figures::units::Px;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let contents = Dynamic::from("Hello World");
|
let contents = Dynamic::from("Hello World");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use cushy::widgets::input::{InputValue, MaskedString};
|
||||||
use cushy::widgets::layers::OverlayLayer;
|
use cushy::widgets::layers::OverlayLayer;
|
||||||
use cushy::widgets::Expand;
|
use cushy::widgets::Expand;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let tooltips = OverlayLayer::default();
|
let tooltips = OverlayLayer::default();
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ use cushy::styles::components::FontFamily;
|
||||||
use cushy::styles::FontFamilyList;
|
use cushy::styles::FontFamilyList;
|
||||||
use cushy::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
|
use figures::units::Lp;
|
||||||
use kludgine::cosmic_text::FamilyOwned;
|
use kludgine::cosmic_text::FamilyOwned;
|
||||||
use kludgine::figures::units::Lp;
|
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
include_str!("./nested-scroll.rs")
|
include_str!("./nested-scroll.rs")
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||||
use cushy::widgets::container::ContainerShadow;
|
use cushy::widgets::container::ContainerShadow;
|
||||||
use cushy::widgets::layers::{OverlayBuilder, OverlayLayer};
|
use cushy::widgets::layers::{OverlayBuilder, OverlayLayer};
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::figures::Point;
|
use figures::Point;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ use cushy::widget::MakeWidget;
|
||||||
use cushy::widgets::progress::Progressable;
|
use cushy::widgets::progress::Progressable;
|
||||||
use cushy::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let indeterminant = Dynamic::new(false);
|
let indeterminant = Dynamic::new(false);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ use cushy::widgets::checkbox::Checkable;
|
||||||
use cushy::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use cushy::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::figures::Ranged;
|
use figures::Ranged;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let enabled = Dynamic::new(true);
|
let enabled = Dynamic::new(true);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use cushy::widget::MakeWidget;
|
||||||
use cushy::widgets::stack::Stack;
|
use cushy::widgets::stack::Stack;
|
||||||
use cushy::widgets::Style;
|
use cushy::widgets::Style;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use cushy::widgets::slider::Slidable;
|
||||||
use cushy::widgets::Space;
|
use cushy::widgets::Space;
|
||||||
use cushy::window::ThemeMode;
|
use cushy::window::ThemeMode;
|
||||||
use cushy::{Open, PendingApp};
|
use cushy::{Open, PendingApp};
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
use palette::OklabHue;
|
use palette::OklabHue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use cushy::value::Dynamic;
|
||||||
use cushy::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use cushy::widgets::button::ButtonKind;
|
use cushy::widgets::button::ButtonKind;
|
||||||
use cushy::{Run, WithClone};
|
use cushy::{Run, WithClone};
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let app = Dynamic::default();
|
let app = Dynamic::default();
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ use std::array;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use cushy::figures::units::Px;
|
||||||
|
use cushy::figures::{Point, Rect, Size};
|
||||||
use cushy::kludgine::app::winit::keyboard::Key;
|
use cushy::kludgine::app::winit::keyboard::Key;
|
||||||
use cushy::kludgine::figures::units::Px;
|
|
||||||
use cushy::kludgine::figures::{Point, Rect, Size};
|
|
||||||
use cushy::kludgine::render::Renderer;
|
use cushy::kludgine::render::Renderer;
|
||||||
use cushy::kludgine::shapes::Shape;
|
use cushy::kludgine::shapes::Shape;
|
||||||
use cushy::kludgine::tilemap::{
|
use cushy::kludgine::tilemap::{
|
||||||
|
|
@ -14,8 +14,8 @@ use cushy::kludgine::Color;
|
||||||
use cushy::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use cushy::widgets::TileMap;
|
use cushy::widgets::TileMap;
|
||||||
use cushy::{Run, Tick};
|
use cushy::{Run, Tick};
|
||||||
|
use figures::FloatConversion;
|
||||||
use kludgine::app::winit::keyboard::NamedKey;
|
use kludgine::app::winit::keyboard::NamedKey;
|
||||||
use kludgine::figures::FloatConversion;
|
|
||||||
use kludgine::sprite::{Sprite, SpriteSource};
|
use kludgine::sprite::{Sprite, SpriteSource};
|
||||||
use kludgine::{include_aseprite_sprite, DrawableExt};
|
use kludgine::{include_aseprite_sprite, DrawableExt};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use cushy::value::{Dynamic, Validations};
|
||||||
use cushy::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use cushy::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let text = Dynamic::default();
|
let text = Dynamic::default();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use cushy::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use cushy::widget::{MakeWidget, WidgetInstance};
|
use cushy::widget::{MakeWidget, WidgetInstance};
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
|
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
let focused = Dynamic::new(false);
|
let focused = Dynamic::new(false);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use cushy::value::Dynamic;
|
||||||
use cushy::widget::{Children, MakeWidget};
|
use cushy::widget::{Children, MakeWidget};
|
||||||
use cushy::widgets::wrap::{VerticalAlign, WrapAlign};
|
use cushy::widgets::wrap::{VerticalAlign, WrapAlign};
|
||||||
use cushy::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
|
||||||
const EXPLANATION: &str = "This example demonstrates the Wrap widget. Each word shown here is an individual Label widget that is being positioned by the Wrap widget.";
|
const EXPLANATION: &str = "This example demonstrates the Wrap widget. Each word shown here is an individual Label widget that is being positioned by the Wrap widget.";
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@ use std::thread;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use alot::{LotId, Lots};
|
use alot::{LotId, Lots};
|
||||||
|
use figures::units::{Lp, Px, UPx};
|
||||||
|
use figures::{Angle, Ranged, UnscaledUnit, Zero};
|
||||||
use intentional::Cast;
|
use intentional::Cast;
|
||||||
use kempt::Set;
|
use kempt::Set;
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
|
||||||
use kludgine::figures::{Angle, Ranged, UnscaledUnit, Zero};
|
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
use crate::animation::easings::Linear;
|
use crate::animation::easings::Linear;
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::{Arc, Mutex, MutexGuard};
|
use std::sync::{Arc, Mutex, MutexGuard};
|
||||||
|
|
||||||
|
use figures::units::{Lp, Px, UPx};
|
||||||
|
use figures::{IntoSigned, Point, Px2D, Rect, Round, ScreenScale, Size, Zero};
|
||||||
use kempt::Set;
|
use kempt::Set;
|
||||||
use kludgine::app::winit::event::{
|
use kludgine::app::winit::event::{
|
||||||
DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
||||||
};
|
};
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
|
||||||
use kludgine::figures::{IntoSigned, Point, Px2D, Rect, Round, ScreenScale, Size, Zero};
|
|
||||||
use kludgine::shapes::{Shape, StrokeOptions};
|
use kludgine::shapes::{Shape, StrokeOptions};
|
||||||
use kludgine::{Color, Kludgine};
|
use kludgine::{Color, Kludgine};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use ahash::AHashSet;
|
use ahash::AHashSet;
|
||||||
use kludgine::cosmic_text::FamilyOwned;
|
use figures::units::{Px, UPx};
|
||||||
use kludgine::figures::units::{Px, UPx};
|
use figures::{
|
||||||
use kludgine::figures::{
|
|
||||||
self, Fraction, IntoSigned, IntoUnsigned, Point, Rect, ScreenScale, ScreenUnit, Size, Zero,
|
self, Fraction, IntoSigned, IntoUnsigned, Point, Rect, ScreenScale, ScreenUnit, Size, Zero,
|
||||||
};
|
};
|
||||||
|
use kludgine::cosmic_text::FamilyOwned;
|
||||||
use kludgine::render::Renderer;
|
use kludgine::render::Renderer;
|
||||||
use kludgine::shapes::Shape;
|
use kludgine::shapes::Shape;
|
||||||
use kludgine::text::{MeasuredText, Text, TextOrigin};
|
use kludgine::text::{MeasuredText, Text, TextOrigin};
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ pub mod window;
|
||||||
use std::ops::Sub;
|
use std::ops::Sub;
|
||||||
|
|
||||||
pub use app::{App, Application, Cushy, Open, PendingApp, Run};
|
pub use app::{App, Application, Cushy, Open, PendingApp, Run};
|
||||||
pub use kludgine;
|
use figures::units::UPx;
|
||||||
|
use figures::{Fraction, ScreenUnit, Size};
|
||||||
use kludgine::app::winit::error::EventLoopError;
|
use kludgine::app::winit::error::EventLoopError;
|
||||||
use kludgine::figures::units::UPx;
|
|
||||||
use kludgine::figures::{Fraction, ScreenUnit, Size};
|
|
||||||
pub use names::Name;
|
pub use names::Name;
|
||||||
pub use utils::{Lazy, WithClone};
|
pub use utils::{Lazy, WithClone};
|
||||||
|
pub use {figures, kludgine};
|
||||||
|
|
||||||
pub use self::graphics::Graphics;
|
pub use self::graphics::Graphics;
|
||||||
pub use self::tick::{InputState, Tick};
|
pub use self::tick::{InputState, Tick};
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,13 @@ use std::ops::{
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ahash::AHashMap;
|
use ahash::AHashMap;
|
||||||
use kludgine::cosmic_text::{FamilyOwned, Style, Weight};
|
use figures::units::{Lp, Px, UPx};
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
use figures::{Fraction, IntoSigned, IntoUnsigned, Rect, ScreenScale, Size, Zero};
|
||||||
use kludgine::figures::{Fraction, IntoSigned, IntoUnsigned, Rect, ScreenScale, Size, Zero};
|
pub use kludgine::cosmic_text::{FamilyOwned, Style, Weight};
|
||||||
use kludgine::shapes::CornerRadii;
|
pub use kludgine::shapes::CornerRadii;
|
||||||
use kludgine::Color;
|
pub use kludgine::Color;
|
||||||
use palette::{IntoColor, Okhsl, OklabHue, Srgb};
|
pub use palette::OklabHue;
|
||||||
|
use palette::{IntoColor, Okhsl, Srgb};
|
||||||
|
|
||||||
use crate::animation::{EasingFunction, ZeroToOne};
|
use crate::animation::{EasingFunction, ZeroToOne};
|
||||||
use crate::context::WidgetContext;
|
use crate::context::WidgetContext;
|
||||||
|
|
@ -747,25 +748,25 @@ impl ScreenScale for Dimension {
|
||||||
type Px = Px;
|
type Px = Px;
|
||||||
type UPx = UPx;
|
type UPx = UPx;
|
||||||
|
|
||||||
fn into_px(self, scale: kludgine::figures::Fraction) -> Px {
|
fn into_px(self, scale: figures::Fraction) -> Px {
|
||||||
match self {
|
match self {
|
||||||
Dimension::Px(px) => px,
|
Dimension::Px(px) => px,
|
||||||
Dimension::Lp(lp) => lp.into_px(scale),
|
Dimension::Lp(lp) => lp.into_px(scale),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_px(px: Px, _scale: kludgine::figures::Fraction) -> Self {
|
fn from_px(px: Px, _scale: figures::Fraction) -> Self {
|
||||||
Self::from(px)
|
Self::from(px)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_lp(self, scale: kludgine::figures::Fraction) -> Lp {
|
fn into_lp(self, scale: figures::Fraction) -> Lp {
|
||||||
match self {
|
match self {
|
||||||
Dimension::Px(px) => px.into_lp(scale),
|
Dimension::Px(px) => px.into_lp(scale),
|
||||||
Dimension::Lp(lp) => lp,
|
Dimension::Lp(lp) => lp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_lp(lp: Lp, _scale: kludgine::figures::Fraction) -> Self {
|
fn from_lp(lp: Lp, _scale: figures::Fraction) -> Self {
|
||||||
Self::from(lp)
|
Self::from(lp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//! All style components supported by the built-in widgets.
|
//! All style components supported by the built-in widgets.
|
||||||
|
|
||||||
|
use figures::units::Lp;
|
||||||
use kludgine::cosmic_text::{FamilyOwned, Style, Weight};
|
use kludgine::cosmic_text::{FamilyOwned, Style, Weight};
|
||||||
use kludgine::figures::units::Lp;
|
|
||||||
use kludgine::shapes::CornerRadii;
|
use kludgine::shapes::CornerRadii;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ use crate::styles::{Dimension, FocusableWidgets, FontFamilyList, VisualOrder};
|
||||||
/// use cushy::styles::Dimension;
|
/// use cushy::styles::Dimension;
|
||||||
/// use cushy::styles::components::{SurfaceColor, TextColor};
|
/// use cushy::styles::components::{SurfaceColor, TextColor};
|
||||||
/// use cushy::kludgine::Color;
|
/// use cushy::kludgine::Color;
|
||||||
/// use cushy::kludgine::figures::Zero;
|
/// use cushy::figures::Zero;
|
||||||
///
|
///
|
||||||
/// define_components! {
|
/// define_components! {
|
||||||
/// GroupName {
|
/// GroupName {
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ use std::sync::{Arc, Condvar, Mutex, MutexGuard};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use ahash::AHashSet;
|
use ahash::AHashSet;
|
||||||
|
use figures::units::Px;
|
||||||
|
use figures::Point;
|
||||||
use intentional::Assert;
|
use intentional::Assert;
|
||||||
use kludgine::app::winit::event::{ElementState, KeyEvent, MouseButton};
|
use kludgine::app::winit::event::{ElementState, KeyEvent, MouseButton};
|
||||||
use kludgine::app::winit::keyboard::Key;
|
use kludgine::app::winit::keyboard::Key;
|
||||||
use kludgine::figures::units::Px;
|
|
||||||
use kludgine::figures::Point;
|
|
||||||
|
|
||||||
use crate::context::WidgetContext;
|
use crate::context::WidgetContext;
|
||||||
use crate::utils::IgnorePoison;
|
use crate::utils::IgnorePoison;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ use std::sync::{Arc, Mutex, Weak};
|
||||||
|
|
||||||
use ahash::AHashMap;
|
use ahash::AHashMap;
|
||||||
use alot::{LotId, Lots};
|
use alot::{LotId, Lots};
|
||||||
use kludgine::figures::units::{Px, UPx};
|
use figures::units::{Px, UPx};
|
||||||
use kludgine::figures::{Point, Rect, Size};
|
use figures::{Point, Rect, Size};
|
||||||
|
|
||||||
use crate::styles::{Styles, ThemePair, VisualOrder};
|
use crate::styles::{Styles, ThemePair, VisualOrder};
|
||||||
use crate::utils::IgnorePoison;
|
use crate::utils::IgnorePoison;
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ use std::sync::{Arc, Mutex, MutexGuard};
|
||||||
use std::{slice, vec};
|
use std::{slice, vec};
|
||||||
|
|
||||||
use alot::LotId;
|
use alot::LotId;
|
||||||
|
use figures::units::{Px, UPx};
|
||||||
|
use figures::{IntoSigned, IntoUnsigned, Point, Rect, Size};
|
||||||
use intentional::Assert;
|
use intentional::Assert;
|
||||||
use kludgine::app::winit::event::{
|
use kludgine::app::winit::event::{
|
||||||
DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
||||||
};
|
};
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
use kludgine::figures::units::{Px, UPx};
|
|
||||||
use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size};
|
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
use crate::app::{Application, Open, PendingApp, Run};
|
use crate::app::{Application, Open, PendingApp, Run};
|
||||||
|
|
@ -1156,7 +1156,7 @@ pub trait MakeWidget: Sized {
|
||||||
///
|
///
|
||||||
/// - [`Dimension`]
|
/// - [`Dimension`]
|
||||||
/// - [`Px`]
|
/// - [`Px`]
|
||||||
/// - [`Lp`](crate::kludgine::figures::units::Lp)
|
/// - [`Lp`](crate::figures::units::Lp)
|
||||||
/// - A range of any fo the above.
|
/// - A range of any fo the above.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn width(self, width: impl Into<DimensionRange>) -> Resize {
|
fn width(self, width: impl Into<DimensionRange>) -> Resize {
|
||||||
|
|
@ -1169,7 +1169,7 @@ pub trait MakeWidget: Sized {
|
||||||
///
|
///
|
||||||
/// - [`Dimension`]
|
/// - [`Dimension`]
|
||||||
/// - [`Px`]
|
/// - [`Px`]
|
||||||
/// - [`Lp`](crate::kludgine::figures::units::Lp)
|
/// - [`Lp`](crate::figures::units::Lp)
|
||||||
/// - A range of any fo the above.
|
/// - A range of any fo the above.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn height(self, height: impl Into<DimensionRange>) -> Resize {
|
fn height(self, height: impl Into<DimensionRange>) -> Resize {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use kludgine::figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use kludgine::figures::{Fraction, IntoSigned, Point, Rect, ScreenScale, Size};
|
use figures::{Fraction, IntoSigned, Point, Rect, ScreenScale, Size};
|
||||||
|
|
||||||
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
||||||
use crate::styles::{Edges, FlexibleDimension};
|
use crate::styles::{Edges, FlexibleDimension};
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
//! A clickable, labeled button
|
//! A clickable, labeled button
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use figures::units::{Lp, Px, UPx};
|
||||||
|
use figures::{IntoSigned, Point, Rect, Round, ScreenScale, Size};
|
||||||
use kludgine::app::winit::event::{DeviceId, ElementState, KeyEvent, MouseButton};
|
use kludgine::app::winit::event::{DeviceId, ElementState, KeyEvent, MouseButton};
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
|
||||||
use kludgine::figures::{IntoSigned, Point, Rect, Round, ScreenScale, Size};
|
|
||||||
use kludgine::shapes::{Shape, StrokeOptions};
|
use kludgine::shapes::{Shape, StrokeOptions};
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use kludgine::figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
|
|
||||||
use crate::context::{GraphicsContext, LayoutContext};
|
use crate::context::{GraphicsContext, LayoutContext};
|
||||||
use crate::value::Dynamic;
|
use crate::value::Dynamic;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ use std::error::Error;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::ops::Not;
|
use std::ops::Not;
|
||||||
|
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::figures::{Point, Rect, Round, ScreenScale, Size};
|
use figures::{Point, Rect, Round, ScreenScale, Size};
|
||||||
use kludgine::shapes::{PathBuilder, Shape, StrokeOptions};
|
use kludgine::shapes::{PathBuilder, Shape, StrokeOptions};
|
||||||
|
|
||||||
use crate::context::{GraphicsContext, LayoutContext};
|
use crate::context::{GraphicsContext, LayoutContext};
|
||||||
|
|
@ -245,7 +245,7 @@ impl Widget for CheckboxOrnament {
|
||||||
&mut self,
|
&mut self,
|
||||||
_available_space: Size<ConstraintLimit>,
|
_available_space: Size<ConstraintLimit>,
|
||||||
context: &mut LayoutContext<'_, '_, '_, '_, '_>,
|
context: &mut LayoutContext<'_, '_, '_, '_, '_>,
|
||||||
) -> Size<kludgine::figures::units::UPx> {
|
) -> Size<figures::units::UPx> {
|
||||||
let checkbox_size = context.get(&CheckboxSize).into_upx(context.gfx.scale());
|
let checkbox_size = context.get(&CheckboxSize).into_upx(context.gfx.scale());
|
||||||
Size::squared(checkbox_size)
|
Size::squared(checkbox_size)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use kludgine::figures::units::Px;
|
use figures::units::Px;
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
|
|
||||||
use crate::animation::easings::{EaseInQuadradic, EaseOutQuadradic};
|
use crate::animation::easings::{EaseInQuadradic, EaseOutQuadradic};
|
||||||
use crate::animation::{AnimationHandle, AnimationTarget, EasingFunction, Spawn};
|
use crate::animation::{AnimationHandle, AnimationTarget, EasingFunction, Spawn};
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
//! Widgets for selecting colors.
|
//! Widgets for selecting colors.
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
|
use figures::units::{Lp, Px};
|
||||||
|
use figures::{FloatConversion, Point, Rect, Round, ScreenScale, Zero};
|
||||||
use intentional::Cast;
|
use intentional::Cast;
|
||||||
use kludgine::app::winit::event::{DeviceId, MouseButton};
|
use kludgine::app::winit::event::{DeviceId, MouseButton};
|
||||||
use kludgine::figures::units::{Lp, Px};
|
|
||||||
use kludgine::figures::{FloatConversion, Point, Rect, Round, ScreenScale, Zero};
|
|
||||||
use kludgine::shapes::{self, FillOptions, PathBuilder, Shape, StrokeOptions};
|
use kludgine::shapes::{self, FillOptions, PathBuilder, Shape, StrokeOptions};
|
||||||
use kludgine::{Color, DrawableExt, Origin};
|
use kludgine::{Color, DrawableExt, Origin};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
use std::ops::Div;
|
use std::ops::Div;
|
||||||
|
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
use figures::units::{Lp, Px, UPx};
|
||||||
use kludgine::figures::{
|
use figures::{Abs, Angle, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero};
|
||||||
Abs, Angle, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero,
|
|
||||||
};
|
|
||||||
use kludgine::shapes::{CornerRadii, PathBuilder, Shape};
|
use kludgine::shapes::{CornerRadii, PathBuilder, Shape};
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
|
|
@ -763,7 +761,7 @@ where
|
||||||
type Px = ContainerShadow<Px>;
|
type Px = ContainerShadow<Px>;
|
||||||
type UPx = ContainerShadow<UPx>;
|
type UPx = ContainerShadow<UPx>;
|
||||||
|
|
||||||
fn into_px(self, scale: kludgine::figures::Fraction) -> Self::Px {
|
fn into_px(self, scale: figures::Fraction) -> Self::Px {
|
||||||
ContainerShadow {
|
ContainerShadow {
|
||||||
color: self.color,
|
color: self.color,
|
||||||
offset: self.offset.into_px(scale),
|
offset: self.offset.into_px(scale),
|
||||||
|
|
@ -772,7 +770,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_px(px: Self::Px, scale: kludgine::figures::Fraction) -> Self {
|
fn from_px(px: Self::Px, scale: figures::Fraction) -> Self {
|
||||||
Self {
|
Self {
|
||||||
color: px.color,
|
color: px.color,
|
||||||
offset: Point::from_px(px.offset, scale),
|
offset: Point::from_px(px.offset, scale),
|
||||||
|
|
@ -781,7 +779,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_upx(self, scale: kludgine::figures::Fraction) -> Self::UPx {
|
fn into_upx(self, scale: figures::Fraction) -> Self::UPx {
|
||||||
ContainerShadow {
|
ContainerShadow {
|
||||||
color: self.color,
|
color: self.color,
|
||||||
offset: self.offset.into_upx(scale),
|
offset: self.offset.into_upx(scale),
|
||||||
|
|
@ -790,7 +788,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_upx(px: Self::UPx, scale: kludgine::figures::Fraction) -> Self {
|
fn from_upx(px: Self::UPx, scale: figures::Fraction) -> Self {
|
||||||
Self {
|
Self {
|
||||||
color: px.color,
|
color: px.color,
|
||||||
offset: Point::from_upx(px.offset, scale),
|
offset: Point::from_upx(px.offset, scale),
|
||||||
|
|
@ -799,7 +797,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_lp(self, scale: kludgine::figures::Fraction) -> Self::Lp {
|
fn into_lp(self, scale: figures::Fraction) -> Self::Lp {
|
||||||
ContainerShadow {
|
ContainerShadow {
|
||||||
color: self.color,
|
color: self.color,
|
||||||
offset: self.offset.into_lp(scale),
|
offset: self.offset.into_lp(scale),
|
||||||
|
|
@ -808,7 +806,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_lp(lp: Self::Lp, scale: kludgine::figures::Fraction) -> Self {
|
fn from_lp(lp: Self::Lp, scale: figures::Fraction) -> Self {
|
||||||
Self {
|
Self {
|
||||||
color: lp.color,
|
color: lp.color,
|
||||||
offset: Point::from_lp(lp.offset, scale),
|
offset: Point::from_lp(lp.offset, scale),
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
use figures::units::Px;
|
||||||
|
use figures::{Point, Size};
|
||||||
use kludgine::app::winit::event::{
|
use kludgine::app::winit::event::{
|
||||||
DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
||||||
};
|
};
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
use kludgine::figures::units::Px;
|
|
||||||
use kludgine::figures::{Point, Size};
|
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
use crate::context::{EventContext, GraphicsContext, LayoutContext, WidgetContext};
|
use crate::context::{EventContext, GraphicsContext, LayoutContext, WidgetContext};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use kludgine::figures::{IntoSigned, Size};
|
use figures::{IntoSigned, Size};
|
||||||
|
|
||||||
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
||||||
use crate::widget::{MakeWidget, RootBehavior, WidgetRef, WrappedLayout, WrapperWidget};
|
use crate::widget::{MakeWidget, RootBehavior, WidgetRef, WrappedLayout, WrapperWidget};
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,9 @@ use std::fmt::Debug;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use alot::{LotId, OrderedLots};
|
use alot::{LotId, OrderedLots};
|
||||||
|
use figures::units::{Lp, UPx};
|
||||||
|
use figures::{Fraction, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size};
|
||||||
use intentional::{Assert, Cast};
|
use intentional::{Assert, Cast};
|
||||||
use kludgine::figures::units::{Lp, UPx};
|
|
||||||
use kludgine::figures::{
|
|
||||||
Fraction, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::context::{AsEventContext, EventContext, GraphicsContext, LayoutContext};
|
use crate::context::{AsEventContext, EventContext, GraphicsContext, LayoutContext};
|
||||||
use crate::styles::components::IntrinsicPadding;
|
use crate::styles::components::IntrinsicPadding;
|
||||||
|
|
@ -577,8 +575,8 @@ impl Deref for GridLayout {
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
use kludgine::figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use kludgine::figures::{Fraction, IntoSigned, Size};
|
use figures::{Fraction, IntoSigned, Size};
|
||||||
|
|
||||||
use super::{GridDimension, GridLayout, Orientation};
|
use super::{GridDimension, GridLayout, Orientation};
|
||||||
use crate::styles::Dimension;
|
use crate::styles::Dimension;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//! A widget that displays an image/texture.
|
//! A widget that displays an image/texture.
|
||||||
|
|
||||||
use kludgine::figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use kludgine::figures::{FloatConversion, IntoSigned, Point, Rect, Size, Zero};
|
use figures::{FloatConversion, IntoSigned, Point, Rect, Size, Zero};
|
||||||
use kludgine::{AnyTexture, CollectedTexture, LazyTexture, SharedTexture, Texture, TextureRegion};
|
use kludgine::{AnyTexture, CollectedTexture, LazyTexture, SharedTexture, Texture, TextureRegion};
|
||||||
|
|
||||||
use crate::animation::ZeroToOne;
|
use crate::animation::ZeroToOne;
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::{Arc, OnceLock};
|
use std::sync::{Arc, OnceLock};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use figures::units::{Lp, Px, UPx};
|
||||||
|
use figures::{
|
||||||
|
Abs, FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size,
|
||||||
|
};
|
||||||
use intentional::Cast;
|
use intentional::Cast;
|
||||||
use kludgine::app::winit::event::{ElementState, Ime, KeyEvent};
|
use kludgine::app::winit::event::{ElementState, Ime, KeyEvent};
|
||||||
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
||||||
use kludgine::app::winit::window::{CursorIcon, ImePurpose};
|
use kludgine::app::winit::window::{CursorIcon, ImePurpose};
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
|
||||||
use kludgine::figures::{
|
|
||||||
Abs, FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size,
|
|
||||||
};
|
|
||||||
use kludgine::shapes::{Shape, StrokeOptions};
|
use kludgine::shapes::{Shape, StrokeOptions};
|
||||||
use kludgine::text::{MeasuredText, Text, TextOrigin};
|
use kludgine::text::{MeasuredText, Text, TextOrigin};
|
||||||
use kludgine::{CanRenderTo, Color, DrawableExt};
|
use kludgine::{CanRenderTo, Color, DrawableExt};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//! A read-only text widget.
|
//! A read-only text widget.
|
||||||
|
|
||||||
use kludgine::figures::units::{Px, UPx};
|
use figures::units::{Px, UPx};
|
||||||
use kludgine::figures::{Point, Round, Size};
|
use figures::{Point, Round, Size};
|
||||||
use kludgine::text::{MeasuredText, Text, TextOrigin};
|
use kludgine::text::{MeasuredText, Text, TextOrigin};
|
||||||
use kludgine::{CanRenderTo, Color, DrawableExt};
|
use kludgine::{CanRenderTo, Color, DrawableExt};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ use std::time::Duration;
|
||||||
|
|
||||||
use alot::{LotId, OrderedLots};
|
use alot::{LotId, OrderedLots};
|
||||||
use cushy::widget::{RootBehavior, WidgetInstance};
|
use cushy::widget::{RootBehavior, WidgetInstance};
|
||||||
|
use figures::units::{Lp, Px, UPx};
|
||||||
|
use figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero};
|
||||||
use intentional::Assert;
|
use intentional::Assert;
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
|
||||||
use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero};
|
|
||||||
|
|
||||||
use crate::animation::easings::EaseOutQuadradic;
|
use crate::animation::easings::EaseOutQuadradic;
|
||||||
use crate::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn, ZeroToOne};
|
use crate::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn, ZeroToOne};
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
use std::ops::RangeInclusive;
|
use std::ops::RangeInclusive;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use kludgine::figures::units::Px;
|
use figures::units::Px;
|
||||||
use kludgine::figures::{Angle, Point, Ranged, ScreenScale, Size, Zero};
|
use figures::{Angle, Point, Ranged, ScreenScale, Size, Zero};
|
||||||
use kludgine::shapes::{Path, StrokeOptions};
|
use kludgine::shapes::{Path, StrokeOptions};
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
|
|
@ -383,9 +383,9 @@ impl Widget for Spinner {
|
||||||
|
|
||||||
fn layout(
|
fn layout(
|
||||||
&mut self,
|
&mut self,
|
||||||
available_space: kludgine::figures::Size<crate::ConstraintLimit>,
|
available_space: figures::Size<crate::ConstraintLimit>,
|
||||||
context: &mut crate::context::LayoutContext<'_, '_, '_, '_, '_>,
|
context: &mut crate::context::LayoutContext<'_, '_, '_, '_, '_>,
|
||||||
) -> kludgine::figures::Size<kludgine::figures::units::UPx> {
|
) -> figures::Size<figures::units::UPx> {
|
||||||
let track_size = context.get(&TrackSize).into_px(context.gfx.scale());
|
let track_size = context.get(&TrackSize).into_px(context.gfx.scale());
|
||||||
let minimum_size = track_size * 4;
|
let minimum_size = track_size * 4;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
//! A labeled widget with a circular indicator representing a value.
|
//! A labeled widget with a circular indicator representing a value.
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use kludgine::figures::units::Lp;
|
use figures::units::Lp;
|
||||||
use kludgine::figures::{Point, ScreenScale, Size};
|
use figures::{Point, ScreenScale, Size};
|
||||||
use kludgine::shapes::{Shape, StrokeOptions};
|
use kludgine::shapes::{Shape, StrokeOptions};
|
||||||
use kludgine::DrawableExt;
|
use kludgine::DrawableExt;
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ where
|
||||||
&mut self,
|
&mut self,
|
||||||
_available_space: Size<ConstraintLimit>,
|
_available_space: Size<ConstraintLimit>,
|
||||||
context: &mut LayoutContext<'_, '_, '_, '_, '_>,
|
context: &mut LayoutContext<'_, '_, '_, '_, '_>,
|
||||||
) -> Size<kludgine::figures::units::UPx> {
|
) -> Size<figures::units::UPx> {
|
||||||
let radio_size = context.get(&RadioSize).into_upx(context.gfx.scale());
|
let radio_size = context.get(&RadioSize).into_upx(context.gfx.scale());
|
||||||
Size::squared(radio_size)
|
Size::squared(radio_size)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use kludgine::figures::{Fraction, IntoSigned, ScreenScale, Size};
|
use figures::{Fraction, IntoSigned, ScreenScale, Size};
|
||||||
|
|
||||||
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
||||||
use crate::styles::DimensionRange;
|
use crate::styles::DimensionRange;
|
||||||
|
|
@ -50,8 +50,8 @@ impl Resize {
|
||||||
/// `width` can be an any of:
|
/// `width` can be an any of:
|
||||||
///
|
///
|
||||||
/// - [`Dimension`](crate::styles::Dimension)
|
/// - [`Dimension`](crate::styles::Dimension)
|
||||||
/// - [`Px`](crate::kludgine::figures::units::Px)
|
/// - [`Px`](crate::figures::units::Px)
|
||||||
/// - [`Lp`](crate::kludgine::figures::units::Lp)
|
/// - [`Lp`](crate::figures::units::Lp)
|
||||||
/// - A range of any fo the above.
|
/// - A range of any fo the above.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn width(mut self, width: impl Into<DimensionRange>) -> Self {
|
pub fn width(mut self, width: impl Into<DimensionRange>) -> Self {
|
||||||
|
|
@ -64,8 +64,8 @@ impl Resize {
|
||||||
/// `height` can be an any of:
|
/// `height` can be an any of:
|
||||||
///
|
///
|
||||||
/// - [`Dimension`](crate::styles::Dimension)
|
/// - [`Dimension`](crate::styles::Dimension)
|
||||||
/// - [`Px`](crate::kludgine::figures::units::Px)
|
/// - [`Px`](crate::figures::units::Px)
|
||||||
/// - [`Lp`](crate::kludgine::figures::units::Lp)
|
/// - [`Lp`](crate::figures::units::Lp)
|
||||||
/// - A range of any fo the above.
|
/// - A range of any fo the above.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn height(mut self, height: impl Into<DimensionRange>) -> Self {
|
pub fn height(mut self, height: impl Into<DimensionRange>) -> Self {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
//! A container that scrolls its contents on a virtual surface.
|
//! A container that scrolls its contents on a virtual surface.
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
use figures::units::{Lp, Px, UPx};
|
||||||
|
use figures::{FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, ScreenScale, Size, Zero};
|
||||||
use intentional::Cast;
|
use intentional::Cast;
|
||||||
use kludgine::app::winit::event::{DeviceId, MouseScrollDelta, TouchPhase};
|
use kludgine::app::winit::event::{DeviceId, MouseScrollDelta, TouchPhase};
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
|
||||||
use kludgine::figures::{
|
|
||||||
FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, ScreenScale, Size, Zero,
|
|
||||||
};
|
|
||||||
use kludgine::shapes::Shape;
|
use kludgine::shapes::Shape;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,12 @@ use std::fmt::Debug;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::RangeInclusive;
|
use std::ops::RangeInclusive;
|
||||||
|
|
||||||
|
use figures::units::{Lp, Px, UPx};
|
||||||
|
use figures::{FloatConversion, IntoSigned, Point, Ranged, Rect, Round, ScreenScale, Size};
|
||||||
use intentional::{Assert, Cast as _};
|
use intentional::{Assert, Cast as _};
|
||||||
use kludgine::app::winit::event::{DeviceId, MouseButton, MouseScrollDelta, TouchPhase};
|
use kludgine::app::winit::event::{DeviceId, MouseButton, MouseScrollDelta, TouchPhase};
|
||||||
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
|
||||||
use kludgine::figures::{
|
|
||||||
FloatConversion, IntoSigned, Point, Ranged, Rect, Round, ScreenScale, Size,
|
|
||||||
};
|
|
||||||
use kludgine::shapes::{Shape, StrokeOptions};
|
use kludgine::shapes::{Shape, StrokeOptions};
|
||||||
use kludgine::{Color, DrawableExt, Origin};
|
use kludgine::{Color, DrawableExt, Origin};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use kludgine::figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
use crate::context::{GraphicsContext, LayoutContext};
|
use crate::context::{GraphicsContext, LayoutContext};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//! A widget that combines a collection of [`Children`] widgets into one.
|
//! A widget that combines a collection of [`Children`] widgets into one.
|
||||||
|
|
||||||
use kludgine::figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use kludgine::figures::{IntoSigned, Rect, Round, ScreenScale, Size};
|
use figures::{IntoSigned, Rect, Round, ScreenScale, Size};
|
||||||
|
|
||||||
use crate::context::{AsEventContext, EventContext, GraphicsContext, LayoutContext};
|
use crate::context::{AsEventContext, EventContext, GraphicsContext, LayoutContext};
|
||||||
use crate::styles::components::IntrinsicPadding;
|
use crate::styles::components::IntrinsicPadding;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
|
|
||||||
use crate::context::{AsEventContext, LayoutContext};
|
use crate::context::{AsEventContext, LayoutContext};
|
||||||
use crate::value::{Dynamic, DynamicReader, IntoDynamic};
|
use crate::value::{Dynamic, DynamicReader, IntoDynamic};
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,14 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
use figures::units::{Px, UPx};
|
||||||
|
use figures::{Point, Size};
|
||||||
use intentional::Cast;
|
use intentional::Cast;
|
||||||
use kludgine::app::winit::event::ElementState;
|
use kludgine::app::winit::event::{DeviceId, ElementState, KeyEvent, MouseScrollDelta, TouchPhase};
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
use kludgine::figures::units::Px;
|
use kludgine::tilemap;
|
||||||
use kludgine::figures::Point;
|
use kludgine::tilemap::TileMapFocus;
|
||||||
|
|
||||||
use crate::context::{EventContext, GraphicsContext, LayoutContext};
|
use crate::context::{EventContext, GraphicsContext, LayoutContext};
|
||||||
use crate::kludgine::app::winit::event::{DeviceId, KeyEvent, MouseScrollDelta, TouchPhase};
|
|
||||||
use crate::kludgine::figures::units::UPx;
|
|
||||||
use crate::kludgine::figures::Size;
|
|
||||||
use crate::kludgine::tilemap;
|
|
||||||
use crate::kludgine::tilemap::TileMapFocus;
|
|
||||||
use crate::tick::Tick;
|
use crate::tick::Tick;
|
||||||
use crate::value::{Dynamic, IntoValue, Value};
|
use crate::value::{Dynamic, IntoValue, Value};
|
||||||
use crate::widget::{EventHandling, Widget, HANDLED, IGNORED};
|
use crate::widget::{EventHandling, Widget, HANDLED, IGNORED};
|
||||||
|
|
@ -112,7 +109,7 @@ where
|
||||||
|
|
||||||
fn hit_test(
|
fn hit_test(
|
||||||
&mut self,
|
&mut self,
|
||||||
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
_location: figures::Point<figures::units::Px>,
|
||||||
_context: &mut EventContext<'_, '_>,
|
_context: &mut EventContext<'_, '_>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
true
|
true
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
//! A widget for laying out multiple widgets in a similar fashion as how words
|
//! A widget for laying out multiple widgets in a similar fashion as how words
|
||||||
//! are wrapped in a paragraph.
|
//! are wrapped in a paragraph.
|
||||||
|
|
||||||
|
use figures::units::{Px, UPx};
|
||||||
|
use figures::{IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero};
|
||||||
use intentional::Cast;
|
use intentional::Cast;
|
||||||
use kludgine::figures::units::{Px, UPx};
|
|
||||||
use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero};
|
|
||||||
|
|
||||||
use crate::context::{AsEventContext, GraphicsContext, LayoutContext};
|
use crate::context::{AsEventContext, GraphicsContext, LayoutContext};
|
||||||
use crate::styles::components::{IntrinsicPadding, LayoutOrder};
|
use crate::styles::components::{IntrinsicPadding, LayoutOrder};
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ use std::sync::{Arc, Mutex, MutexGuard, OnceLock};
|
||||||
use ahash::AHashMap;
|
use ahash::AHashMap;
|
||||||
use alot::LotId;
|
use alot::LotId;
|
||||||
use arboard::Clipboard;
|
use arboard::Clipboard;
|
||||||
|
use figures::units::{Px, UPx};
|
||||||
|
use figures::{IntoSigned, IntoUnsigned, Point, Ranged, Rect, ScreenScale, Size, Zero};
|
||||||
use kludgine::app::winit::dpi::{PhysicalPosition, PhysicalSize};
|
use kludgine::app::winit::dpi::{PhysicalPosition, PhysicalSize};
|
||||||
use kludgine::app::winit::event::{
|
use kludgine::app::winit::event::{
|
||||||
DeviceId, ElementState, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
DeviceId, ElementState, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase,
|
||||||
|
|
@ -19,8 +21,6 @@ use kludgine::app::winit::keyboard::{Key, NamedKey};
|
||||||
use kludgine::app::winit::window;
|
use kludgine::app::winit::window;
|
||||||
use kludgine::app::WindowBehavior as _;
|
use kludgine::app::WindowBehavior as _;
|
||||||
use kludgine::cosmic_text::{fontdb, Family, FamilyOwned};
|
use kludgine::cosmic_text::{fontdb, Family, FamilyOwned};
|
||||||
use kludgine::figures::units::{Px, UPx};
|
|
||||||
use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Ranged, Rect, ScreenScale, Size, Zero};
|
|
||||||
use kludgine::render::Drawing;
|
use kludgine::render::Drawing;
|
||||||
use kludgine::wgpu::CompositeAlphaMode;
|
use kludgine::wgpu::CompositeAlphaMode;
|
||||||
use kludgine::Kludgine;
|
use kludgine::Kludgine;
|
||||||
|
|
@ -1398,8 +1398,8 @@ pub(crate) struct CursorState {
|
||||||
pub(crate) mod sealed {
|
pub(crate) mod sealed {
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
use kludgine::figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use kludgine::figures::Size;
|
use figures::Size;
|
||||||
|
|
||||||
use crate::app::Cushy;
|
use crate::app::Cushy;
|
||||||
use crate::context::InvalidationStatus;
|
use crate::context::InvalidationStatus;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue