From 27ec46ad8ab12e18139ca6adb403274d585e4814 Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Mon, 27 Sep 2021 21:14:59 +0200 Subject: [PATCH] Add fltk for UI --- Cargo.lock | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 4 +++- src/main.rs | 9 +++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 70ffdac..658f43c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,6 +113,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cmake" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb6210b637171dfba4cda12e579ac6dc73f5165ad56133e5d72ef3131f320855" +dependencies = [ + "cc", +] + [[package]] name = "config" version = "0.11.0" @@ -185,6 +194,37 @@ dependencies = [ "synstructure", ] +[[package]] +name = "fltk" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd19f0144a75a2a1b282c626069a0dd91fdb97779a9638e9658ef6f9cfca284f" +dependencies = [ + "bitflags", + "fltk-derive", + "fltk-sys", + "raw-window-handle", +] + +[[package]] +name = "fltk-derive" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "517c3b4815e56f38981c7cf0d58082b8e87501f245c459dada9aa09edf5bbdc6" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "fltk-sys" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8e949c024948f1529c92e10a6389cdafeda82d2ba526ef71a0a087234f0db03" +dependencies = [ + "cmake", +] + [[package]] name = "fnv" version = "1.0.7" @@ -804,6 +844,15 @@ dependencies = [ "rand_core", ] +[[package]] +name = "raw-window-handle" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" +dependencies = [ + "libc", +] + [[package]] name = "redox_syscall" version = "0.2.10" @@ -1035,6 +1084,7 @@ version = "0.2.0" dependencies = [ "config", "failure", + "fltk", "reqwest", "serde 1.0.130", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 962a76f..deac21d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,6 @@ serde_json = "1.0.68" tokio = { version = "1.11.0", features = ["full"] } reqwest = { version = "0.11.4", features = ["default"] } config = "0.11.0" -failure = "0.1.8" \ No newline at end of file +failure = "0.1.8" +#https://fltk-rs.github.io/fltk-rs/ +fltk = { version = "^1.2", features = ["fltk-bundled"] } diff --git a/src/main.rs b/src/main.rs index c9ee975..5e42fa1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,8 @@ mod platform; mod settings; mod steam; mod steamgriddb; +use fltk::{app, prelude::*, window::Window}; + use crate::{ egs::EpicPlatform, @@ -19,6 +21,13 @@ use steam_shortcuts_util::{shortcut::ShortcutOwned, shortcuts_to_bytes, Shortcut #[tokio::main] async fn main() -> Result<(), Box> { + let app = app::App::default(); + let mut wind = Window::new(100, 100, 400, 300, "Hello from rust"); + wind.end(); + wind.show(); + app.run().unwrap(); + + let settings = Settings::new()?; let auth_key = settings.steamgrid_db.auth_key;