architect

This commit is contained in:
cel 🌸 2023-01-12 17:29:00 +00:00
parent 871712388b
commit f9ff1ab85c
Signed by: cel
GPG Key ID: 48E29AF13B5F1349
1 changed files with 108 additions and 2 deletions

View File

@ -1,3 +1,109 @@
fn main() {
println!("hello, world");
use iced::{Sandbox, Settings};
struct Cowmic {
view: View,
templates: Vec<Template>,
dirty: bool,
saving: bool,
}
enum View {
Library,
Generate(GenerateState),
Edit(EditState),
}
struct GenerateState {}
struct EditState {}
impl Sandbox for Cowmic {
type Message = Message;
fn new() -> Self {
// TODO: load templates from XDG Directory
// this is temporary to show menu
let templates = vec![
Template::new(
Some(Box::new(
include_bytes!("../../cowgen/tests/assets/mariah.jpg").to_vec(),
)),
vec![],
"cow".to_string(),
),
Template::new(
Some(Box::new(
include_bytes!("../../cowgen/tests/assets/mariah.jpg").to_vec(),
)),
vec![],
"cow".to_string(),
),
Template::new(
Some(Box::new(
include_bytes!("../../cowgen/tests/assets/mariah.jpg").to_vec(),
)),
vec![],
"cow".to_string(),
),
];
Self {
view: View::Library,
templates,
dirty: false,
saving: false,
}
}
fn title(&self) -> String {
"Cowmic".to_string()
}
fn update(&mut self, message: Self::Message) {
todo!()
}
fn view(&self) -> iced::Element<'_, Self::Message> {
todo!()
}
}
struct Template {
base: Option<Box<Vec<u8>>>,
elements: Vec<Element>,
name: String,
}
impl Template {
fn new(base: Option<Box<Vec<u8>>>, elements: Vec<Element>, name: String) -> Self {
Self {
base,
elements,
name,
}
}
fn is_filled() -> bool {
todo!()
}
}
struct Element {
position: (i32, i32),
dimensions: (i32, i32),
kind: MediaKind,
}
enum MediaKind {
Text,
Image,
}
#[derive(Debug, Clone, Copy)]
enum Message {}
fn main() -> iced::Result {
Cowmic::run(Settings {
antialiasing: true,
..Settings::default()
})
}