gtk window

This commit is contained in:
LunarAkai 2025-08-02 12:43:07 +02:00
commit 0c3a160dd5
12 changed files with 437 additions and 1714 deletions

View file

@ -0,0 +1,51 @@
use std::marker::PhantomData;
use gtk4::{gio::prelude::{ApplicationExt, ApplicationExtManual}, glib::object::ObjectExt, prelude::{GtkWindowExt, WidgetExt}, subclass::prelude::GtkApplicationImpl, Application, ApplicationWindow};
use crate::{MoonhareWindow, WindowResult};
#[derive(Debug)]
pub struct GTKWindow {
application: Application,
}
const APP_ID: &str = "de.lunarakai.moonhare_engine";
impl GTKWindow {
pub fn get_application(self) -> Application {
self.application
}
fn build_ui(application: &Application) {
let window = ApplicationWindow::new(application);
window.set_title(Some("Moonhare Engine GTK"));
window.set_default_size(1280, 720);
window.show();
}
}
impl MoonhareWindow for GTKWindow {
type WindowResult = GTKWindow;
fn init() -> Self::WindowResult {
let app = Application::builder().application_id(APP_ID).build();
app.connect_activate(GTKWindow::build_ui);
Self {
application: app
}
}
fn on_update() {
}
fn shutdown() {
}
}

View file

@ -0,0 +1 @@
pub mod gtk_window;