added oocRandomNumbers, updated newt wrapper with GetKey function. -- noch

Former-commit-id: ab5d3f734e
This commit is contained in:
Norayr Chilingarian 2015-03-12 00:24:11 +04:00
parent 7de984b46a
commit 6886a243a6
14 changed files with 109 additions and 7 deletions

View file

@ -7,6 +7,8 @@ all:
$(VOC) -s newt.Mod newttest.Mod -m
$(VOC) -s newt.Mod newttest2.Mod -m
tetris:
$(VOC) -s newt.Mod tetris.Mod -m
clean:
rm *.h
rm *.c

View file

@ -98,6 +98,16 @@ BEGIN
newtWaitForKey
END WaitForKey;
PROCEDURE -newtGetKey(): Int32
"newtGetKey()";
PROCEDURE GetKey*(): CHAR;
VAR i : Int32;
BEGIN
i:= newtGetKey();
RETURN CHR(SHORT(i));
END GetKey;
PROCEDURE -newtClearKeyBuffer()
"newtClearKeyBuffer()";

View file

@ -3,6 +3,7 @@ MODULE newttest;
IMPORT newt, oocIntStr, Unix;
VAR i, j, k : newt.Int32;
str : ARRAY 32 OF CHAR;
ch : CHAR;
fo, co : newt.Component;
BEGIN
i := newt.Init();
@ -29,10 +30,17 @@ newt.PopHelpLine();
newt.Refresh();
i := Unix.Sleep(1);
fo := newt.Form(NIL, "aaa", 0);
co := newt.Button(15, 15, "OK");
newt.FormAddComponent(fo, co);
REPEAT
ch := newt.GetKey();
str[0] := ch;
str[1] := 0X;
newt.DrawRootText(5, 5, str);
newt.PushHelpLine(str);
newt.Refresh;
UNTIL ch = ' ';
(*
newt.WaitForKey();
newt.Delay(30);
newt.Delay(30);*)
i := newt.Finished();
END newttest.