Обновление примера согласно реализации движка.
This commit is contained in:
parent
2bab6fc3e9
commit
c43ef1e908
3 changed files with 54 additions and 17 deletions
45
example/source/simple/app.d
Normal file
45
example/source/simple/app.d
Normal 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();
|
||||
}
|
||||
}
|
||||
3
example/source/simple/package.d
Normal file
3
example/source/simple/package.d
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module simple;
|
||||
|
||||
public import simple.app;
|
||||
Loading…
Add table
Add a link
Reference in a new issue