Draft Emulator in iced_test

This commit is contained in:
Héctor Ramón Jiménez 2025-05-31 04:34:54 +02:00
parent 921467b5be
commit 16556b51bc
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
12 changed files with 466 additions and 47 deletions

View file

@ -4,10 +4,11 @@ pub use iced_runtime as runtime;
pub use iced_runtime::core;
pub use iced_runtime::futures;
use crate::core::renderer;
use crate::core::text;
use crate::core::theme;
use crate::core::window;
use crate::core::{Element, Font};
use crate::core::{Element, Font, Settings};
use crate::futures::{Executor, Subscription};
use crate::graphics::compositor;
use crate::runtime::Task;
@ -36,6 +37,8 @@ pub trait Program: Sized {
/// Returns the unique name of the [`Program`].
fn name() -> &'static str;
fn settings(&self) -> Settings;
fn boot(&self) -> (Self::State, Task<Self::Message>);
fn update(
@ -128,6 +131,10 @@ pub fn with_title<P: Program>(
P::name()
}
fn settings(&self) -> Settings {
self.program.settings()
}
fn boot(&self) -> (Self::State, Task<Self::Message>) {
self.program.boot()
}
@ -210,6 +217,10 @@ pub fn with_subscription<P: Program>(
P::name()
}
fn settings(&self) -> Settings {
self.program.settings()
}
fn boot(&self) -> (Self::State, Task<Self::Message>) {
self.program.boot()
}
@ -293,6 +304,10 @@ pub fn with_theme<P: Program>(
P::name()
}
fn settings(&self) -> Settings {
self.program.settings()
}
fn boot(&self) -> (Self::State, Task<Self::Message>) {
self.program.boot()
}
@ -372,6 +387,10 @@ pub fn with_style<P: Program>(
P::name()
}
fn settings(&self) -> Settings {
self.program.settings()
}
fn boot(&self) -> (Self::State, Task<Self::Message>) {
self.program.boot()
}
@ -447,6 +466,10 @@ pub fn with_scale_factor<P: Program>(
P::name()
}
fn settings(&self) -> Settings {
self.program.settings()
}
fn boot(&self) -> (Self::State, Task<Self::Message>) {
self.program.boot()
}
@ -530,6 +553,10 @@ pub fn with_executor<P: Program, E: Executor>(
P::name()
}
fn settings(&self) -> Settings {
self.program.settings()
}
fn boot(&self) -> (Self::State, Task<Self::Message>) {
self.program.boot()
}
@ -585,10 +612,15 @@ pub fn with_executor<P: Program, E: Executor>(
}
/// The renderer of some [`Program`].
pub trait Renderer: text::Renderer<Font = Font> + compositor::Default {}
pub trait Renderer:
text::Renderer<Font = Font> + compositor::Default + renderer::Headless
{
}
impl<T> Renderer for T where T: text::Renderer<Font = Font> + compositor::Default
{}
impl<T> Renderer for T where
T: text::Renderer<Font = Font> + compositor::Default + renderer::Headless
{
}
/// A particular instance of a running [`Program`].
#[allow(missing_debug_implementations)]