mirror of
https://github.com/danbulant/cushy
synced 2026-06-19 06:21:15 +00:00
Fixing example references to dependencies
Ensuring all examples use public paths to make copy/paste more likely to be successful.
This commit is contained in:
parent
6c656f2af2
commit
ab474e2b7d
15 changed files with 37 additions and 32 deletions
|
|
@ -16,11 +16,11 @@
|
|||
//! ┃ ┃ ┣ clicked_button Label
|
||||
//! ```
|
||||
|
||||
use cushy::styles::Color;
|
||||
use cushy::value::{Destination, Dynamic};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::button::{ButtonHoverBackground, ButtonHoverForeground};
|
||||
use cushy::Run;
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
let clicked_button = Dynamic::<&'static str>::default();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use cushy::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size};
|
||||
use cushy::kludgine::shapes::Shape;
|
||||
use cushy::kludgine::text::{Text, TextOrigin};
|
||||
use cushy::kludgine::{Color, DrawableExt};
|
||||
use cushy::widgets::Canvas;
|
||||
use cushy::{Run, Tick};
|
||||
use kludgine::shapes::Shape;
|
||||
use kludgine::text::{Text, TextOrigin};
|
||||
use kludgine::{Color, DrawableExt};
|
||||
|
||||
fn main() -> cushy::Result<()> {
|
||||
let mut angle = Angle::degrees(0);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
use cushy::figures::units::Lp;
|
||||
use cushy::figures::Size;
|
||||
use cushy::styles::Hsla;
|
||||
use cushy::styles::{Color, Hsla};
|
||||
use cushy::value::{Dynamic, Source};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::color::{HslaPicker, RgbaPicker};
|
||||
use cushy::widgets::Space;
|
||||
use cushy::Run;
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
let color = Dynamic::new(Color::RED);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
use cushy::figures::units::Lp;
|
||||
use cushy::figures::{Point, Size, Zero};
|
||||
use cushy::styles::components::CornerRadius;
|
||||
use cushy::styles::Dimension;
|
||||
use cushy::styles::{CornerRadii, Dimension};
|
||||
use cushy::value::{Dynamic, MapEachCloned};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::container::ContainerShadow;
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::Run;
|
||||
use kludgine::shapes::CornerRadii;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
let top_left = Dynamic::new(Lp::mm(1));
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use cushy::kludgine::app::winit::window::CursorIcon;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::widgets::Custom;
|
||||
use cushy::Run;
|
||||
use kludgine::app::winit::window::CursorIcon;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
Custom::new(
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use cushy::animation::easings::StandardEasing;
|
||||
use cushy::context::GraphicsContext;
|
||||
use cushy::kludgine::shapes::{PathBuilder, Shape, StrokeOptions};
|
||||
use cushy::widget::{MakeWidget, WidgetList};
|
||||
use cushy::widgets::Canvas;
|
||||
use cushy::Run;
|
||||
use easing_function::Easing;
|
||||
use figures::units::{Lp, Px};
|
||||
use figures::{IntoSigned, Point, Rect, Size, Zero};
|
||||
use kludgine::shapes::{PathBuilder, Shape, StrokeOptions};
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
StandardEasing::all()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use cushy::kludgine::app::winit::event::ElementState;
|
||||
use cushy::kludgine::app::winit::keyboard::{Key, NamedKey};
|
||||
use cushy::kludgine::Color;
|
||||
use cushy::value::{Destination, Dynamic};
|
||||
use cushy::widget::{MakeWidget, HANDLED, IGNORED};
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::Run;
|
||||
use kludgine::app::winit::event::ElementState;
|
||||
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
let chat_log = Dynamic::new("Chat log goes here.\n".repeat(100));
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ use std::collections::HashMap;
|
|||
|
||||
use cushy::animation::ZeroToOne;
|
||||
use cushy::figures::Size;
|
||||
use cushy::kludgine::include_texture;
|
||||
use cushy::kludgine::wgpu::FilterMode;
|
||||
use cushy::value::{Dynamic, MapEachCloned, Source, Switchable};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::image::{Aspect, ImageScaling};
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::widgets::Image;
|
||||
use cushy::Run;
|
||||
use kludgine::include_texture;
|
||||
use kludgine::wgpu::FilterMode;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
let mode = Dynamic::<ScalingMode>::default();
|
||||
|
|
@ -35,12 +35,22 @@ fn main() -> cushy::Result {
|
|||
.contain()
|
||||
.collapse_vertically(hide_scale_editor);
|
||||
|
||||
let image_nearest = Image::new(include_texture!("assets/ferris-happy.png", FilterMode::Nearest).expect("valid image"));
|
||||
let image_linear = Image::new(include_texture!("assets/ferris-happy.png", FilterMode::Linear).expect("valid image"));
|
||||
let image_nearest = Image::new(
|
||||
include_texture!("assets/ferris-happy.png", FilterMode::Nearest).expect("valid image"),
|
||||
);
|
||||
let image_linear = Image::new(
|
||||
include_texture!("assets/ferris-happy.png", FilterMode::Linear).expect("valid image"),
|
||||
);
|
||||
let mut images = HashMap::new();
|
||||
|
||||
images.insert(FilterMode::Nearest, image_nearest.scaling(image_scaling.clone()).make_widget());
|
||||
images.insert(FilterMode::Linear, image_linear.scaling(image_scaling).make_widget());
|
||||
images.insert(
|
||||
FilterMode::Nearest,
|
||||
image_nearest.scaling(image_scaling.clone()).make_widget(),
|
||||
);
|
||||
images.insert(
|
||||
FilterMode::Linear,
|
||||
image_linear.scaling(image_scaling).make_widget(),
|
||||
);
|
||||
|
||||
let selected_filter = Dynamic::new(FilterMode::Nearest);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use cushy::styles::Color;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::Space;
|
||||
use cushy::Run;
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
Space::colored(Color::RED)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use cushy::kludgine::app::{Monitor, Monitors};
|
||||
use cushy::widget::{MakeWidget, WidgetInstance, WidgetList};
|
||||
use cushy::{Application, Open, PendingApp};
|
||||
use kludgine::app::{Monitor, Monitors};
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
// Monitor information is only available through winit after the application
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
use cushy::kludgine::include_texture;
|
||||
use cushy::kludgine::{include_texture, LazyTexture};
|
||||
use cushy::value::{Destination, Dynamic, MapEach};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::Image;
|
||||
use cushy::window::PendingWindow;
|
||||
use cushy::{Application, Open, PendingApp, Run};
|
||||
use kludgine::LazyTexture;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
// To open multiple applications, we need a handle to the application. This
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use cushy::figures::units::Lp;
|
||||
use cushy::kludgine::cosmic_text::FamilyOwned;
|
||||
use cushy::styles::components::FontFamily;
|
||||
use cushy::styles::FontFamilyList;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
use kludgine::cosmic_text::FamilyOwned;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
include_str!("./nested-scroll.rs")
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use cushy::figures::units::Lp;
|
||||
use cushy::figures::{Lp2D, Point};
|
||||
use cushy::kludgine::app::winit::event::MouseButton;
|
||||
use cushy::kludgine::Color;
|
||||
use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||
use cushy::widgets::container::ContainerShadow;
|
||||
use cushy::widgets::layers::{OverlayBuilder, OverlayLayer, Overlayable};
|
||||
use cushy::Run;
|
||||
use kludgine::app::winit::event::MouseButton;
|
||||
use kludgine::Color;
|
||||
use rand::{thread_rng, Rng};
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use cushy::figures::units::Lp;
|
|||
use cushy::kludgine::Color;
|
||||
use cushy::styles::components::{TextColor, TextSize, WidgetBackground};
|
||||
use cushy::styles::{
|
||||
ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, Dimension, FixedTheme, SurfaceTheme,
|
||||
Theme, ThemePair,
|
||||
ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, Dimension, FixedTheme, OklabHue,
|
||||
SurfaceTheme, Theme, ThemePair,
|
||||
};
|
||||
use cushy::value::{Destination, Dynamic, MapEachCloned, Source};
|
||||
use cushy::widget::MakeWidget;
|
||||
|
|
@ -16,7 +16,6 @@ use cushy::widgets::slider::Slidable;
|
|||
use cushy::widgets::Space;
|
||||
use cushy::window::ThemeMode;
|
||||
use cushy::{Cushy, Open, PendingApp};
|
||||
use palette::OklabHue;
|
||||
|
||||
fn main() -> cushy::Result {
|
||||
let app = PendingApp::default();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use cushy::figures::Size;
|
||||
use cushy::figures::units::{Px, UPx};
|
||||
use cushy::figures::{IntoSigned, Point, Px2D, Size, UPx2D};
|
||||
use cushy::value::{Destination, Dynamic, Source};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::{App, Open};
|
||||
use figures::units::{Px, UPx};
|
||||
use figures::{IntoSigned, Point, Px2D, UPx2D};
|
||||
|
||||
#[cushy::main]
|
||||
fn main(app: &mut App) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue