Initial commit: basic music player structure and license
This commit is contained in:
parent
20f555de52
commit
431bd3b23f
4 changed files with 4174 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/target
|
||||||
4118
Cargo.lock
generated
Normal file
4118
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "mporn"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
iced = {version= "0.14.0", feature= ["wayland"]}
|
||||||
48
src/main.rs
Normal file
48
src/main.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
use iced::{Element, Task, Theme, window, Length};
|
||||||
|
use iced::widget::{text, button, column, row};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct State{
|
||||||
|
title: String,
|
||||||
|
}
|
||||||
|
impl State {
|
||||||
|
fn update(_state: &mut State, message: Message) -> Task<Message>{
|
||||||
|
match message {
|
||||||
|
Message::Exit => window::latest().and_then(window::close),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn view(_state: &State) -> Element<Message>{
|
||||||
|
column![
|
||||||
|
row![
|
||||||
|
text("Music Player on Rust Nya").size(38).width(Length::Fill),
|
||||||
|
button(text("Exit").size(30)).on_press(Message::Exit)
|
||||||
|
],
|
||||||
|
].into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Default for State {
|
||||||
|
fn default() -> Self{
|
||||||
|
Self{
|
||||||
|
title: String::from("Mporn"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
enum Message{
|
||||||
|
Exit,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> iced::Result {
|
||||||
|
iced::application(||{
|
||||||
|
(
|
||||||
|
State{title: String::from("Mporn")},
|
||||||
|
Task::none()
|
||||||
|
)
|
||||||
|
},
|
||||||
|
State::update,
|
||||||
|
State::view)
|
||||||
|
.theme(|_s: &State| iced::Theme::KanagawaDragon)
|
||||||
|
.run()
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue