may switch to iced
because 50% gpu usage on mouse going flying is crazy
This commit is contained in:
@@ -4,9 +4,10 @@
|
|||||||
pub struct RealmApp {
|
pub struct RealmApp {
|
||||||
// Example stuff:
|
// Example stuff:
|
||||||
label: String,
|
label: String,
|
||||||
|
selected: bool,
|
||||||
|
|
||||||
#[serde(skip)] // This how you opt-out of serialization of a field
|
// #[serde(skip)] // This how you opt-out of serialization of a field
|
||||||
value: f32,
|
// value: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RealmApp {
|
impl Default for RealmApp {
|
||||||
@@ -14,7 +15,7 @@ impl Default for RealmApp {
|
|||||||
Self {
|
Self {
|
||||||
// Example stuff:
|
// Example stuff:
|
||||||
label: "Hello World!".to_owned(),
|
label: "Hello World!".to_owned(),
|
||||||
value: 2.7,
|
selected: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,74 +37,53 @@ impl RealmApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl eframe::App for RealmApp {
|
impl eframe::App for RealmApp {
|
||||||
/// Called by the frame work to save state before shutdown.
|
|
||||||
fn save(&mut self, storage: &mut dyn eframe::Storage) {
|
|
||||||
eframe::set_value(storage, eframe::APP_KEY, self);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Called each time the UI needs repainting, which may be many times per second.
|
/// Called each time the UI needs repainting, which may be many times per second.
|
||||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||||
// Put your widgets into a `SidePanel`, `TopBottomPanel`, `CentralPanel`, `Window` or `Area`.
|
// Put your widgets into a `SidePanel`, `TopBottomPanel`, `CentralPanel`, `Window` or `Area`.
|
||||||
// For inspiration and more examples, go to https://emilk.github.io/egui
|
// For inspiration and more examples, go to https://emilk.github.io/egui
|
||||||
|
|
||||||
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
// egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
||||||
// The top panel is often a good place for a menu bar:
|
// egui::menu::bar(ui, |ui| {
|
||||||
|
// egui::widgets::global_dark_light_mode_buttons(ui);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
egui::menu::bar(ui, |ui| {
|
//Servers
|
||||||
// NOTE: no File->Quit on web pages!
|
egui::SidePanel::left("left_panel").show(ctx, |ui| {
|
||||||
let is_web = cfg!(target_arch = "wasm32");
|
ui.label("test");
|
||||||
if !is_web {
|
let response = ui.selectable_label(self.selected, "bruh");
|
||||||
ui.menu_button("File", |ui| {
|
if response.clicked() {
|
||||||
if ui.button("Quit").clicked() {
|
self.selected = !self.selected;
|
||||||
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
ui.add_space(16.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
egui::widgets::global_dark_light_mode_buttons(ui);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Channels
|
||||||
|
egui::SidePanel::left("inner_left_panel").show(ctx, |ui| {
|
||||||
|
ui.label("inner");
|
||||||
|
});
|
||||||
|
|
||||||
|
//Conversation
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
// The central panel the region left after adding TopPanel's and SidePanel's
|
//TODO: Messages
|
||||||
ui.heading("eframe template");
|
|
||||||
|
//Message Box
|
||||||
|
ui.with_layout(egui::Layout::bottom_up(egui::Align::BOTTOM).with_cross_justify(true), |ui| {
|
||||||
|
let response = ui.add(egui::TextEdit::multiline(&mut self.label).desired_rows(1));
|
||||||
|
if response.changed() {
|
||||||
|
|
||||||
|
}
|
||||||
|
ui.separator();
|
||||||
|
|
||||||
ui.horizontal(|ui| {
|
|
||||||
ui.label("Write something: ");
|
|
||||||
ui.text_edit_singleline(&mut self.label);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.add(egui::Slider::new(&mut self.value, 0.0..=10.0).text("value"));
|
// ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| {
|
||||||
if ui.button("Increment").clicked() {
|
// egui::warn_if_debug_build(ui);
|
||||||
self.value += 1.0;
|
// });
|
||||||
}
|
|
||||||
|
|
||||||
ui.separator();
|
|
||||||
|
|
||||||
ui.add(egui::github_link_file!(
|
|
||||||
"https://github.com/emilk/eframe_template/blob/main/",
|
|
||||||
"Source code."
|
|
||||||
));
|
|
||||||
|
|
||||||
ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| {
|
|
||||||
powered_by_egui_and_eframe(ui);
|
|
||||||
egui::warn_if_debug_build(ui);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn powered_by_egui_and_eframe(ui: &mut egui::Ui) {
|
/// Called by the framework to save state before shutdown.
|
||||||
ui.horizontal(|ui| {
|
fn save(&mut self, storage: &mut dyn eframe::Storage) {
|
||||||
ui.spacing_mut().item_spacing.x = 0.0;
|
eframe::set_value(storage, eframe::APP_KEY, self);
|
||||||
ui.label("Powered by ");
|
}
|
||||||
ui.hyperlink_to("egui", "https://github.com/emilk/egui");
|
|
||||||
ui.label(" and ");
|
|
||||||
ui.hyperlink_to(
|
|
||||||
"eframe",
|
|
||||||
"https://github.com/emilk/egui/tree/master/crates/eframe",
|
|
||||||
);
|
|
||||||
ui.label(".");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
0
client/src/components.rs
Normal file
0
client/src/components.rs
Normal file
@@ -1,4 +1,7 @@
|
|||||||
#![warn(clippy::all, rust_2018_idioms)]
|
#![warn(clippy::all, rust_2018_idioms)]
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
|
mod components;
|
||||||
|
mod types;
|
||||||
|
|
||||||
pub use app::RealmApp;
|
pub use app::RealmApp;
|
||||||
@@ -8,7 +8,7 @@ fn main() -> eframe::Result<()> {
|
|||||||
|
|
||||||
let native_options = eframe::NativeOptions {
|
let native_options = eframe::NativeOptions {
|
||||||
viewport: egui::ViewportBuilder::default()
|
viewport: egui::ViewportBuilder::default()
|
||||||
.with_inner_size([400.0, 300.0])
|
.with_inner_size([1280.0, 720.0])
|
||||||
.with_min_inner_size([300.0, 220.0])
|
.with_min_inner_size([300.0, 220.0])
|
||||||
.with_icon(
|
.with_icon(
|
||||||
// NOTE: Adding an icon is optional
|
// NOTE: Adding an icon is optional
|
||||||
|
|||||||
0
client/src/types.rs
Normal file
0
client/src/types.rs
Normal file
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "server"
|
name = "realm_server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user