title window
This commit is contained in:
@@ -38,13 +38,7 @@ impl App {
|
|||||||
impl ApplicationHandler<ClientEvent> for App {
|
impl ApplicationHandler<ClientEvent> for App {
|
||||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||||
if self.client.is_none() {
|
if self.client.is_none() {
|
||||||
let window = event_loop
|
let client = Client::new(event_loop, self.proxy.clone());
|
||||||
.create_window(Window::default_attributes())
|
|
||||||
.unwrap();
|
|
||||||
let client = Client::new(AppHandle {
|
|
||||||
proxy: self.proxy.clone(),
|
|
||||||
window: window.into(),
|
|
||||||
});
|
|
||||||
self.client = Some(client);
|
self.client = Some(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub use app::App;
|
pub use app::App;
|
||||||
use arboard::Clipboard;
|
use arboard::Clipboard;
|
||||||
use input::Input;
|
use input::Input;
|
||||||
@@ -5,7 +7,8 @@ use iris::prelude::*;
|
|||||||
use render::Renderer;
|
use render::Renderer;
|
||||||
use winit::{
|
use winit::{
|
||||||
event::{Ime, WindowEvent},
|
event::{Ime, WindowEvent},
|
||||||
event_loop::ActiveEventLoop,
|
event_loop::{ActiveEventLoop, EventLoopProxy},
|
||||||
|
window::Window,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -43,9 +46,15 @@ pub struct Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
pub fn new(handle: AppHandle) -> Self {
|
pub fn new(event_loop: &ActiveEventLoop, proxy: EventLoopProxy<ClientEvent>) -> Self {
|
||||||
let renderer = Renderer::new(handle.window.clone());
|
let window = Arc::new(
|
||||||
|
event_loop
|
||||||
|
.create_window(Window::default_attributes().with_title("OPENWORM"))
|
||||||
|
.unwrap(),
|
||||||
|
);
|
||||||
|
let renderer = Renderer::new(window.clone());
|
||||||
let dir = DataDir::default();
|
let dir = DataDir::default();
|
||||||
|
let handle = AppHandle { proxy, window };
|
||||||
|
|
||||||
let mut s = Self {
|
let mut s = Self {
|
||||||
handle,
|
handle,
|
||||||
|
|||||||
Reference in New Issue
Block a user