mirror of
https://github.com/danbulant/cushy
synced 2026-05-25 04:42:34 +00:00
35 lines
1,004 B
Rust
35 lines
1,004 B
Rust
use gooey::widgets::Canvas;
|
|
use gooey::Run;
|
|
use kludgine::figures::units::Px;
|
|
use kludgine::figures::{Angle, IntoSigned, Point, Rect, Size};
|
|
use kludgine::shapes::Shape;
|
|
use kludgine::Color;
|
|
|
|
fn main() -> gooey::Result<()> {
|
|
let mut angle = Angle::degrees(0);
|
|
Canvas::new(move |context| {
|
|
angle += Angle::degrees(1);
|
|
|
|
let center = Point::from(context.graphics.size()).into_signed() / 2;
|
|
context.graphics.draw_text(
|
|
"Canvas exposes the full power of Kludgine",
|
|
Color::WHITE,
|
|
kludgine::text::TextOrigin::Center,
|
|
center - Point::new(Px(0), Px(100)),
|
|
None,
|
|
None,
|
|
None,
|
|
);
|
|
context.graphics.draw_shape(
|
|
&Shape::filled_rect(
|
|
Rect::new(Point::new(Px(-50), Px(-50)), Size::new(Px(100), Px(100))),
|
|
Color::RED,
|
|
),
|
|
center,
|
|
Some(angle),
|
|
None,
|
|
)
|
|
})
|
|
.target_fps(60)
|
|
.run()
|
|
}
|