-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues.
Is this issue related to iced?
- My hardware is compatible and my graphics drivers are up-to-date.
What happened?
I have wrote the following file
use iced::{
canvas::{Cache, Cursor, Geometry, Path},
executor, time,
widget::canvas::{
event::{self, Event},
Program,
},
Application, Color, Command, Element, Point, Rectangle, Settings, Subscription, Canvas,
};
struct Example;
#[derive(Debug)]
enum Message {}
#[derive(Debug)]
struct ProgramCanvas {
cache: Cache,
}
impl Application for Example {
type Executor = executor::Default;
type Message = Message;
type Flags = bool;
fn new(_flags: Self::Flags) -> (Example, Command<Self::Message>) {
(Example, Command::none())
}
fn title(&self) -> String {
String::from("Title")
}
fn update(&mut self ,_: Self::Message) -> Command<Self::Message> {
Command::none()
}
fn view(&mut self) -> Element<Self::Message> {
use iced::{Container, Length};
Canvas::new(ProgramCanvas::new())
.width(Length::Fill)
.height(Length::Fill)
.into()
}
}
impl ProgramCanvas {
fn new() -> Self {
Self {
cache: Cache::new(),
}
}
}
impl Program<Message> for ProgramCanvas {
fn draw(&self, bounds: Rectangle, _cursor: Cursor) -> Vec<Geometry> {
let chip_view = self.cache.draw(bounds.size(), |frame| {
let space = Path::rectangle(Point::ORIGIN, frame.size());
frame.fill(&space, Color::BLACK);
log::info!("DRAWING");
frame.translate(frame.center() - Point::ORIGIN);
});
vec![chip_view]
}
}
pub fn main() -> iced::Result {
Example::run(Settings {
id: Some(String::from("Some")),
window: iced::window::Settings {
size: (64 * 15, 32 * 15),
min_size: Some((64 * 15, 32 * 15)),
max_size: Some((64 * 15, 32 * 15)),
resizable: false,
..iced::window::Settings::default()
},
flags: false,
default_font: None,
default_text_size: 20,
text_multithreading: false,
antialiasing: true,
exit_on_close_request: true,
try_opengles_first: false,
})
}with the following Cargo.toml
[package]
name = "example"
version = "0.1.0"
edition = "2021"
[dependencies]
rand = "0.8.4"
iced = { version = "~0.4" , features = ["canvas", "tokio"] }
iced_native = "~0.4"
rodio = "0.15.0"
log = "0.4.16"
env_logger = "0.9.0"
builder-pattern = "0.4.2"
byteorder = "1.4.3"And I am only getting a white screen.
What is the expected behavior?
A black screen
Version
master
Operative System
Linux
Do you have any log output?
No response