forked from KolibriOS/kolibrios
63328e8522
git-svn-id: svn://kolibrios.org@623 a494cfbc-eb01-0410-851d-a64ba20cac60
100 lines
2.6 KiB
ObjectPascal
100 lines
2.6 KiB
ObjectPascal
{$codepage cp866}
|
||
{$mode objfpc}
|
||
{$smartlink on}
|
||
{$apptype console}
|
||
|
||
{ <20> ¤ ë© ¬®¬¥â à áᬠâਢ ¥âáï ¢ë¯®«¥¨¥ ¯à¨«®¤¥¨ï ⮫쪮 ª ª ª®á®«ì®¥,
|
||
â.¥. ¤¨à¥ªâ¨¢ concole ®¡ï§ ⥫ì , ¯®¢¥¤¥¨¥ ¯à®£à ¬¬ë ¯à¨ ®âáãâá⢨¨ í⮩
|
||
¤¨à¥ªâ¨¢ë ¯à¥¤®¯à¥¤¥«¨âì ¥«ì§ï. ƒ à â¨à®¢ ® ¥«ì§ï ¨á¯®«ì§®¢ âì äãªæ¨¨
|
||
Write, WriteLn, Read, ReadLn ®â®á¨â¥«ì® áâ ¤ à⮩ ª®á®«¨ ¢¢®¤ /¢ë¢®¤ .
|
||
}
|
||
|
||
program Example;
|
||
|
||
{ ‚ᥠäãªæ¨¨ ¨¬¥î騥 ¢ ᢮¥¬ ¨¬¥¨ ¯à¥ä¨ªá 'kos_' ïîâáï ¯« âä®à¬®§ ¢¨á¨¬ë¬¨
|
||
¨ ॠ«¨§®¢ ë ⮫쪮 ¯®¤ KolibriOS. ˆå ¨á¯®«ì§®¢ ¨¥ ¢ «î¡ëå ¯à®£à ¬¬ëå
|
||
¯à¨«®¦¥¨ïå ª ⥣®à¨ç¥áª¨ ¥ ४®¬¥¤®¢ ®, ¢ë®á¨â¥ ¢á¥ ¬¥â®¤ë, ¨á¯®«ì§ãî騥
|
||
í⨠äãªæ¨¨, ¢ ®â¤¥«ìë¥ ¬®¤ã«¨ (¨ ¨á¯®«ì§ã©â¥ ¥®¡å®¤¨¬ë¥ ¡áâà ªæ¨¨).
|
||
}
|
||
|
||
procedure DoPaint;
|
||
{ ‚뢮¤ ᮤ¥à¦¨¬®£® ®ª ¯à¨«®¦¥¨ï }
|
||
begin
|
||
kos_begindraw();
|
||
{®¯à¥¤¥«¥¨¥ ¯ à ¬¥â஢ ®ª (0)}
|
||
kos_definewindow(200, 200, 200, 50, $23AABBCC);
|
||
{kos_definewindow ¥ ¨¬¥¥â ¯ à ¬¥âà ¤«ï ¢ë¢®¤ § £®«®¢ª ,
|
||
¤¥« ¥¬ íâ® ®â¤¥«ì®© äãªæ¨¥©}
|
||
{kos_setcaption, ®â®¡à ¦¥¨¥ § £®«®¢ª ®ª (71.1)}
|
||
kos_setcaption('<27><>ˆŒ…<C592> <20><>Žƒ<C5BD>€ŒŒ›');
|
||
{¢ë¢®¤ á®®¡é¥¨ï (4)}
|
||
kos_drawtext(3, 8, '<27> ¦¬¨â¥ «î¡ãî ª« ¢¨èã...');
|
||
kos_enddraw();
|
||
end;
|
||
|
||
procedure DoKey;
|
||
{ Ž¡à ¡®âª ᮡëâ¨ï ¦ â¨ï ª« ¢¨è¨ }
|
||
var
|
||
Key: DWord;
|
||
Notes: array[0..3] of Byte;
|
||
begin
|
||
Key := kos_getkey();
|
||
{ áâà ¨¢ ¥¬ ¡ãä¥à ¤«ï ®â}
|
||
Notes[0] := $90;
|
||
Notes[1] := Key shr 8;
|
||
Notes[2] := $00;
|
||
{¢®á¯à®¨§¢®¤¨¬}
|
||
kos_speak(@Notes);
|
||
end;
|
||
|
||
|
||
function DoButton: Boolean;
|
||
{ Ž¡à ¡®âª ᮡëâ¨ï ¦ â¨ï ª®¯ª¨ GUI }
|
||
var
|
||
Button: DWord;
|
||
begin
|
||
{¯®«ãç¨âì ª®¤ ¦ ⮩ ª«¨ë¨è¨}
|
||
Button := kos_getbutton();
|
||
{¥á«¨ X, â® § ¢¥à襨¥ ¯à¨«®¦¥¨ï}
|
||
Result := Button = 1;
|
||
end;
|
||
|
||
|
||
function ProcessMessage: Boolean;
|
||
{ @return: ‚®§¢à é ¥â False, ¥á«¨ ¡ë«® ᮡë⨥ ª § ¢¥àè¥¨î ¯à¨«®¦¥¨ï.
|
||
@rtype: True ¨«¨ False }
|
||
var
|
||
Event: DWord;
|
||
begin
|
||
Result := False;
|
||
{®¦¨¤ ¥¬ ᮡëâ¨ï ®â á¨á⥬ë}
|
||
Event := kos_getevent();
|
||
case Event of
|
||
SE_PAINT : DoPaint; {¯¥à¥à¨á®¢ª ®ª }
|
||
SE_KEYBOARD: DoKey; {ᮡë⨥ ®â ª« ¢¨ âãàë}
|
||
SE_BUTTON : Result := DoButton; {ᮡ먥 ®â ª®¯ª¨, ¬®¦¥â ®¯à¥¤¥«¨âì
|
||
§ ¢¥à襨¥ ¯à¨«®¦¥¨ï, ¥á«¨ ¢¥à¥â True}
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure MainLoop;
|
||
{ ƒ« ¢ë© 横« ¯à¨«®¦¥¨ï }
|
||
var
|
||
ThreadSlot: TThreadSlot;
|
||
begin
|
||
{ᤥ« âì íâ® ®ª® ªâ¨¢ë¬}
|
||
ThreadSlot := kos_getthreadslot(ThreadID);
|
||
kos_setactivewindow(ThreadSlot);
|
||
{ áâà ¨¢ ¥¬ ᮡëâ¨ï, ª®â®àë¥ ¬ë £®â®¢ë ®¡à ¡ âë¢ âì}
|
||
kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_BUTTON);
|
||
{£« ¢ë© 横«}
|
||
while not ProcessMessage do;
|
||
end;
|
||
|
||
|
||
begin
|
||
WriteLn('Look for a new window, I''m just a konsole, hi mike ;-)');
|
||
MainLoop;
|
||
end.
|