hadean-old/src/qt/index.ts

67 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-07-23 00:12:02 -04:00
import {
QMainWindow, WidgetEventTypes
} from '@nodegui/nodegui';
import { APPLICATION_NAME } from '../Constants.js';
2021-07-25 13:57:47 -04:00
import { ProcessManager } from '../ProcessManager.js';
2021-07-23 00:12:02 -04:00
import { LoadingView } from './LoadingView.js';
2021-07-25 13:57:47 -04:00
import { RequestReloadPopup } from './RequestReloadPopup.js';
2021-07-23 00:12:02 -04:00
import { View } from './View.js';
export { GameView } from './GameView.js';
export { Popup } from './Popup.js';
export const win = new QMainWindow();
win.setFixedSize(800, 600);
win.setWindowTitle(APPLICATION_NAME);
2021-07-26 00:18:21 -04:00
// win.setStyleSheet(`
2021-07-26 14:23:41 -04:00
// QTabWidget::tab {
// bottom: 2px;
2021-07-26 00:18:21 -04:00
// }
// `);
2021-07-23 00:12:02 -04:00
win.show();
(global as any).win = win;
win.addEventListener(WidgetEventTypes.Paint, _ => _);
win.addEventListener('customContextMenuRequested', console.log)
win.addEventListener('objectNameChanged', console.log)
win.addEventListener('windowIconChanged', console.log)
win.addEventListener('windowTitleChanged', console.log)
setView(new LoadingView());
export function start() {
}
export function stop() {
win.close();
}
export function setView(view: View) {
view.addComponents();
}
export function setTitle(title: string) {
}
export function update() {
}
export function isStarted() {
2021-07-26 00:18:21 -04:00
return true;
2021-07-23 00:12:02 -04:00
return win.isVisible();
}
2021-07-25 13:57:47 -04:00
ProcessManager.on('reload', () => {
RequestReloadPopup.show();
//
2021-07-26 00:18:21 -04:00
});
2021-07-25 13:57:47 -04:00
2021-07-23 00:12:02 -04:00
// HACK this is bullshit, :)
function f() {
win.repaint();
win.update();
setTimeout(f, 100);
}
f();