Skip to content

Commit

Permalink
eframe: re-export epi::* so users don't need to care about what epi is
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 14, 2022
1 parent c47cb20 commit 5f4ee67
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions eframe/examples/confirm_exit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use eframe::{egui, epi};
use eframe::egui;

fn main() {
let options = eframe::NativeOptions::default();
Expand All @@ -13,13 +13,13 @@ struct MyApp {
is_exiting: bool,
}

impl epi::App for MyApp {
impl eframe::App for MyApp {
fn on_exit_event(&mut self) -> bool {
self.is_exiting = true;
self.can_exit
}

fn update(&mut self, ctx: &egui::Context, frame: &epi::Frame) {
fn update(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("Try to close the window");
});
Expand Down
8 changes: 4 additions & 4 deletions eframe/examples/custom_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use eframe::{egui, epi};
use eframe::egui;

use parking_lot::Mutex;
use std::sync::Arc;
Expand All @@ -27,16 +27,16 @@ struct MyApp {
}

impl MyApp {
fn new(cc: &epi::CreationContext<'_>) -> Self {
fn new(cc: &eframe::CreationContext<'_>) -> Self {
Self {
rotating_triangle: Arc::new(Mutex::new(RotatingTriangle::new(&cc.gl))),
angle: 0.0,
}
}
}

impl epi::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &epi::Frame) {
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 0.0;
Expand Down
6 changes: 3 additions & 3 deletions eframe/examples/download_image.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use eframe::{egui, epi};
use eframe::egui;
use egui_extras::RetainedImage;
use poll_promise::Promise;

Expand All @@ -19,8 +19,8 @@ struct MyApp {
promise: Option<Promise<ehttp::Result<RetainedImage>>>,
}

impl epi::App for MyApp {
fn update(&mut self, ctx: &egui::Context, frame: &epi::Frame) {
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {
let promise = self.promise.get_or_insert_with(|| {
// Begin download.
// We download the image using `ehttp`, a library that works both in WASM and on native.
Expand Down
6 changes: 3 additions & 3 deletions eframe/examples/hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use eframe::{egui, epi};
use eframe::egui;

fn main() {
let options = eframe::NativeOptions::default();
Expand All @@ -21,8 +21,8 @@ impl Default for MyApp {
}
}

impl epi::App for MyApp {
fn update(&mut self, ctx: &egui::Context, frame: &epi::Frame) {
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("My egui Application");
ui.horizontal(|ui| {
Expand Down
6 changes: 3 additions & 3 deletions eframe/examples/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use eframe::{egui, epi};
use eframe::egui;

fn main() {
let options = eframe::NativeOptions {
Expand All @@ -30,8 +30,8 @@ impl Default for MyApp {
}
}

impl epi::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &epi::Frame) {
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("SVG example");
ui.label("The SVG is rasterized and displayed as a texture.");
Expand Down
12 changes: 6 additions & 6 deletions eframe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//!
//! ## Usage, native:
//! ``` no_run
//! use eframe::{epi, egui};
//! use eframe::egui;
//!
//! fn main() {
//! let native_options = eframe::NativeOptions::default();
Expand All @@ -27,7 +27,7 @@
//! struct MyEguiApp {}
//!
//! impl MyEguiApp {
//! fn new(cc: &epi::CreationContext<'_>) -> Self {
//! fn new(cc: &eframe::CreationContext<'_>) -> Self {
//! // Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals.
//! // Restore app state using cc.storage (requires the "persistence" feature).
//! // Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use
Expand All @@ -36,8 +36,8 @@
//! }
//! }
//!
//! impl epi::App for MyEguiApp {
//! fn update(&mut self, ctx: &egui::Context, frame: &epi::Frame) {
//! impl eframe::App for MyEguiApp {
//! fn update(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {
//! egui::CentralPanel::default().show(ctx, |ui| {
//! ui.heading("Hello World!");
//! });
Expand Down Expand Up @@ -71,8 +71,8 @@

pub use {egui, egui::emath, egui::epaint, epi};

#[cfg(not(target_arch = "wasm32"))]
pub use epi::NativeOptions;
// Re-export everything in `epi` so `eframe` users don't have to care about what `epi` is:
pub use epi::*;

// ----------------------------------------------------------------------------
// When compiling for web
Expand Down

0 comments on commit 5f4ee67

Please sign in to comment.