kolibrios/programs/develop/fp/examples/src/example.pp
bw 350d7e1cc7 [fp] changes in rtl & examples
git-svn-id: svn://kolibrios.org@790 a494cfbc-eb01-0410-851d-a64ba20cac60
2008-04-12 09:48:18 +00:00

99 lines
2.2 KiB
ObjectPascal
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ FreePascal 2.2.0 ª®¤¨à®¢ª  cp866 ­¥ ॠ«¨§®¢ ­ . }
{-$codepage cp866}
{$mode objfpc}
{$smartlink on}
{$apptype gui}
program Example;
{ ‚ᥠä㭪樨 ¨¬¥î騥 ¢ ᢮¥¬ ¨¬¥­¨ ¯à¥ä¨ªá 'kos_' ïîâáï ¯« âä®à¬®§ ¢¨á¨¬ë¬¨
¨ ॠ«¨§®¢ ­ë ⮫쪮 ¤«ï KolibriOS. ˆå ¨á¯®«ì§®¢ ­¨¥ ¢ «î¡ëå ¯à®£à ¬¬­ëå
¯à¨«®¦¥­¨ïå ª â¥£®à¨ç¥áª¨ ­¥ ४®¬¥­¤®¢ ­®, ¢ë­®á¨â¥ ¢á¥ ¬¥â®¤ë, ¨á¯®«ì§ãî騥
í⨠ä㭪樨, ¢ ®â¤¥«ì­ë¥ ¬®¤ã«¨ (¨ ¨á¯®«ì§ã©â¥ ­¥®¡å®¤¨¬ë¥  ¡áâࠪ樨). }
procedure DoPaint;
{ ‚뢮¤ ᮤ¥à¦¨¬®£® ®ª­  ¯à¨«®¦¥­¨ï }
begin
kos_begindraw();
{ ®¯à¥¤¥«¥­¨¥ ¯ à ¬¥â஢ ®ª­  }
kos_definewindow(200, 200, 200, 50, $23AABBCC);
{ kos_definewindow ­¥ ¨¬¥¥â ¯ à ¬¥âà  ¤«ï ¢ë¢®¤  § £®«®¢ª ,
¤¥« ¥¬ íâ® ®â¤¥«ì­®© ä㭪樥© kos_setcaption }
{ ®â®¡à ¦¥­¨¥ § £®«®¢ª  ®ª­  }
kos_setcaption('<27><>ˆŒ…<C592> <20><>Žƒ<C5BD>€ŒŒ');
{ ¢ë¢®¤ á®®¡é¥­¨ï }
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_speaker(@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 := True;
{ ®¦¨¤ ¥¬ ᮡëâ¨ï ®â á¨á⥬ë }
Event := kos_getevent();
case Event of
SE_PAINT : DoPaint; { ¯¥à¥à¨á®¢ª  ®ª­  }
SE_KEYBOARD: DoKey; { ᮡë⨥ ®â ª« ¢¨ âãàë }
SE_BUTTON : Result := DoButton; { ᮡë⨥ ®â ª­®¯ª¨, ¬®¦¥â ®¯à¥¤¥«¨âì
§ ¢¥à襭¨¥ ¯à¨«®¦¥­¨ï, ¥á«¨ ¢¥à­¥â False }
end;
end;
{ ƒ« ¢­ë© 横« ¯à¨«®¦¥­¨ï }
var
ThreadSlot: TThreadSlot;
begin
{ ­ áâà ¨¢ ¥¬ ᮡëâ¨ï, ª®â®àë¥ ¬ë £®â®¢ë ®¡à ¡ â뢠âì }
kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_BUTTON);
{ ®¡à ¡®âª  ᮡë⨩ }
while ProcessMessage do;
end.