/*
* This file is part of the Hybris programming language interpreter.
*
* Copyleft of Simone Margaritelli aka evilsocket <evilsocket@gmail.com>
*
* Hybris is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hybris is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Hybris. If not, see <http://www.gnu.org/licenses/>.
*/
import std.*;
include std.os.Dll;
function screen_init(){
mainwnd = nc.initscr();
nc.noecho();
nc.cbreak();
nc.nodelay( mainwnd, 1 );
nc.refresh();
nc.wrefresh(mainwnd);
screen = nc.newwin(13, 27, 1, 1);
nc.box( screen, '|', '-' );
}
function update_display() {
t = time();
nc.curs_set(0);
nc.mvwprintw( screen, 1, 1, "-------- HEADER --------");
nc.mvwprintw( screen, 3, 6, "TIME: %d:%d:%d", t.hour, t.min, t.sec);
nc.mvwprintw( screen, 5, 6, "DATE: %d-%d-%d", t.mday, t.month, t.year);
nc.mvwprintw( screen, 7, 6, "PRESS q TO END");
nc.mvwprintw( screen, 10, 1, "-------- FOOTER --------");
nc.wrefresh(screen);
nc.refresh();
}
try{
nc = new Dll( "libncurses.so" );
screen = null;
screen_init();
while( nc.getch() != 113 ) {
update_display();
sleep(1);
}
nc.endwin();
}
catch( e ){
e.print();
}