Cleaning up figures usage in examples

This commit is contained in:
Jonathan Johnson 2024-07-26 10:34:30 -07:00
parent 530f50e53c
commit 6726855ed0
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
30 changed files with 64 additions and 73 deletions

View file

@ -1,12 +1,12 @@
use std::time::Duration; use std::time::Duration;
use cushy::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn}; use cushy::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn};
use cushy::figures::units::Lp;
use cushy::value::{Destination, Dynamic}; use cushy::value::{Destination, Dynamic};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::widgets::button::ButtonClick; use cushy::widgets::button::ButtonClick;
use cushy::widgets::progress::Progressable; use cushy::widgets::progress::Progressable;
use cushy::{Run, WithClone}; use cushy::{Run, WithClone};
use figures::units::Lp;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let animation = Dynamic::new(AnimationHandle::new()); let animation = Dynamic::new(AnimationHandle::new());

View file

@ -1,6 +1,6 @@
use cushy::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size};
use cushy::widgets::Canvas; use cushy::widgets::Canvas;
use cushy::{Run, Tick}; use cushy::{Run, Tick};
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};

View file

@ -1,11 +1,11 @@
use cushy::figures::units::Lp;
use cushy::figures::Size;
use cushy::styles::Hsla; use cushy::styles::Hsla;
use cushy::value::{Dynamic, Source}; use cushy::value::{Dynamic, Source};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::widgets::color::{HslaPicker, RgbaPicker}; use cushy::widgets::color::{HslaPicker, RgbaPicker};
use cushy::widgets::Space; use cushy::widgets::Space;
use cushy::Run; use cushy::Run;
use figures::units::Lp;
use figures::Size;
use kludgine::Color; use kludgine::Color;
fn main() -> cushy::Result { fn main() -> cushy::Result {

View file

@ -1,3 +1,5 @@
use cushy::figures::units::Lp;
use cushy::figures::{Point, Size, Zero};
use cushy::styles::components::CornerRadius; use cushy::styles::components::CornerRadius;
use cushy::styles::Dimension; use cushy::styles::Dimension;
use cushy::value::{Dynamic, MapEachCloned}; use cushy::value::{Dynamic, MapEachCloned};
@ -5,8 +7,6 @@ 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 figures::units::Lp;
use figures::{Point, Size, Zero};
use kludgine::shapes::CornerRadii; use kludgine::shapes::CornerRadii;
fn main() -> cushy::Result { fn main() -> cushy::Result {

View file

@ -1,10 +1,10 @@
use cushy::figures::units::Lp;
use cushy::figures::{Lp2D, Point};
use cushy::value::{Destination, Dynamic}; use cushy::value::{Destination, Dynamic};
use cushy::widget::{MakeWidget, WidgetInstance}; 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 figures::units::Lp;
use figures::{Point, Zero};
fn main() -> cushy::Result { fn main() -> cushy::Result {
let theme_mode = Dynamic::default(); let theme_mode = Dynamic::default();
@ -59,5 +59,5 @@ fn set_of_containers(repeat: usize, theme_mode: Dynamic<ThemeMode>) -> WidgetIns
} }
fn drop_shadow() -> ContainerShadow<Lp> { fn drop_shadow() -> ContainerShadow<Lp> {
ContainerShadow::new(Point::new(Lp::ZERO, Lp::mm(1))).spread(Lp::mm(1)) ContainerShadow::new(Point::mm(0, 1)).spread(Lp::mm(1))
} }

View file

@ -1,7 +1,7 @@
use cushy::figures::units::Lp;
use cushy::value::{Dynamic, IntoReader}; use cushy::value::{Dynamic, IntoReader};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::Run; use cushy::Run;
use figures::units::Lp;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let counter = Dynamic::new(0i32); let counter = Dynamic::new(0i32);

View file

@ -1,14 +1,14 @@
//! This example shows two approaches to writing custom widgets: implementing //! This example shows two approaches to writing custom widgets: implementing
//! traits or using the [`Custom`] widget with callbacks. //! traits or using the [`Custom`] widget with callbacks.
use cushy::figures::units::{Lp, UPx};
use cushy::figures::{ScreenScale, Size};
use cushy::kludgine::Color;
use cushy::value::{Destination, Dynamic, Source}; use cushy::value::{Destination, Dynamic, Source};
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::window::DeviceId; use cushy::window::DeviceId;
use cushy::Run; use cushy::Run;
use figures::units::{Lp, UPx};
use figures::{ScreenScale, Size};
use kludgine::Color;
fn main() -> cushy::Result { fn main() -> cushy::Result {
"Inline Widgets" "Inline Widgets"

View file

@ -21,33 +21,25 @@ fn runs() {
use std::time::Duration; use std::time::Duration;
use cushy::animation::easings::EaseInOutSine; use cushy::animation::easings::EaseInOutSine;
use figures::units::Px; use cushy::figures::units::Px;
use figures::Point; use cushy::figures::Point;
use kludgine::app::winit::event::MouseButton; use kludgine::app::winit::event::MouseButton;
cushy::example!(disclose, 600, 300) cushy::example!(disclose, 600, 300)
.prepare_with(|r| { .prepare_with(|r| {
r.set_cursor_position(Point::new(Px::new(16), Px::new(64))); r.set_cursor_position(Point::px(16, 64));
r.set_cursor_visible(true); r.set_cursor_visible(true);
}) })
.animated(|r| { .animated(|r| {
r.animate_cursor_to( r.animate_cursor_to(Point::px(30, 30), Duration::from_millis(500), EaseInOutSine)
Point::new(Px::new(30), Px::new(30)), .unwrap();
Duration::from_millis(500),
EaseInOutSine,
)
.unwrap();
r.animate_mouse_button(MouseButton::Left, Duration::from_millis(100)) r.animate_mouse_button(MouseButton::Left, Duration::from_millis(100))
.unwrap(); .unwrap();
r.wait_for(Duration::from_secs(1)).unwrap(); r.wait_for(Duration::from_secs(1)).unwrap();
r.animate_mouse_button(MouseButton::Left, Duration::from_millis(100)) r.animate_mouse_button(MouseButton::Left, Duration::from_millis(100))
.unwrap(); .unwrap();
r.animate_cursor_to( r.animate_cursor_to(Point::px(16, 64), Duration::from_millis(500), EaseInOutSine)
Point::new(Px::new(16), Px::new(64)), .unwrap();
Duration::from_millis(500),
EaseInOutSine,
)
.unwrap();
r.wait_for(Duration::from_secs(1)).unwrap(); r.wait_for(Duration::from_secs(1)).unwrap();
}); });
} }

View file

@ -1,3 +1,4 @@
use cushy::figures::units::Px;
use cushy::fonts::FontCollection; use cushy::fonts::FontCollection;
use cushy::styles::components::{FontFamily, FontWeight, LineHeight, TextSize}; use cushy::styles::components::{FontFamily, FontWeight, LineHeight, TextSize};
use cushy::styles::{Component, DynamicComponent, FamilyOwned, FontFamilyList}; use cushy::styles::{Component, DynamicComponent, FamilyOwned, FontFamilyList};
@ -5,7 +6,6 @@ use cushy::value::{Dynamic, Source};
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 figures::units::Px;
fn main() -> cushy::Result<()> { fn main() -> cushy::Result<()> {
let file_path = Dynamic::<String>::default(); let file_path = Dynamic::<String>::default();

View file

@ -1,12 +1,12 @@
use std::process::exit; use std::process::exit;
use cushy::figures::units::Lp;
use cushy::value::{Dynamic, MapEach, Source}; use cushy::value::{Dynamic, MapEach, Source};
use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag}; use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
use cushy::widgets::grid::{Grid, GridDimension, GridWidgets}; 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 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

View file

@ -1,10 +1,10 @@
use cushy::figures::units::Lp;
use cushy::value::{Dynamic, Source}; use cushy::value::{Dynamic, Source};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::widgets::input::InputValue; 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 figures::units::Lp;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let allow_blur = Dynamic::new(true); let allow_blur = Dynamic::new(true);

View file

@ -1,11 +1,11 @@
use cushy::animation::ZeroToOne; use cushy::animation::ZeroToOne;
use cushy::figures::Size;
use cushy::value::{Dynamic, MapEachCloned, Source}; use cushy::value::{Dynamic, MapEachCloned, Source};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::widgets::image::{Aspect, ImageScaling}; 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 figures::Size;
use kludgine::include_texture; use kludgine::include_texture;
fn main() -> cushy::Result { fn main() -> cushy::Result {

View file

@ -1,8 +1,8 @@
use cushy::figures::units::Px;
use cushy::value::Dynamic; 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 figures::units::Px;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let contents = Dynamic::from("Hello World"); let contents = Dynamic::from("Hello World");

View file

@ -1,12 +1,12 @@
use std::process::exit; use std::process::exit;
use cushy::figures::units::Lp;
use cushy::value::{Dynamic, Source, Validations}; use cushy::value::{Dynamic, Source, Validations};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::widgets::input::{InputValue, MaskedString}; 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 figures::units::Lp;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let tooltips = OverlayLayer::default(); let tooltips = OverlayLayer::default();

View file

@ -62,19 +62,19 @@ fn runs() {
use std::time::Duration; use std::time::Duration;
use cushy::animation::easings::{EaseInCircular, EaseInOutSine, EaseOutCircular}; use cushy::animation::easings::{EaseInCircular, EaseInOutSine, EaseOutCircular};
use figures::units::Px; use cushy::figures::units::Px;
use figures::Point; use cushy::figures::Point;
use kludgine::app::winit::event::MouseButton; use kludgine::app::winit::event::MouseButton;
cushy::example!(menu_example, 800, 600) cushy::example!(menu_example, 800, 600)
.prepare_with(|r| { .prepare_with(|r| {
r.set_cursor_position(Point::new(Px::new(420), Px::new(270))); r.set_cursor_position(Point::px(420, 270));
r.set_cursor_visible(true); r.set_cursor_visible(true);
r.refresh().unwrap(); r.refresh().unwrap();
}) })
.animated(|r| { .animated(|r| {
r.animate_cursor_to( r.animate_cursor_to(
Point::new(Px::new(410), Px::new(300)), Point::px(410, 300),
Duration::from_millis(500), Duration::from_millis(500),
EaseInOutSine, EaseInOutSine,
) )
@ -83,26 +83,26 @@ fn runs() {
.unwrap(); .unwrap();
r.wait_for(Duration::from_millis(500)).unwrap(); r.wait_for(Duration::from_millis(500)).unwrap();
r.animate_cursor_to( r.animate_cursor_to(
Point::new(Px::new(430), Px::new(325)), Point::px(430, 325),
Duration::from_millis(200), Duration::from_millis(200),
EaseInCircular, EaseInCircular,
) )
.unwrap(); .unwrap();
r.animate_cursor_to( r.animate_cursor_to(
Point::new(Px::new(480), Px::new(480)), Point::px(480, 480),
Duration::from_millis(400), Duration::from_millis(400),
EaseOutCircular, EaseOutCircular,
) )
.unwrap(); .unwrap();
r.wait_for(Duration::from_millis(300)).unwrap(); r.wait_for(Duration::from_millis(300)).unwrap();
r.animate_cursor_to( r.animate_cursor_to(
Point::new(Px::new(620), Px::new(460)), Point::px(620, 460),
Duration::from_millis(600), Duration::from_millis(600),
EaseInOutSine, EaseInOutSine,
) )
.unwrap(); .unwrap();
r.animate_cursor_to( r.animate_cursor_to(
Point::new(Px::new(460), Px::new(340)), Point::px(460, 340),
Duration::from_millis(800), Duration::from_millis(800),
EaseInOutSine, EaseInOutSine,
) )
@ -111,7 +111,7 @@ fn runs() {
.unwrap(); .unwrap();
r.wait_for(Duration::from_millis(500)).unwrap(); r.wait_for(Duration::from_millis(500)).unwrap();
r.animate_cursor_to( r.animate_cursor_to(
Point::new(Px::new(420), Px::new(270)), Point::px(420, 270),
Duration::from_millis(500), Duration::from_millis(500),
EaseInOutSine, EaseInOutSine,
) )

View file

@ -1,8 +1,8 @@
use cushy::figures::units::Lp;
use cushy::styles::components::FontFamily; 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;
fn main() -> cushy::Result { fn main() -> cushy::Result {

View file

@ -1,10 +1,9 @@
use std::time::Duration; use std::time::Duration;
use cushy::animation::easings::EaseInOutSine; use cushy::animation::easings::EaseInOutSine;
use cushy::figures::{Point, Px2D, Size};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::window::VirtualRecorderError; use cushy::window::VirtualRecorderError;
use figures::units::Px;
use figures::{Point, Size};
#[macro_use] #[macro_use]
mod shared; mod shared;
@ -15,13 +14,13 @@ fn ui() -> impl MakeWidget {
fn main() -> Result<(), VirtualRecorderError> { fn main() -> Result<(), VirtualRecorderError> {
let mut recorder = ui().build_recorder().size(Size::new(320, 240)).finish()?; let mut recorder = ui().build_recorder().size(Size::new(320, 240)).finish()?;
let initial_point = Point::new(Px::new(140), Px::new(150)); let initial_point = Point::px(140, 150);
recorder.set_cursor_position(initial_point); recorder.set_cursor_position(initial_point);
recorder.set_cursor_visible(true); recorder.set_cursor_visible(true);
recorder.refresh()?; recorder.refresh()?;
let mut animation = recorder.record_animated_png(60); let mut animation = recorder.record_animated_png(60);
animation.animate_cursor_to( animation.animate_cursor_to(
Point::new(Px::new(160), Px::new(120)), Point::px(160, 120),
Duration::from_millis(250), Duration::from_millis(250),
EaseInOutSine, EaseInOutSine,
)?; )?;

View file

@ -1,6 +1,6 @@
use cushy::figures::Size;
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::window::VirtualRecorderError; use cushy::window::VirtualRecorderError;
use figures::Size;
#[macro_use] #[macro_use]
mod shared; mod shared;

View file

@ -1,9 +1,9 @@
use cushy::figures::units::Lp;
use cushy::figures::{Lp2D, Point};
use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag}; use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
use cushy::widgets::container::ContainerShadow; use cushy::widgets::container::ContainerShadow;
use cushy::widgets::layers::{OverlayBuilder, OverlayLayer, Overlayable}; use cushy::widgets::layers::{OverlayBuilder, OverlayLayer, Overlayable};
use cushy::Run; use cushy::Run;
use figures::units::Lp;
use figures::{Point, Zero};
use kludgine::app::winit::event::MouseButton; use kludgine::app::winit::event::MouseButton;
use kludgine::Color; use kludgine::Color;
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
@ -41,7 +41,7 @@ fn test_widget(overlay: &OverlayLayer, is_root: bool) -> impl MakeWidget {
255, 255,
)) ))
.shadow( .shadow(
ContainerShadow::new(Point::new(Lp::ZERO, Lp::mm(2))) ContainerShadow::new(Point::mm(0, 2))
.blur_radius(Lp::mm(1)) .blur_radius(Lp::mm(1))
.spread(Lp::mm(1)), .spread(Lp::mm(1)),
); );

View file

@ -1,10 +1,10 @@
use cushy::figures::units::Lp;
use cushy::figures::Size;
use cushy::value::{Dynamic, MapEach}; use cushy::value::{Dynamic, MapEach};
use cushy::widget::MakeWidget; 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 figures::units::Lp;
use figures::Size;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let indeterminant = Dynamic::new(false); let indeterminant = Dynamic::new(false);

View file

@ -1,12 +1,12 @@
use cushy::animation::{LinearInterpolate, PercentBetween}; use cushy::animation::{LinearInterpolate, PercentBetween};
use cushy::figures::units::Lp;
use cushy::figures::Ranged;
use cushy::value::{Destination, Dynamic, ForEach, IntoReader, Source}; use cushy::value::{Destination, Dynamic, ForEach, IntoReader, Source};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::widgets::checkbox::Checkable; 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 figures::units::Lp;
use figures::Ranged;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let enabled = Dynamic::new(true); let enabled = Dynamic::new(true);

View file

@ -1,10 +1,10 @@
use cushy::figures::units::Lp;
use cushy::kludgine::Color;
use cushy::styles::components::{TextColor, TextSize}; use cushy::styles::components::{TextColor, TextSize};
use cushy::widget::MakeWidget; 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 figures::units::Lp;
use kludgine::Color;
fn main() -> cushy::Result { fn main() -> cushy::Result {
Stack::rows("Green".and(red_text("Red"))) Stack::rows("Green".and(red_text("Red")))

View file

@ -1,5 +1,7 @@
use std::fmt::Write; use std::fmt::Write;
use cushy::figures::units::Lp;
use cushy::kludgine::Color;
use cushy::styles::components::{TextColor, TextSize, WidgetBackground}; use cushy::styles::components::{TextColor, TextSize, WidgetBackground};
use cushy::styles::{ use cushy::styles::{
ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, Dimension, FixedTheme, SurfaceTheme, ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, Dimension, FixedTheme, SurfaceTheme,
@ -14,8 +16,6 @@ use cushy::widgets::slider::Slidable;
use cushy::widgets::Space; use cushy::widgets::Space;
use cushy::window::ThemeMode; use cushy::window::ThemeMode;
use cushy::{Cushy, Open, PendingApp}; use cushy::{Cushy, Open, PendingApp};
use figures::units::Lp;
use kludgine::Color;
use palette::OklabHue; use palette::OklabHue;
fn main() -> cushy::Result { fn main() -> cushy::Result {

View file

@ -3,11 +3,11 @@ use std::iter;
use std::ops::Not; use std::ops::Not;
use std::time::SystemTime; use std::time::SystemTime;
use cushy::figures::units::Lp;
use cushy::value::{Destination, Dynamic, Source}; use cushy::value::{Destination, Dynamic, Source};
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 figures::units::Lp;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let app = Dynamic::default(); let app = Dynamic::default();

View file

@ -3,21 +3,21 @@ use std::cmp::Ordering;
use std::time::Duration; use std::time::Duration;
use cushy::figures::units::Px; use cushy::figures::units::Px;
use cushy::figures::FloatConversion;
use cushy::figures::{Point, Rect, Size}; use cushy::figures::{Point, Rect, Size};
use cushy::kludgine::app::winit::keyboard::Key; use cushy::kludgine::app::winit::keyboard::Key;
use cushy::kludgine::app::winit::keyboard::NamedKey;
use cushy::kludgine::drawing::Renderer; use cushy::kludgine::drawing::Renderer;
use cushy::kludgine::shapes::Shape; use cushy::kludgine::shapes::Shape;
use cushy::kludgine::sprite::{Sprite, SpriteSource};
use cushy::kludgine::tilemap::{ use cushy::kludgine::tilemap::{
DebugGrid, Object, ObjectLayer, TileArray, TileKind, TileMapFocus, TILE_SIZE, DebugGrid, Object, ObjectLayer, TileArray, TileKind, TileMapFocus, TILE_SIZE,
}; };
use cushy::kludgine::Color; use cushy::kludgine::Color;
use cushy::kludgine::{include_aseprite_sprite, DrawableExt};
use cushy::value::{Destination, Dynamic}; use cushy::value::{Destination, 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::sprite::{Sprite, SpriteSource};
use kludgine::{include_aseprite_sprite, DrawableExt};
const PLAYER_SIZE: Px = Px::new(16); const PLAYER_SIZE: Px = Px::new(16);

View file

@ -1,8 +1,8 @@
use cushy::figures::units::Lp;
use cushy::value::{Destination, Dynamic, Validations}; use cushy::value::{Destination, 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 figures::units::Lp;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let text = Dynamic::default(); let text = Dynamic::default();

View file

@ -1,7 +1,7 @@
use cushy::figures::Size;
use cushy::value::{Dynamic, Source}; use cushy::value::{Dynamic, Source};
use cushy::widget::{MakeWidget, WidgetInstance}; use cushy::widget::{MakeWidget, WidgetInstance};
use cushy::Run; use cushy::Run;
use figures::Size;
fn main() -> cushy::Result { fn main() -> cushy::Result {
let focused = Dynamic::new(false); let focused = Dynamic::new(false);

View file

@ -1,8 +1,8 @@
use cushy::figures::Fraction;
use cushy::value::{Dynamic, Source}; use cushy::value::{Dynamic, Source};
use cushy::widget::MakeWidget; use cushy::widget::MakeWidget;
use cushy::widgets::slider::Slidable; use cushy::widgets::slider::Slidable;
use cushy::Run; use cushy::Run;
use figures::Fraction;
fn main() -> cushy::Result<()> { fn main() -> cushy::Result<()> {
let zoom = Dynamic::new(Fraction::ONE); let zoom = Dynamic::new(Fraction::ONE);

View file

@ -1,9 +1,9 @@
use cushy::figures::units::Lp;
use cushy::styles::components::{LineHeight, TextSize}; use cushy::styles::components::{LineHeight, TextSize};
use cushy::value::Dynamic; use cushy::value::Dynamic;
use cushy::widget::{MakeWidget, WidgetList}; use cushy::widget::{MakeWidget, WidgetList};
use cushy::widgets::wrap::{VerticalAlign, WrapAlign}; use cushy::widgets::wrap::{VerticalAlign, WrapAlign};
use cushy::Run; use cushy::Run;
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.";

View file

@ -19,7 +19,7 @@ use alot::LotId;
use arboard::Clipboard; use arboard::Clipboard;
use figures::units::{Px, UPx}; use figures::units::{Px, UPx};
use figures::{ use figures::{
Fraction, IntoSigned, IntoUnsigned, Point, Ranged, Rect, Round, ScreenScale, Size, Zero, Fraction, IntoSigned, IntoUnsigned, Point, Ranged, Rect, Round, ScreenScale, Size, UPx2D, Zero,
}; };
use image::{DynamicImage, RgbImage, RgbaImage}; use image::{DynamicImage, RgbImage, RgbaImage};
use intentional::{Assert, Cast}; use intentional::{Assert, Cast};
@ -2471,7 +2471,7 @@ impl VirtualState {
modifiers: Modifiers::default(), modifiers: Modifiers::default(),
elapsed: Duration::ZERO, elapsed: Duration::ZERO,
cursor: Cursor::default(), cursor: Cursor::default(),
size: Size::new(UPx::new(800), UPx::new(600)), size: Size::upx(800, 600),
} }
} }
} }
@ -2587,7 +2587,7 @@ impl StandaloneWindowBuilder {
Self { Self {
widget: contents.make_widget(), widget: contents.make_widget(),
multisample_count: NonZeroU32::new(4).assert("not 0"), multisample_count: NonZeroU32::new(4).assert("not 0"),
initial_size: Size::new(UPx::new(800), UPx::new(600)), initial_size: Size::upx(800, 600),
scale: 1., scale: 1.,
zoom: Dynamic::new(Fraction::ONE), zoom: Dynamic::new(Fraction::ONE),
transparent: false, transparent: false,
@ -3206,7 +3206,7 @@ impl VirtualRecorderBuilder<Rgb8> {
pub fn new(contents: impl MakeWidget) -> Self { pub fn new(contents: impl MakeWidget) -> Self {
Self { Self {
contents: contents.make_widget(), contents: contents.make_widget(),
size: Size::new(UPx::new(800), UPx::new(600)), size: Size::upx(800, 600),
scale: 1.0, scale: 1.0,
format: PhantomData, format: PhantomData,
resize_to_fit: false, resize_to_fit: false,