generated from emilk/eframe_template
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
171 additions
and
77 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// Copyright (C) 2023 Lily Lyons | ||
// | ||
// This file is part of Luminol. | ||
// | ||
// Luminol is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Luminol is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Luminol. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
// Additional permission under GNU GPL version 3 section 7 | ||
// | ||
// If you modify this Program, or any covered work, by linking or combining | ||
// it with Steamworks API by Valve Corporation, containing parts covered by | ||
// terms of the Steamworks API by Valve Corporation, the licensors of this | ||
// Program grant you additional permission to convey the resulting work. | ||
use crate::prelude::*; | ||
|
||
#[derive(Default)] | ||
pub struct Window { | ||
egui_settings_open: bool, | ||
} | ||
|
||
impl super::Window for Window { | ||
fn id(&self) -> egui::Id { | ||
egui::Id::new("luminol_appearance_window") | ||
} | ||
|
||
fn name(&self) -> String { | ||
"Luminol Appearance".to_string() | ||
} | ||
|
||
fn show(&mut self, ctx: &egui::Context, open: &mut bool) { | ||
egui::Window::new(self.name()).open(open).show(ctx, |ui| { | ||
// Or these together so if one OR the other is true the window shows. | ||
self.egui_settings_open = | ||
ui.button("Egui Settings").clicked() || self.egui_settings_open; | ||
|
||
ui.menu_button("Catppuccin theme", |ui| { | ||
if ui.button("Frappe").clicked() { | ||
catppuccin_egui::set_theme(ui.ctx(), catppuccin_egui::FRAPPE); | ||
} | ||
if ui.button("Latte").clicked() { | ||
catppuccin_egui::set_theme(ui.ctx(), catppuccin_egui::LATTE); | ||
} | ||
if ui.button("Macchiato").clicked() { | ||
catppuccin_egui::set_theme(ui.ctx(), catppuccin_egui::MACCHIATO); | ||
} | ||
if ui.button("Mocha").clicked() { | ||
catppuccin_egui::set_theme(ui.ctx(), catppuccin_egui::MOCHA); | ||
} | ||
}); | ||
|
||
let theme = &mut global_config!().theme; | ||
ui.menu_button("Code Theme", |ui| { | ||
theme.ui(ui); | ||
|
||
ui.label("Code sample"); | ||
ui.label(syntax_highlighting::highlight( | ||
ui.ctx(), | ||
*theme, | ||
r#" | ||
class Foo < Array | ||
end | ||
def bar(baz) | ||
end | ||
print 1, 2.0 | ||
puts [0x3, :4, '5'] | ||
"#, | ||
"rb", | ||
)); | ||
}); | ||
|
||
if ui | ||
.button("Clear Loaded Textures") | ||
.on_hover_text( | ||
"You may need to reopen maps/windows for any changes to take effect.", | ||
) | ||
.clicked() | ||
{ | ||
state!().image_cache.clear(); | ||
state!().atlas_cache.clear(); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (C) 2023 Lily Lyons | ||
// | ||
// This file is part of Luminol. | ||
// | ||
// Luminol is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Luminol is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Luminol. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
// Additional permission under GNU GPL version 3 section 7 | ||
// | ||
// If you modify this Program, or any covered work, by linking or combining | ||
// it with Steamworks API by Valve Corporation, containing parts covered by | ||
// terms of the Steamworks API by Valve Corporation, the licensors of this | ||
// Program grant you additional permission to convey the resulting work. | ||
|
||
#[derive(Default)] | ||
pub struct Window {} | ||
|
||
impl super::Window for Window { | ||
fn name(&self) -> String { | ||
"Luminol Preferences".to_string() | ||
} | ||
|
||
fn id(&self) -> egui::Id { | ||
egui::Id::new("luminol_preferences_window") | ||
} | ||
|
||
fn show(&mut self, ctx: &egui::Context, open: &mut bool) { | ||
egui::Window::new(self.name()).open(open).show(ctx, |ui| {}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters