build: fix build for desktop

This commit is contained in:
ardocrat
2023-07-11 16:23:10 +03:00
parent bab8c49f26
commit 88f92d51b3
9 changed files with 149 additions and 138 deletions
+27 -3
View File
@@ -12,13 +12,37 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::gui::PlatformApp;
use crate::gui::{App, PlatformApp};
use crate::gui::platform::PlatformCallbacks;
#[derive(Default)]
pub struct Desktop;
impl PlatformCallbacks for Desktop {
fn show_keyboard(&self) {}
fn hide_keyboard(&self) {}
fn copy_string_to_buffer(&self, data: String) {}
fn get_string_from_buffer(&self) -> String {
"".to_string()
}
fn exit(&self) {}
}
impl PlatformApp<Desktop> {
pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
Self::default()
pub fn new(platform: Desktop) -> Self {
Self {
app: App::default(),
platform,
}
}
}
impl eframe::App for PlatformApp<Desktop> {
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
self.app.ui(ctx, frame, &self.platform);
}
}
+2 -1
View File
@@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
pub use self::platform::*;
#[cfg(target_os = "android")]
@@ -18,7 +19,7 @@ pub use self::platform::*;
pub mod platform;
#[cfg(not(target_os = "android"))]
#[path = "desktop/mod.rs"]
pub mod app;
pub mod platform;
pub trait PlatformCallbacks {
fn show_keyboard(&self);