Обновление примера согласно реализации движка.

This commit is contained in:
Alexander Zhirov 2026-01-06 11:00:19 +03:00
parent 2bab6fc3e9
commit c43ef1e908
Signed by: alexander
GPG key ID: C8D8BE544A27C511
3 changed files with 54 additions and 17 deletions

View file

@ -0,0 +1,45 @@
module simple.app;
import ncui;
import deimos.ncurses;
final class Simple : ScreenBase
{
override ScreenAction onShow(ScreenContext context)
{
int height = getmaxy(context.session.root());
int width = getmaxx(context.session.root());
if (_window !is null)
{
_window.close();
}
_window = new Window(height / 2, width / 2, 0, 0);
_window.erase();
_window.border();
_window.refresh();
return ScreenAction.none();
}
override ScreenAction handle(ScreenContext context, KeyEvent event)
{
if (event.status == ERR)
{
return ScreenAction.quit(ScreenResult.none());
}
if (event.isChar)
{
if (event.ch == 27) {
return ScreenAction.quit(ScreenResult.none());
}
}
return ScreenAction.none();
}
}

View file

@ -0,0 +1,3 @@
module simple;
public import simple.app;