program guitest; #include "classes/gui.inc" unit intro:GUI procedure; var mx,my,mb:integer; begin call GUI_Rect(50,10,300,30,c_red,c_darkblue); call GUI_WriteText(51,11,unpack("Graphic User Interface Test Program"),c_white, c_darkblue); call GUI_WriteText(20,140,unpack("Press mouse key"),c_red,c_white); call GUI_Rect(10,40,300,110,c_green,c_lightgrey); call GUI_WriteText(15,45,unpack("This is demonstration program"),c_black, c_lightgrey); call GUI_WriteText(15,65,unpack("for new class named GUI."),c_black,c_lightgrey); call GUI_WriteText(15,85,unpack("Written by O.S."),c_black,c_lightgrey); mb:=0; while mb=0 do call GUI_MousePressed(mx,my,mb); od; end intro; unit Lines:GUI procedure; var i,j:integer; begin call GUI_Clear; call GUI_WriteText(10,10,unpack("You can draw lines using Line or LineTo procedures"), c_black,c_white); call GUI_Line(20,20,120,120,c_blue); i:=10; call GUI_Move(150,50); j:=0; while i<120 do call GUI_LineTo(i,100,j); i:=i+5;j:=j+1; if j>15 then j:=0; fi; od; call GUI_WriteText(10,150,unpack(" Press any key "),c_yellow,c_red); i:=0; while i=0 do i:=inkey; od; end Lines; unit Rectangles:GUI procedure; var i,j:integer; begin call GUI_Clear; call GUI_WriteText(10,10,unpack("You can draw rectangles using Rect procedure"), c_black,c_white); call GUI_Rect(30,30,300,130,c_darkred,c_darkblue); call GUI_Rect(130,40,100,50,c_blue,c_blue); call GUI_Rect(50,80,180,100,c_yellow,c_darkgrey); call GUI_WriteText(10,150,unpack(" Press any key "),c_yellow,c_red); i:=0; while i=0 do i:=inkey; od; end Rectangles; unit Ellipses:GUI procedure; var i,j:integer; begin call GUI_Clear; call GUI_WriteText(10,10,unpack("You can draw ellipses and arcs using Ellipse procedure"),c_black,c_white); call GUI_Ellipse(50,50,30,30,0,360,c_darkblue,c_yellow); call GUI_Ellipse(100,50,50,30,0,360,c_red,c_red); call GUI_Ellipse(150,50,80,50,0,180,c_black,c_green); call GUI_Ellipse(250,50,50,50,0,40,c_violet,c_violet); call GUI_WriteText(10,150,unpack(" Press any key "),c_yellow,c_red); i:=0; while i=0 do i:=inkey; od; end Ellipses; unit Images:GUI procedure; var c:array_of integer,i:integer; begin call GUI_Clear; call GUI_WriteText(10,10,unpack("There is also possibility to put images"), c_black,c_white); call GUI_WriteText(10,25,unpack("on the screen"), c_black,c_white); call GUI_WriteText(10,40,unpack("You can load an image from .BMP,.GIF,.XPM file:"), c_black,c_white); call GUI_PutImgFile(50,60,"examp/logo.bmp"); call GUI_WriteText(10,130,unpack("and copy bitmaps from/to screen:"), c_black,c_white); c:=GUI_GetImg(50,60,100,20); call GUI_PutImg(20,150,c); call GUI_KillImg(c); call GUI_WriteText(10,200,unpack(" Press any key "),c_yellow,c_red); i:=0; while i=0 do i:=inkey; od; end Images; unit WriteRead:GUI procedure; var i:integer,r:real,c:char,s:array_of char; begin call GUI_Clear; call GUI_WriteText(10,10,unpack("These are functions for read/write operations"), c_yellow,c_red); call GUI_WriteText(10,30,unpack("Text:"),c_black,c_white); s:=GUI_ReadText(10,50,c_darkblue,c_lightgrey); call GUI_WriteText(10,70,s,c_darkred,c_yellow); call GUI_WriteText(10,90,unpack("Integer:"),c_black,c_white); i:=GUI_ReadInt(10,110,c_darkblue,c_lightgrey); call GUI_WriteInt(10,130,i,c_darkred,c_yellow); call GUI_WriteText(10,250,unpack("Press any key"),c_black,c_white); i:=0; while i=0 do i:=inkey; od; call GUI_ClearArea(10,30,200,150); call GUI_WriteText(10,30,unpack("Real:"),c_black,c_white); r:=GUI_ReadReal(10,50,c_darkblue,c_lightgrey); call GUI_WriteReal(10,70,r,c_darkred,c_yellow); call GUI_WriteText(10,90,unpack("Char:"),c_black,c_white); c:=GUI_ReadChar(10,110,c_darkblue,c_lightgrey); call GUI_WriteChar(10,130,c,c_darkred,c_yellow); call GUI_WriteText(10,250,unpack("Press any key"),c_black,c_white); i:=0; while i=0 do i:=inkey; od; end WriteRead; unit QuitProc:GUI procedure; begin call GUI_WriteText(30,150,unpack("This is the end my dear friend..."), c_yellow,c_lightgrey); end QuitProc; unit menu:GUI function:integer; var i:integer; begin call GUI_Clear; call GUI_Rect(0,0,640,480,c_black,c_lightgrey); call GUI_WriteText(10,10,unpack("Choose your option: (red letter)"), c_black,c_lightgrey); call GUI_WriteChar(10,50,'L',c_red,c_lightgrey); call GUI_WriteText(18,50,unpack("ines"),c_blue,c_lightgrey); call GUI_WriteChar(100,50,'R',c_red,c_lightgrey); call GUI_WriteText(110,50,unpack("ectangles"),c_blue,c_lightgrey); call GUI_WriteChar(220,50,'E',c_red,c_lightgrey); call GUI_WriteText(230,50,unpack("llipses"),c_blue,c_lightgrey); call GUI_WriteChar(10,70,'I',c_red,c_lightgrey); call GUI_WriteText(18,70,unpack("mages"),c_blue,c_lightgrey); call GUI_WriteChar(100,70,'W',c_red,c_lightgrey); call GUI_WriteText(110,70,unpack("rite/read functions"),c_blue,c_lightgrey); call GUI_WriteChar(10,90,'Q',c_red,c_lightgrey); call GUI_WriteText(18,90,unpack("uit"),c_blue,c_lightgrey); i:=0; while i=0 do i:=inkey; od; result:=i; end menu; var mn:integer; begin call intro; mn:=0; while ( mn<>ord('q')) and (mn<>ord('Q')) do mn:=menu; if (mn=ord('l')) or (mn=ord('L')) then call Lines; fi; if (mn=ord('r')) or (mn=ord('R')) then call Rectangles; fi; if (mn=ord('e')) or (mn=ord('E')) then call Ellipses; fi; if (mn=ord('i')) or (mn=ord('I')) then call Images; fi; if (mn=ord('w')) or (mn=ord('W')) then call WriteRead; fi; od; call QuitProc; end.