kolibrios/programs/develop/fp/examples/example.pp

102 lines
2.6 KiB
ObjectPascal
Raw Normal View History

{ <20> FreePascal 2.2.0 <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2> cp866 <20><><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. }
{-$codepage cp866}
{$mode objfpc}
{$smartlink on}
{$apptype console}
{ <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⮫쪮 <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>᮫쭮<EFBFBD>,
<EFBFBD>.<EFBFBD>. <EFBFBD><EFBFBD>४⨢<EFBFBD> console <EFBFBD><EFBFBD>易⥫쭠, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ணࠬ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>
<EFBFBD><EFBFBD>४⨢<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樨
Write, WriteLn, Read, ReadLn <EFBFBD><EFBFBD><EFBFBD>⥫쭮 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD>.
}
program Example;
{ <EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樨 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 'kos_' <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᨬ묨
<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⮫쪮 <EFBFBD><EFBFBD><EFBFBD> KolibriOS. <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ணࠬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樨, <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ࠪ樨).
}
procedure DoPaint;
{ <20><EFBFBD><><EFBFBD><E0A6A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }
begin
kos_begindraw();
{<7B><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0AC><20><><EFBFBD><EFBFBD>}
kos_definewindow(200, 200, 200, 50, $23AABBCC);
{kos_definewindow <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪樥<EFBFBD> kos_setcaption}
{<7B>⮡ࠦ<E2AEA1><E0A0A6><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>}
kos_setcaption('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
{<7B><EFBFBD><><EFBFBD><E9A5AD>}
kos_drawtext(3, 8, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...');
kos_enddraw();
end;
procedure DoKey;
{ <20><><EFBFBD>⪠ ᮡ<><E1AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }
var
Key: DWord;
Notes: array[0..3] of Byte;
begin
Key := kos_getkey();
{<7B><><EFBFBD><EFBFBD><EFBFBD><E0A0A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>}
Notes[0] := $90;
Notes[1] := Key shr 8;
Notes[2] := $00;
{<7B><><EFBFBD><EFBFBD><EFBFBD><E0AEA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
kos_speaker(@Notes);
end;
function DoButton: Boolean;
{ <20><><EFBFBD>⪠ ᮡ<><E1AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GUI }
var
Button: DWord;
begin
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Button := kos_getbutton();
{<7B>᫨ [x], <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0AEA2><EFBFBD><EFBFBD><E0AEA2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
Result := Button <> 1;
end;
function ProcessMessage: Boolean;
{ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD>.
@return: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> False, <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
@rtype: True <EFBFBD><EFBFBD><EFBFBD> False }
var
Event: DWord;
begin
Result := True;
{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>}
Event := kos_getevent();
case Event of
SE_PAINT : DoPaint; {<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>}
SE_KEYBOARD: DoKey; {ᮡ<><20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
SE_BUTTON : Result := DoButton; {ᮡ먥 <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD> <EFBFBD><EFBFBD><EFBFBD> False}
end;
end;
procedure MainLoop;
{ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }
var
ThreadSlot: TThreadSlot;
begin
{<7B><><EFBFBD><EFBFBD><EFBFBD><E0A0A8><EFBFBD><EFBFBD><><E1AEA1><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><E0A0A1><EFBFBD><EBA2A0>}
kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_BUTTON);
{<7B><><EFBFBD>⪠ ᮡ<>⨩}
while ProcessMessage do;
end;
begin
WriteLn('Look for a new window, I''m just a konsole ;-)');
MainLoop;
end.