Browse Source

ZenGL_3_28_and_Green_Engine

Mirrel 4 years ago
parent
commit
f3c6dcdf0a
100 changed files with 2163 additions and 1966 deletions
  1. 1 0
      Zengl_SRC/bin/data/Rus.txt
  2. 0 29
      Zengl_SRC/bin/x86_64-win64/log.txt
  3. 4 4
      Zengl_SRC/demos/Delphi/01 - Initialization/demo01.cfg
  4. 13 6
      Zengl_SRC/demos/Delphi/01 - Initialization/demo01.dof
  5. 19 1
      Zengl_SRC/demos/Delphi/01 - Initialization/demo01.dpr
  6. 4 4
      Zengl_SRC/demos/Delphi/02 - Resources/demo02.cfg
  7. 13 6
      Zengl_SRC/demos/Delphi/02 - Resources/demo02.dof
  8. 10 21
      Zengl_SRC/demos/Delphi/02 - Resources/demo02.dpr
  9. 4 4
      Zengl_SRC/demos/Delphi/03 - Input/demo03.cfg
  10. 13 6
      Zengl_SRC/demos/Delphi/03 - Input/demo03.dof
  11. 108 17
      Zengl_SRC/demos/Delphi/03 - Input/demo03.dpr
  12. 4 4
      Zengl_SRC/demos/Delphi/04 - Screen Settings/demo04.cfg
  13. 13 6
      Zengl_SRC/demos/Delphi/04 - Screen Settings/demo04.dof
  14. 4 9
      Zengl_SRC/demos/Delphi/04 - Screen Settings/demo04.dpr
  15. 4 4
      Zengl_SRC/demos/Delphi/05 - Primitives/demo05.cfg
  16. 13 6
      Zengl_SRC/demos/Delphi/05 - Primitives/demo05.dof
  17. 7 7
      Zengl_SRC/demos/Delphi/05 - Primitives/demo05.dpr
  18. 4 4
      Zengl_SRC/demos/Delphi/06 - Text/demo06.cfg
  19. 13 6
      Zengl_SRC/demos/Delphi/06 - Text/demo06.dof
  20. 3 15
      Zengl_SRC/demos/Delphi/06 - Text/demo06.dpr
  21. 4 4
      Zengl_SRC/demos/Delphi/07 - Sprites/demo07.cfg
  22. 13 6
      Zengl_SRC/demos/Delphi/07 - Sprites/demo07.dof
  23. 10 8
      Zengl_SRC/demos/Delphi/07 - Sprites/demo07.dpr
  24. 4 4
      Zengl_SRC/demos/Delphi/08 - Sprite Engine/demo08.cfg
  25. 13 6
      Zengl_SRC/demos/Delphi/08 - Sprite Engine/demo08.dof
  26. 17 12
      Zengl_SRC/demos/Delphi/08 - Sprite Engine/demo08.dpr
  27. 4 4
      Zengl_SRC/demos/Delphi/09 - Sprite Engine(Classes)/demo09.cfg
  28. 13 6
      Zengl_SRC/demos/Delphi/09 - Sprite Engine(Classes)/demo09.dof
  29. 19 12
      Zengl_SRC/demos/Delphi/09 - Sprite Engine(Classes)/demo09.dpr
  30. 4 4
      Zengl_SRC/demos/Delphi/10 - Tiles/demo10.cfg
  31. 13 6
      Zengl_SRC/demos/Delphi/10 - Tiles/demo10.dof
  32. 1 11
      Zengl_SRC/demos/Delphi/10 - Tiles/demo10.dpr
  33. 4 4
      Zengl_SRC/demos/Delphi/11 - Grid/demo11.cfg
  34. 13 6
      Zengl_SRC/demos/Delphi/11 - Grid/demo11.dof
  35. 1 3
      Zengl_SRC/demos/Delphi/11 - Grid/demo11.dpr
  36. 4 4
      Zengl_SRC/demos/Delphi/12 - Render into Texture/demo12.cfg
  37. 13 6
      Zengl_SRC/demos/Delphi/12 - Render into Texture/demo12.dof
  38. 1 9
      Zengl_SRC/demos/Delphi/12 - Render into Texture/demo12.dpr
  39. 5 5
      Zengl_SRC/demos/Delphi/13 - Particles/demo13.cfg
  40. 16 7
      Zengl_SRC/demos/Delphi/13 - Particles/demo13.dof
  41. 5 11
      Zengl_SRC/demos/Delphi/13 - Particles/demo13.dpr
  42. 4 4
      Zengl_SRC/demos/Delphi/14 - Sound/demo14.cfg
  43. 13 6
      Zengl_SRC/demos/Delphi/14 - Sound/demo14.dof
  44. 25 24
      Zengl_SRC/demos/Delphi/14 - Sound/demo14.dpr
  45. 4 4
      Zengl_SRC/demos/Delphi/15 - Video/demo15.cfg
  46. 13 6
      Zengl_SRC/demos/Delphi/15 - Video/demo15.dof
  47. 3 7
      Zengl_SRC/demos/Delphi/15 - Video/demo15.dpr
  48. 4 4
      Zengl_SRC/demos/Delphi/16 - Physics/demo16.cfg
  49. 13 1
      Zengl_SRC/demos/Delphi/16 - Physics/demo16.dof
  50. 4 7
      Zengl_SRC/demos/Delphi/16 - Physics/demo16.dpr
  51. 1 1
      Zengl_SRC/demos/FreePascal/01 - Initialization/Makefile
  52. 35 10
      Zengl_SRC/demos/FreePascal/01 - Initialization/demo01.pas
  53. 0 0
      Zengl_SRC/demos/FreePascal/01 - Initialization/demo01_macosx.plist
  54. 0 0
      Zengl_SRC/demos/FreePascal/01 - Initialization/fp___.out
  55. 1 1
      Zengl_SRC/demos/FreePascal/01 - Initialization/macosx_postbuild.sh
  56. 8 6
      Zengl_SRC/demos/FreePascal/02 - Resources/demo02.pas
  57. 1 1
      Zengl_SRC/demos/FreePascal/02 - Resources/demo02_macosx.plist
  58. 102 19
      Zengl_SRC/demos/FreePascal/03 - Input/demo03.pas
  59. 1 1
      Zengl_SRC/demos/FreePascal/03 - Input/demo03_macosx.plist
  60. 3 7
      Zengl_SRC/demos/FreePascal/04 - Screen Settings/demo04.pas
  61. 1 1
      Zengl_SRC/demos/FreePascal/04 - Screen Settings/demo04_macosx.plist
  62. 15 15
      Zengl_SRC/demos/FreePascal/05 - Primitives/demo05.pas
  63. 1 1
      Zengl_SRC/demos/FreePascal/05 - Primitives/demo05_macosx.plist
  64. 5 19
      Zengl_SRC/demos/FreePascal/06 - Text/demo06.pas
  65. 1 1
      Zengl_SRC/demos/FreePascal/06 - Text/demo06_macosx.plist
  66. 269 256
      Zengl_SRC/demos/FreePascal/07 - Sprites/demo07.pas
  67. 1 1
      Zengl_SRC/demos/FreePascal/07 - Sprites/demo07_macosx.plist
  68. 223 202
      Zengl_SRC/demos/FreePascal/08 - Sprite Engine/demo08.pas
  69. 1 1
      Zengl_SRC/demos/FreePascal/08 - Sprite Engine/demo08_macosx.plist
  70. 83 63
      Zengl_SRC/demos/FreePascal/09 - Sprite Engine(Classes)/demo09.pas
  71. 1 1
      Zengl_SRC/demos/FreePascal/09 - Sprite Engine(Classes)/demo09_macosx.plist
  72. 91 90
      Zengl_SRC/demos/FreePascal/10 - Tiles/demo10.pas
  73. 1 1
      Zengl_SRC/demos/FreePascal/10 - Tiles/demo10_macosx.plist
  74. 109 100
      Zengl_SRC/demos/FreePascal/11 - Grid/demo11.pas
  75. 1 1
      Zengl_SRC/demos/FreePascal/11 - Grid/demo11_macosx.plist
  76. 93 90
      Zengl_SRC/demos/FreePascal/12 - Render into Texture/demo12.pas
  77. 1 1
      Zengl_SRC/demos/FreePascal/12 - Render into Texture/demo12_macosx.plist
  78. 138 131
      Zengl_SRC/demos/FreePascal/13 - Particles/demo13.pas
  79. 1 1
      Zengl_SRC/demos/FreePascal/13 - Particles/demo13_macosx.plist
  80. 178 167
      Zengl_SRC/demos/FreePascal/14 - Sound/demo14.pas
  81. 1 1
      Zengl_SRC/demos/FreePascal/14 - Sound/demo14_macosx.plist
  82. 101 94
      Zengl_SRC/demos/FreePascal/15 - Video/demo15.pas
  83. 1 1
      Zengl_SRC/demos/FreePascal/15 - Video/demo15_macosx.plist
  84. 4 8
      Zengl_SRC/demos/FreePascal/16 - Physics/demo16.pas
  85. 0 86
      Zengl_SRC/demos/FreePascal/16 - Physics/demo16_macosx.plist
  86. 0 141
      Zengl_SRC/demos/FreePascal/17 - Menu(touch menu)/demo17.pas
  87. 0 24
      Zengl_SRC/demos/FreePascal/17 - Menu(touch menu)/demo17_macosx.plist
  88. 0 5
      Zengl_SRC/demos/FreePascal/17 - Menu(touch menu)/macosx_postbuild.sh
  89. 10 4
      Zengl_SRC/demos/FreePascal/Makefile
  90. 20 2
      Zengl_SRC/demos/Lazarus/01 - Initialization/demo01.lpr
  91. 5 5
      Zengl_SRC/demos/Lazarus/01 - Initialization/demo01.lps
  92. 5 3
      Zengl_SRC/demos/Lazarus/01 - Initialization/demo01_macosx.lps
  93. 8 6
      Zengl_SRC/demos/Lazarus/02 - Resources/demo02.lpr
  94. 5 4
      Zengl_SRC/demos/Lazarus/02 - Resources/demo02.lps
  95. BIN
      Zengl_SRC/demos/Lazarus/02 - Resources/demo02.res
  96. 5 4
      Zengl_SRC/demos/Lazarus/02 - Resources/demo02_macosx.lps
  97. 108 19
      Zengl_SRC/demos/Lazarus/03 - Input/demo03.lpr
  98. 6 7
      Zengl_SRC/demos/Lazarus/03 - Input/demo03.lps
  99. BIN
      Zengl_SRC/demos/Lazarus/03 - Input/demo03.res
  100. 4 3
      Zengl_SRC/demos/Lazarus/03 - Input/demo03_macosx.lps

+ 1 - 0
Zengl_SRC/bin/data/Rus.txt

@@ -0,0 +1 @@
+~`ЁёQqЙйWwЦцEeУуRrКкTtЕеYyНнUuГгIiШшOoЩщPpЗз{[Хх}]ЪъAaФфSsЫыDdВвFfАаGgПпHhРрJjОоKkЛлLlДд:;Жж"'ЭэZzЯяXxЧчCcСсVvМмBbИиNnТтMmЬь<,Бб>.Юю?/,.

+ 0 - 29
Zengl_SRC/bin/x86_64-win64/log.txt

@@ -1,29 +0,0 @@
-========================================
-=== ZenGL - test 0.3.25 (2020.09.28) ===
-========================================
-[00000001ms] Begin
-[00000001ms] Current mode: 1366 x 768
-[00000657ms] wglChoosePixelFormatARB: zDepth = 24; stencil = 0; fsaa = 0
-[00000730ms] GL_VERSION: 4.0.0 - Build 10.18.10.5069
-[00000730ms] GL_RENDERER: Intel(R) HD Graphics 4000
-[00000738ms] GL_MAX_TEXTURE_SIZE: 16384
-[00000738ms] GL_EXT_TEXTURE_COMPRESSION_S3TC: TRUE
-[00000738ms] GL_SGIS_GENERATE_MIPMAP: TRUE
-[00000738ms] GL_MAX_TEXTURE_UNITS_ARB: 8
-[00000738ms] GL_EXT_TEXTURE_FILTER_ANISOTROPIC: TRUE
-[00000738ms] GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 16
-[00000745ms] GL_EXT_BLEND_FUNC_SEPARATE: TRUE
-[00000745ms] GL_MAX_RENDERBUFFER_SIZE: 16384
-[00000745ms] GL_EXT_FRAMEBUFFER_OBJECT: TRUE
-[00000745ms] WGL_PBUFFER: TRUE
-[00000745ms] Support WaitVSync: TRUE
-[00000751ms] Ogg: Initialized
-[00000781ms] Theora: Initialized
-[00000889ms] Texture loaded: "../data/font-page0.png"
-[00003805ms] Average FPS: 44
-[00003805ms] Timers to free: 2
-[00003805ms] Fonts to free: 1
-[00003805ms] Font to free
-[00003806ms] Render Targets not free!!!
-[00003806ms] Textures to free: 1
-[00003809ms] End

+ 4 - 4
Zengl_SRC/demos/Delphi/01 - Initialization/demo01.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/01 - Initialization/demo01.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 19 - 1
Zengl_SRC/demos/Delphi/01 - Initialization/demo01.dpr

@@ -39,6 +39,8 @@ begin
   // EN: This function is the best way to implement smooth moving of something, because accuracy of timers are restricted by FPS.
 end;
 
+// RU: Ïðèìåð èñïîëüçîâàíèÿ òàéìåðà.
+// EN: An example of using a timer.
 procedure Timer;
 begin
   // RU: Áóäåì â çàãîëîâêå ïîêàçûâàòü êîëè÷åñòâî êàäðîâ â ñåêóíäó.
@@ -46,9 +48,18 @@ begin
   wnd_SetCaption(utf8_Copy('01 - Initialization[ FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)) + ' ]'));
 end;
 
+procedure KeyMouseEvent;
+begin
+  // RU: Ôóíêöèÿ îáðàáîòêè êëàâèàòóðû, ìûøè, äæîéñòèêà è òà÷ïàäà. Âñå ñîáûòèÿ ñâÿçàííûå ñ íèìè î÷èùàþòñÿ ïîñëå å¸ îáðàáîòêè.
+  //     Âñå ïîïûòêè îáðàáîòàòü êëàâèàòóðó, ìûøü è òà÷ïàä, ìîãóò ïðèâåñòè ê íåïðåäâèäåííûì ñèòóàöèÿì.
+  // EN: Keyboard, mouse and touchpad handling function. All events associated with them are cleared after processing it.
+  //     Any attempt to handle the keyboard, mouse, or touchpad in other functions may lead to unexpected situations.
+end;
+
 procedure Quit;
 begin
- //
+ // RU: Ñîáûòèÿ êîòîðûå íàäî ïðîèçâåñòè ïî çàâåðøåíèþ ïðîãðàììû.
+ // EN: Events to be performed at the end of the program.
 end;
 
 Begin
@@ -57,6 +68,13 @@ Begin
   DirApp  := utf8_Copy(PAnsiChar(zgl_Get(DIRECTORY_APPLICATION)));
   DirHome := utf8_Copy(PAnsiChar(zgl_Get(DIRECTORY_HOME)));
 
+  // RU: Óñòàíàâëèâàåì èíòåðâàë íà îáðàáîòêó ñîáûòèé êëàâèàòóðû, ìûøè, òà÷ïàäà. È ðåãèñòðèðóåì ïðîöåäóðó.
+  //     Âûçûâàòü zgl_SetEventInterval íå îáÿçàòåëüíî. Çíà÷åíèå 16 ñòîèò ïî óìîë÷àíèþ.
+  // EN: We set the interval for processing keyboard, mouse, touchpad events. And we register the procedure.
+  //     Calling zgl_SetEventInterval is optional. The default is 16.
+  zgl_SetEventsInterval(16);
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
+
   // RU: Ñîçäàåì òàéìåð ñ èíòåðâàëîì 1000ìñ.
   // EN: Create a timer with interval 1000ms.
   TimeStart := timer_Add(@Timer, 1000, Start);

+ 4 - 4
Zengl_SRC/demos/Delphi/02 - Resources/demo02.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/02 - Resources/demo02.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 10 - 21
Zengl_SRC/demos/Delphi/02 - Resources/demo02.dpr

@@ -5,9 +5,6 @@ program demo02;
 {$R *.res}
 
 uses
-{$IFDEF UNIX}
-  cthreads,
-{$ENDIF}
   Classes,
 
   zgl_types,
@@ -70,9 +67,6 @@ var
   i: Integer;
   memStream: TMemoryStream;
 begin
-  file_SetPath('');           // âûñòàâëÿåì äèððåêòîðèþ äëÿ ðàáîòû äåìî-âåðñèé
-  // â âàøåì ðàáî÷åì ïðîåêòå âûñòàâëÿòü íå íàäî!!!
-
   // RU: Áîëåå äåòàëüíîå ðàññìîòðåíèå ïàðàìåòðîâ ôóíêöèé çàãðóçêè ðåñóðñîâ åñòü â ñîîòâåòñòâóþùèõ ïðèìåðàõ, òóò æå ïîêàçàíà ëèøü îñíîâíàÿ ñóòü.
   // EN: Description with more details about parameters of functions can be found in other demos, here is only main idea shown.
   snd_Init();
@@ -106,12 +100,11 @@ begin
   // EN: Loading resources from files in memory need additional set their extension.
   //     As an example TMemoryStream will be used instead of mem_LoadFromFile/mem_Free, just for showing how zglTMemory works.
   memStream := TMemoryStream.Create();
-{$IFNDEF MACOSX}
+  {$IFNDEF MACOSX}
   memStream.LoadFromFile(dirRes + 'back01.jpg');
-{$ELSE}
-  memStream.LoadFromFile(PAnsiChar(zgl_Get(DIRECTORY_APPLICATION)) +
-    'Contents/Resources/back01.jpg');
-{$ENDIF}
+  {$ELSE}
+  memStream.LoadFromFile(PAnsiChar(zgl_Get(DIRECTORY_APPLICATION)) + 'Contents/Resources/back01.jpg');
+  {$ENDIF}
   memory.Position := memStream.Position;
   memory.Memory := memStream.Memory;
   memory.Size := memStream.Size;
@@ -124,7 +117,9 @@ begin
   texLogo := tex_LoadFromFile('zengl.png');
   file_CloseArchive();
 
-  setTextScale(15, fntMain);                                            // âûñòàâëÿåì ðàçìåð øðèôòà
+  // RU: Óñòàíàâëèâàåì ðàçìåð øðèôòà fntMain (â ïèêñåëÿõ).
+  // EN: Set the fntMain font size (in pixels).
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -133,28 +128,22 @@ begin
   // EN: Resources which are loading in multithreaded mode can be used only after finishing the loading process. Code below renders loading screen if resources are not loaded yet.
   if res_GetCompleted() < 100 then
   begin
-    ssprite2d_Draw(texLogo, (800 - texLogo.Width) / 2, (600 - texLogo.Height) /
-      2, texLogo.Width, texLogo.Height, 0);
-    text_Draw(fntMain, 400, 300 + texLogo.Height / 4, 'Loading... ' +
-      u_IntToStr(res_GetCompleted()) + '%', TEXT_HALIGN_CENTER);
+    ssprite2d_Draw(texLogo, (800 - texLogo.Width) / 2, (600 - texLogo.Height) / 2, texLogo.Width, texLogo.Height, 0);
+    text_Draw(fntMain, 400, 300 + texLogo.Height / 4, 'Loading... ' + u_IntToStr(res_GetCompleted()) + '%', TEXT_HALIGN_CENTER);
     exit;
   end;
 
   ssprite2d_Draw(texTest, 0, 0, 800, 600, 0);
   text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-  text_Draw(fntMain, 0, 16, 'VRAM Used: ' +
-    u_FloatToStr(zgl_Get(RENDER_VRAM_USED) / 1024 / 1024) + 'Mb');
+  text_Draw(fntMain, 0, 16, 'VRAM Used: ' + u_FloatToStr(zgl_Get(RENDER_VRAM_USED) / 1024 / 1024) + 'Mb');
 end;
 
 begin
-
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
 
   wnd_SetCaption(utf8_Copy('02 - Resources'));
 
-  zgl_SetParam(800, 600, false, false);
-
   zgl_Init();
 end.
 

+ 4 - 4
Zengl_SRC/demos/Delphi/03 - Input/demo03.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/03 - Input/demo03.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 108 - 17
Zengl_SRC/demos/Delphi/03 - Input/demo03.dpr

@@ -1,6 +1,7 @@
 program demo03;
 
 {$I zglCustomConfig.cfg}
+{.$I zgl_config.cfg}
 
 {$R *.res}
 
@@ -16,30 +17,106 @@ uses
   zgl_text,
   zgl_textures_png,
   zgl_types,
+  {$IfDef OLD_METHODS}
   zgl_collision_2d,
+  {$Else}
+  gegl_VElements,
+  {$EndIf}
   zgl_utils
   ;
 
 var
   dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
 
-  fntMain   : Byte;
+  fntMain, fntEdit: Byte;
 
   joyCount   : Integer;
+  // RU: ñòðîêà äëÿ ïîëó÷åíèÿ çíà÷åíèÿ èç ïîëÿ ââîäà
+  // EN: string to get value from input field
   userInput  : UTF8String;
+  {$IfDef OLD_METHODS}
   trackInput : Boolean;
   inputRect  : zglTRect;
   lineAlpha  : Byte;
+
   TimeStart  : Byte;
+  {$Else}
+  // RU: ïðÿìîóãîëüíèê, îïèñûâàþùèé ïîëå ââîäà
+  // EN: rectangle describing the input field
+  myRect: zglTRect;
+
+  // "ïåðåïèñü" ïîëåé ââîäà äëÿ òîãî, ÷òîá çíàòü ñ êàêèì ïîëåì ðàáîòàåì
+
+  // RU: îáúÿâëÿåì ïåðåìåííóþ äëÿ ðàáîòû ñ ïîëåì ââîäà
+  // EN: we declare a variable to work with the input field
+  myEdit, myEdit2: Word;
+  {$EndIf}
+
+
+{$IfNDef OLD_METHODS}
+// RU: ïðîðèñîâûâàåì îñíîâàíèå ïîëÿ ââîäà. Âñ¸ îãðàíè÷åíî ëèøü âàøèì âîîáðàæåíèåì. )))
+// EN: draw the base of the input field. Everything is limited only by your imagination. )))
+procedure EditCont;
+begin
+  // RU: ïðè ïðîðèñîâêå ïîëÿ ââîäà, ñìåùåíèå è ïîâîðîò óæå áóäóò ñäåëàíû. ß ïîêàçûâàþ êàê íàðèñîâàòü ðàìêó.
+  // Òåêñò áóäåò âûâåäåí ïîâåðõ òîãî, ÷òî âû òóò íàðèñóåòå.
+  // EN: displacement and rotation will be done prior to performing the procedure. I am showing you how to draw a frame.
+  // The text will be drawn on top of what you draw here.
+  pr2d_Rect(- 2, - 1, myRect.W + 5, myRect.H, $FFFFFF, 128, PR2D_FILL);
+end;
+{$EndIf}
 
 procedure Init;
+{$IfNDef OLD_METHODS}
+var
+  TextColor: zglTColor;
+{$EndIf}
 begin
   fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-
+  {$IfNDef OLD_METHODS}
+  // RU: Çàãðóæàåì äàííûå î øðèôòå.
+  // EN: Load the font.
+  fntEdit := font_LoadFromFile( dirRes + 'CalibriBold50pt.zfi');
+  // RU: óêàçûâàåì ðàçìåðû øðèôòîâ
+  // EN: set font sizes
+  setFontTextScale(15, fntMain);
+  setFontTextScale(20, fntEdit);
+  // RU: óêàçûâàåì ðàçìåðû ïîëÿ ââîäà
+  // EN: specify the size of the input field
+  myRect.X := 200;
+  myRect.Y := 150;
+  myRect.W := 200;
+  myRect.H := 33;
+  // RU: óêàçûâàåì òî÷êó âðàùåíèÿ, â äàííîì ñëó÷àå öåíòð ïîëÿ ââîäà(ïî íåîáõîäèìîñòè) è óãîë ïîâîðîòà(íàïðèìåð 45)
+  // EN: specify the point of rotation, in this case the center of the input field (if necessary) and the angle of rotation (for example 45)
+  SetOfRotateAngleAndPoint(myRect.x + myRect.W / 2, myRect.y + myRect.H / 2, 30);
+  // RU: óêàçûâàåì öâåò òåêñòà
+  // EN: specify the color of the text
+  TextColor.R := 0.1;
+  TextColor.G := 0.5;
+  TextColor.B := 0.3;
+  TextColor.A := 1;            // max = 1, min = 0
+  // RU: ïåðåäà¸ì öâåò â äàííûå ìåíåäæåðà
+  // EN: transfer the color to the manager data
+  SetColorElementText(@TextColor);
+  // RU: ñîçäà¸ì ñàìî ïîëå ââîäà ñ äàííûìè óêàçàííûìè âûøå
+  // EN: create the input field itself with the data specified above
+  myEdit := CreateEdit(myRect, fntEdit, 20, @EditCont);
+
+  // RU: êîððåêòèðóåì êóðñîð.
+  // EN: adjust the cursor
+//  CorrectEditCursor(myEdit, 3);
+
+  // RU: çàäà¸ì î÷èñòêó ýêðàíà çàäàííûì öâåòîì
+  // EN: set the screen to clear with a specified color
+  scr_SetClearColor(true, $7090af);
+
+  {$Else}
   inputRect.X := 400 - 192;
   inputRect.Y := 300 - 100 - 32;
   inputRect.W := 384;
   inputRect.H := 96;
+  {$EndIf}
 
   // RU: Èíèöèàëèçèðóåì îáðàáîòêó ââîäà äæîéñòèêîâ è ïîëó÷àåì êîëè÷åñòâî ïîäêëþ÷åííûõ äæîéñòèêîâ.
   // EN: Initialize processing joystick input and get count of plugged joysticks.
@@ -47,17 +124,18 @@ begin
 end;
 
 procedure Draw;
-  var
-    w : Single;
+{$IfDef OLD_METHODS}
+var
+  w : Single;
+{$EndIf}
 begin
-  // ðàçìåðû øðèòà
-  setTextScale(15, fntMain);
   text_Draw(fntMain, 0, 0, 'Escape - Exit');
 
   // RU: Êîîðäèíàòû ìûøè ìîæíî ïîëó÷èòü ïðè ïîìîùè ôóíêöèé mouse_X è mouse_Y.
   // EN: Mouse coordinates can be got using functions mouse_X and mouse_Y.
   text_Draw(fntMain, 0, 16, 'Mouse X, Y: ' + u_IntToStr(mouseX) + '; ' + u_IntToStr(mouseY));
 
+  {$IfDef OLD_METHODS}
   // RU: Âûâîäèì ââåä¸ííûé ïîëüçîâàòåëåì òåêñò.
   // EN: Show the inputted text.
   pr2d_Rect(inputRect.X, inputRect.Y, inputRect.W, inputRect.H, $FFFFFF, 255);
@@ -69,7 +147,12 @@ begin
   end else
     text_Draw(fntMain, 400, 300 - 100, 'Click here to enter text(maximum - 24 symbols):', TEXT_HALIGN_CENTER);
   text_Draw(fntMain, 400, 300 - 70, userInput, TEXT_HALIGN_CENTER);
-
+  {$Else}
+  text_Draw(fntMain, 0, 36, 'Press F5 to copy from Edit and draw');  // êàêîé ÿ íàôèã àíãëè÷àíèí? ))))
+  text_Draw(fntMain, 0, 54, 'Press F12 - Rus/Eng');
+  if userInput <> '' then
+    text_Draw(fntMain, 400, 300 - 70, userInput, TEXT_HALIGN_CENTER);
+  {$EndIf}
 
   // RU: Âûâîä ñîñòîÿíèÿ îñåé è êíîïîê ïåðâîãî äæîéñòèêà â ñèñòåìå.
   // EN: Show the state of axes and buttons of first joystick in the system.
@@ -102,13 +185,20 @@ begin
   text_Draw(fntMain, 550, 540, 'Button16: ' + u_BoolToStr(joy_Down(0, 15)));
 end;
 
+
 procedure Timer;
 begin
+(*        // ðàññêîììåòèðîâàòü, åñëè õîòèòå èñïîëüçîâàòü ñòàðûé ñïîñîá
   if lineAlpha > 5 Then
     DEC(lineAlpha, 10)
   else
     lineAlpha := 255;
+  *)
+end;
 
+procedure KeyMouseEvent;
+begin
+  {$IfDef OLD_METHODS}
   // RU: Ïðîâåðèòü íàæàòà ëè ëåâàÿ êíîïêà ìûøè â ïðåäåëàõ inputRect è íà÷àòü îòñëåæèâàòü ââîä òåêñòà.
   // EN: Check if left mouse button was pressed inside inputRect and start to track text input.
   if mBClickCanClick(M_BLEFT_CLICK) and col2d_PointInRect(mouseX, mouseY, inputRect) Then
@@ -129,21 +219,22 @@ begin
   // EN: Get inputted by user text.
   if trackInput Then
     userInput := key_GetText();
-
-  // RU: Ïî íàæàòèþ Escape çàâåðøèòü ïðèëîæåíèå.
-  // EN: If Escape was pressed - shutdown the application.
-//  if key_Press(K_ESCAPE) Then winOn := false;                áîëüøå íå íàäî ïðîâåðÿòü, ïî óìîë÷àíèþ ñòîèò, ìîæíî îòêëþ÷èòü â äåôàéíàõ
-
-  // RU: Îáÿçàòåëüíî î÷èùàåì ñîñòîÿíèÿ âñåõ ïîäñèñòåì ââîäà.
-  // EN: Necessarily clear all the states of input subsystems.
-  mouse_ClearState();
-  key_ClearState();
-  joy_ClearState();
+  {$Else}
+  // RU: ïî íàæàòèþ F5 êîïèðóåì òî, ÷òî íàïèñàíî â ïîëå ââîäà
+  // EN: by pressing F5, copy what is written in the input field
+  if keysDown[K_F5] then
+  begin
+    userInput := GetEditToText(myEdit);
+  end;
+  {$EndIf}
 end;
 
 Begin
+  {$IfDef OLD_METHODS}
   TimeStart := timer_Add(@Timer, 16, Start);
+  {$EndIf}
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
 

+ 4 - 4
Zengl_SRC/demos/Delphi/04 - Screen Settings/demo04.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/04 - Screen Settings/demo04.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 4 - 9
Zengl_SRC/demos/Delphi/04 - Screen Settings/demo04.dpr

@@ -23,13 +23,12 @@ var
 
   fntMain : Byte;
   texBack : zglPTexture;
-  TimeStart: Byte;
 
 procedure Init;
 begin
   fntMain := font_LoadFromFile(dirRes + 'font.zfi');
   texBack := tex_LoadFromFile(dirRes + 'back03.jpg');
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -43,7 +42,7 @@ begin
   text_Draw(fntMain, 0, 20 * 4, 'F4 - Windowed mode');
 end;
 
-procedure Timer;
+procedure KeyMouseEvent;
 begin
   // RU: Ðåêîìåíäóåìûé ê èñïîëüçîâàíèþ ïîëíîýêðàííûé ðåæèì. Îñíîâíàÿ èäåÿ - ïåðåêëþ÷èòüñÿ â ïîëíîýêðàííûé ðåæèì
   // èñïîëüçóÿ òåêóùåå ðàçðåøåíèå ðàáî÷åãî ñòîëà ïîëüçîâàòåëÿ, íî ïðè ýòîì
@@ -79,7 +78,7 @@ begin
     wndHeight := zgl_Get(DESKTOP_HEIGHT);
     wndFullScreen := true; }
     zgl_SetParam(zgl_Get(DESKTOP_WIDTH), zgl_Get(DESKTOP_HEIGHT), True, false);
-     scr_SetOptions();
+    scr_SetOptions();
   end;
 
   // RU: Ïåðåêëþ÷åíèå â ïîëíîýêðàííûé ðåæèì èñïîëüçóÿ óêàçàííûå ðàçìåðû.  íàøå âðåìÿ òàêîé ïîäõîä èìååò äâà áîëüøèõ íåäîñòàòêà íà LCD:
@@ -110,14 +109,10 @@ begin
     zgl_SetParam(800, 600, False, false);
     scr_SetOptions();
   end;
-
-//  if key_Press(K_ESCAPE) Then winOn := false;     // ïî óìîë÷àíèþ
-
-  key_ClearState();
 end;
 
 Begin
-  TimeStart := timer_Add( @Timer, 16, Start );
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
 
   zgl_Reg( SYS_LOAD, @Init );
   zgl_Reg( SYS_DRAW, @Draw );

+ 4 - 4
Zengl_SRC/demos/Delphi/05 - Primitives/demo05.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/05 - Primitives/demo05.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 7 - 7
Zengl_SRC/demos/Delphi/05 - Primitives/demo05.dpr

@@ -47,10 +47,6 @@ begin
   // EN: Render circle in the center of screen with radius 128 pixels.
   pr2d_Circle( 400, 300, 128, $000000, 155, 32, PR2D_FILL );
 
-  INC( calc );
-  if calc > 359 Then calc := 0;
-  points[ calc ].X := 400 + m_Cos( calc ) * ( 96 + random( 32 ) );
-  points[ calc ].Y := 300 + m_Sin( calc ) * ( 96 + random( 32 ) );
   // RU: Ðèñóåì ëèíèè âíóòðè êðóãà.
   // EN: Render lines inside the circle.
 
@@ -59,16 +55,20 @@ begin
 
   // RU: Ðèñóåì ýëëèïñû ñ çàëèâêîé è áåç, ñî ñãëàæåííûìè êîíòóðàìè(ôëàã PR2D_SMOOTH).
   // EN: Render filled ellipses with smoothed edges(flag PR2D_SMOOTH).
-  pr2d_Ellipse( 400 + 300, 300, 64, 256, $FFFFFF, 128, 32, PR2D_FILL or PR2D_SMOOTH );
+  pr2d_Ellipse( 400 + 300, 300, 64, 256, $FFFFFF, 75, 32, PR2D_FILL {or PR2D_SMOOTH });
   pr2d_Ellipse( 400 + 300, 300, 64, 256, $000000, 255, 32, PR2D_SMOOTH );
 
-  pr2d_Ellipse( 400 - 300, 300, 64, 256, $FFFFFF, 128, 32, PR2D_FILL or PR2D_SMOOTH );
+  pr2d_Ellipse( 400 - 300, 300, 64, 256, $FFFFFF, 75, 32, PR2D_FILL or PR2D_SMOOTH );
   pr2d_Ellipse( 400 - 300, 300, 64, 256, $000000, 255, 32, PR2D_SMOOTH );
 end;
 
 procedure Timer;
 begin
-  key_ClearState();
+  INC( calc );
+  if calc > 359 Then
+    calc := 0;
+  points[ calc ].X := 400 + m_Cos( calc ) * ( 96 + random( 32 ) );
+  points[ calc ].Y := 300 + m_Sin( calc ) * ( 96 + random( 32 ) );
 end;
 
 Begin

+ 4 - 4
Zengl_SRC/demos/Delphi/06 - Text/demo06.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL;"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL;"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL;"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL;"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/06 - Text/demo06.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL;
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL;
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 3 - 15
Zengl_SRC/demos/Delphi/06 - Text/demo06.dpr

@@ -18,17 +18,14 @@ uses
   zgl_text,
   zgl_types,
   zgl_utils,
-  AsctoUtf;             // äëÿ ïåðåâîäà òåêñòà â UTF-8
+  gegl_utils;             // äëÿ ïåðåâîäà òåêñòà â UTF-8
 
 var
   dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
   fntMain : Byte;
-  TimeStart: Byte;
   MyText: UTF8String;
 
 procedure Init;
-  //var
-  //  i : Integer;
 begin
   // RU: Çàãðóæàåì äàííûå î øðèôòå.
   // EN: Load the font.
@@ -52,10 +49,8 @@ begin
   // EN: ZenGL works only with UTF-8 encoding, so all text should be encoded with UTF-8. If you want to write some text(not English) using strings
   //     inside pas-files and version of Delphi is lower than 2009, then you need to use external files with UTF-8 strings inside and type UTF8String.
 
-  setTextScale(20, fntMain);                                    // øðèôò ðàçìåðíîñòü 20 pix
-  text_Draw( fntMain, 400, 65, 'Scaling', TEXT_HALIGN_CENTER );
 
-  setTextScale(15, fntMain);                                    // øðèôò ðàçìåðíîñòü 15 pix
+  text_DrawEx( fntMain, 400, 65, 3, 0, 'Scaling', 255, $FFFFFF, TEXT_HALIGN_CENTER );
 
   text_Draw( fntMain, 400, 25, 'String with center alignment', TEXT_HALIGN_CENTER );
 
@@ -66,7 +61,7 @@ begin
   r.Y := 300 - 128;
   r.W := 192;
   r.H := 256;
-  text_DrawInRect( fntMain, r, 'Simple text rendering in rectangle. ' + MyText);
+  text_DrawInRect( fntMain, r, 'Simple text rendering in rectangle. ' + #10 + MyText);
   pr2d_Rect( r.X, r.Y, r.W, r.H, $FF0000 );
 
   r.X := 800 - 192;
@@ -101,16 +96,9 @@ begin
 //  batch2d_End();
 end;
 
-procedure Timer;
-begin
-  key_ClearState();
-end;
-
 Begin
   randomize();
 
-  TimeStart := timer_Add( @Timer, 16, Start );
-
   zgl_Reg( SYS_LOAD, @Init );
   zgl_Reg( SYS_DRAW, @Draw );
 

+ 4 - 4
Zengl_SRC/demos/Delphi/07 - Sprites/demo07.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/07 - Sprites/demo07.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 10 - 8
Zengl_SRC/demos/Delphi/07 - Sprites/demo07.dpr

@@ -30,8 +30,8 @@ type
 end;
 
 var
-  dirRes      : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};    // äèðåêòîðèÿ ðåñóðñîâ
-  fntMain     : Byte;                                             // ýòî ôîíò
+  dirRes      : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain     : Byte;
   texLogo     : zglPTexture;
   texBack     : zglPTexture;
   texGround   : zglPTexture;
@@ -92,7 +92,11 @@ begin
   // RU: Çàãðóæàåì øðèôò.
   // EN: Load the font.
   fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
+
+  // RU: Óñòàíàâëèâàåì FPS.
+  // EN: Set FPS.
+  scr_SetFPS(60);
 end;
 
 procedure Draw;
@@ -222,26 +226,24 @@ begin
 
   camMain.Angle := camMain.Angle + cos(time / 1000) / 10;
 
-  for i := 0 to 20 do                       // êàäðû
+  for i := 0 to 20 do
     begin
       INC(tux[i].Frame );
       if tux[i].Frame > 20 Then
         tux[i].Frame := 2;
     end;
-  for i := 0 to 9 do                        // ñìåùåíèå â îäíó ñòîðîíó
+  for i := 0 to 9 do
     begin
       tux[i].Pos.X := tux[i].Pos.X + 1.5;
       if tux[i].Pos.X > 864 Then
         tux[i].Pos.X := - 96;
     end;
-  for i := 10 to 19 do                      // ñìåùåíèå â äðóãóþ ñòîðîíó
+  for i := 10 to 19 do                      
     begin
       tux[i].Pos.X := tux[i].Pos.X - 1.5;
       if tux[i].Pos.X < - 96 Then
         tux[i].Pos.X := 864;
     end;
-
-  key_ClearState();
 end;
 
 Begin

+ 4 - 4
Zengl_SRC/demos/Delphi/08 - Sprite Engine/demo08.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/08 - Sprite Engine/demo08.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 17 - 12
Zengl_SRC/demos/Delphi/08 - Sprite Engine/demo08.dpr

@@ -133,12 +133,11 @@ begin
 //    AddMiku();
 
   fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
 begin
-//  batch2d_Begin();
   // RU: Ðèñóåì âñå ñïðàéòû íàõîäÿùèåñÿ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
   // EN: Render all sprites contained in current sprite engine.
   if time > 255 Then
@@ -149,35 +148,38 @@ begin
   else
     if time < 510 Then
       begin
-        pr2d_Rect(0, 0, 800, 600, $000000, 510 - time, PR2D_FILL);
+        pr2d_Rect(0, 0, 800, 600, $AFAFAF, 510 - time, PR2D_FILL);
         ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time);
       end;
 
   if time > 255 Then
     begin
-      pr2d_Rect(0, 0, 256, 64, $000000, 200, PR2D_FILL);
+      pr2d_Rect(0, 0, 256, 64, $80A080, 200, PR2D_FILL);
       text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
       text_Draw(fntMain, 0, 20, 'Sprites: ' + u_IntToStr(sengine2d.Count));
       text_Draw(fntMain, 0, 40, 'Up/Down - Add/Delete Miku :)');
     end;
-//  batch2d_End();
 end;
 
 procedure Timer;
 begin
-  INC(time, 2);
+  INC(time);
 
   // RU: Âûïîëíÿåì îáðàáîòêó âñåõ ñïðàéòîâ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
   // EN: Process all sprites contained in current sprite engine.
   sengine2d_Proc();
+end;
 
+procedure KeyMouseEvent;
+begin
   // RU: Ïî íàæàòèþ ïðîáåëà î÷èñòèòü âñå ñïðàéòû.
   // EN: Delete all sprites if space was pressed.
-  if key_Press(K_SPACE) Then sengine2d_ClearAll();
-  if key_Press(K_UP) Then AddMiku();
-  if key_Press(K_DOWN) Then DelMiku();
-
-  key_ClearState();
+  if key_Press(K_SPACE) Then
+    sengine2d_ClearAll();
+  if key_Press(K_UP) Then
+    AddMiku();
+  if key_Press(K_DOWN) Then
+    DelMiku();
 end;
 
 procedure Quit;
@@ -192,8 +194,11 @@ Begin
   randomize;
 
   TimeStart := timer_Add(@Timer, 16, Start);
-  TimeMiku := timer_Add(@AddMiku, 1000, SleepToStart, 10);
+  // RU: Òàéìåð ñ çàäåðæêîé â 6 ñåêóíä.
+  // EN: Timer with a 6 second delay.
+  TimeMiku := timer_Add(@AddMiku, 1000, SleepToStart, 6);
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
   zgl_Reg(SYS_EXIT, @Quit);

+ 4 - 4
Zengl_SRC/demos/Delphi/09 - Sprite Engine(Classes)/demo09.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/09 - Sprite Engine(Classes)/demo09.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 19 - 12
Zengl_SRC/demos/Delphi/09 - Sprite Engine(Classes)/demo09.dpr

@@ -138,51 +138,57 @@ begin
 //    AddMiku();
 
   fntMain := font_LoadFromFile(dirRes + 'font.zfi');
+
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
 begin
-  setTextScale(15, fntMain);
-//  batch2d_Begin();
   // RU: Ðèñóåì âñå ñïðàéòû íàõîäÿùèåñÿ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
   // EN: Render all sprites contained in current sprite engine.
   if time > 255 Then
     sengine2d.Draw();
 
   if time <= 255 Then
+  begin
+    pr2d_Rect(0, 0, 800, 600, $7FAF7F, 255, PR2D_FILL);
     ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, time)
+  end
   else
     if time < 510 Then
       begin
-        pr2d_Rect(0, 0, 800, 600, $000000, 510 - time, PR2D_FILL);
+        pr2d_Rect(0, 0, 800, 600, $AFAFAF, 510 - time, PR2D_FILL);
         ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time);
       end;
 
   if time > 255 Then
     begin
-      pr2d_Rect(0, 0, 256, 64, $000000, 200, PR2D_FILL);
+      pr2d_Rect(0, 0, 256, 64, $80A080, 200, PR2D_FILL);
       text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
       text_Draw(fntMain, 0, 20, 'Sprites: ' + u_IntToStr(sengine2d.Count));
       text_Draw(fntMain, 0, 40, 'Up/Down - Add/Delete Miku :)');
     end;
-//  batch2d_End();
 end;
 
 procedure Timer;
 begin
-  INC(time, 2);
+  INC(time);
 
   // RU: Âûïîëíÿåì îáðàáîòêó âñåõ ñïðàéòîâ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
   // EN: Process all sprites contained in current sprite engine.
   sengine2d.Proc();
+end;
 
+procedure KeyMouseEvent;
+begin
   // RU: Ïî íàæàòèþ ïðîáåëà î÷èñòèòü âñå ñïðàéòû.
   // EN: Delete all sprites if space was pressed.
-  if key_Press(K_SPACE) Then sengine2d.ClearAll();
-  if key_Press(K_UP) Then AddMiku();
-  if key_Press(K_DOWN) Then DelMiku();
-
-  key_ClearState();
+  if key_Press(K_SPACE) Then
+    sengine2d.ClearAll();
+  if key_Press(K_UP) Then
+    AddMiku();
+  if key_Press(K_DOWN) Then
+    DelMiku();
 end;
 
 procedure Quit;
@@ -196,8 +202,9 @@ Begin
   randomize();
 
   TimeStart := timer_Add( @Timer, 16, Start );
-  TimeMiku := timer_Add( @AddMiku, 1000, SleepToStart, 10 );
+  TimeMiku := timer_Add( @AddMiku, 1000, SleepToStart, 6 );
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
   zgl_Reg(SYS_EXIT, @Quit);

+ 4 - 4
Zengl_SRC/demos/Delphi/10 - Tiles/demo10.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/10 - Tiles/demo10.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 1 - 11
Zengl_SRC/demos/Delphi/10 - Tiles/demo10.dpr

@@ -26,7 +26,6 @@ var
   fntMain : Byte;
   map     : zglTTiles2D;
   texTiles: zglPTexture;
-  TimeStart: Byte;
 
 procedure Init;
   var
@@ -57,7 +56,7 @@ begin
   for i := 0 to map.X - 1 do
     file_Read(f, map.Tiles[i, 0], map.Y * SizeOf(Integer));
   file_Close(f);
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -71,18 +70,9 @@ begin
   text_Draw(fntMain, 180, 30, 'This is a tarrible example of tile map, but main idea should be clear :)');
 end;
 
-procedure Timer;
-begin
-//  if key_Press(K_ESCAPE) Then winOn := FALSE;
-
-  key_ClearState();
-end;
-
 Begin
   randomize();
 
-  TimeStart := timer_Add(@Timer, 16, Start);
-
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
 

+ 4 - 4
Zengl_SRC/demos/Delphi/11 - Grid/demo11.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/11 - Grid/demo11.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 1 - 3
Zengl_SRC/demos/Delphi/11 - Grid/demo11.dpr

@@ -48,7 +48,7 @@ begin
         grid.Grid[i, j].Y := j * 40;
       end;
 
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -84,8 +84,6 @@ begin
         grid.Grid[i, j].Y := j * 40 - swave;
       end;
     end;
-
-  key_ClearState();
 end;
 
 Begin

+ 4 - 4
Zengl_SRC/demos/Delphi/12 - Render into Texture/demo12.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/12 - Render into Texture/demo12.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 1 - 9
Zengl_SRC/demos/Delphi/12 - Render into Texture/demo12.dpr

@@ -27,7 +27,6 @@ var
   texTux   : zglPTexture;
   rtFull   : zglPRenderTarget;
   rtDefault: zglPRenderTarget;
-  TimeStart: Byte;
 
 procedure Init;
 begin
@@ -46,7 +45,7 @@ begin
   // EN: Create one more RenderTarget with flag RT_DEFAULT for comparison.
   rtDefault := rtarget_Add(tex_CreateZero(256, 256), RT_DEFAULT);
 
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -73,16 +72,9 @@ begin
   text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
 end;
 
-procedure Timer;
-begin
-  key_ClearState();
-end;
-
 Begin
   randomize();
 
-  TimeStart := timer_Add(@Timer, 16, Start);
-
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
 

+ 5 - 5
Zengl_SRC/demos/Delphi/13 - Particles/demo13.cfg

@@ -32,13 +32,13 @@
 -$M16384,1048576
 -K$00400000
 -E"../../../bin/i386-win32"
--N"../tmp"
+-N"..\tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 16 - 7
Zengl_SRC/demos/Delphi/13 - Particles/demo13.dof

@@ -91,10 +91,10 @@ ImageBase=4194304
 ExeDescription=
 [Directories]
 OutputDir=../../../bin/i386-win32
-UnitOutputDir=../tmp
+UnitOutputDir=..\tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,17 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=2
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+Item1=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+[HistoryLists\hlUnitOutputDirectory]
+Count=2
+Item0=..\tmp
+Item1=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 5 - 11
Zengl_SRC/demos/Delphi/13 - Particles/demo13.dpr

@@ -68,15 +68,13 @@ begin
   emitterRain := emitter2d_LoadFromFile(dirRes + 'emitter_rain.zei');
   pengine2d_AddEmitter(emitterRain, nil);
 
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
   var
     i: Integer;
 begin
-  batch2d_Begin();
-
   ssprite2d_Draw(texBack, 0, 0, 800, 600, 0);
 
   // EN: Rendering of all emitters in current particles engine.
@@ -91,15 +89,12 @@ begin
   text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
   text_Draw(fntMain, 0, 20, 'Particles: ' + u_IntToStr(particles.Count.Particles));
   text_Draw(fntMain, 0, 40, 'Debug(F1): ' + u_BoolToStr(debug));
-
-  batch2d_End();
 end;
 
-procedure Timer;
+procedure KeyMouseEvent;
 begin
-  if key_Press(K_F1) Then debug := not debug;
-
-  key_ClearState();
+  if key_Press(K_F1) Then
+    debug := not debug;
 end;
 
 procedure Update(dt: Double);
@@ -120,8 +115,7 @@ end;
 Begin
   randomize();
 
-  TimeStart := timer_Add(@Timer, 16, Start);
-
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
   zgl_Reg(SYS_UPDATE, @Update);

+ 4 - 4
Zengl_SRC/demos/Delphi/14 - Sound/demo14.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/14 - Sound/demo14.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 25 - 24
Zengl_SRC/demos/Delphi/14 - Sound/demo14.dpr

@@ -43,6 +43,7 @@ var
   // äîáàâëÿåì íîìåð çâóêà, ïîêà äëÿ îäíîãî çâóêà
   IDSound: Integer;
   TimeStart: Byte;
+  p : Integer;
 
 // RU: Ò.ê. çâóêîâàÿ ïîäñèñòåìà íàöåëåíà íà 3D, äëÿ ïîçèöèîíèðîâàíèÿ çâóêîâ â 2D íóæíû íåêîòîðûå óõèùðåíèÿ.
 // EN: Because sound subsystem using 3D, there is some tricky way to calculate sound position in 2D.
@@ -72,7 +73,7 @@ begin
   icon[1] := tex_LoadFromFile(dirRes + 'audio-play.png');
 
   fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -95,9 +96,6 @@ begin
 end;
 
 procedure Timer;
-  var
-    r: zglTRect;
-    p: Integer;
 begin
   // RU: Ïðîâåðÿåì èãðàåò ëè ìóçûêà(1 - èãðàåò, 0 - íå èãðàåò). Òàê æå ìîæíî ïðîâåðèòü è çâóêè - ïîäñòàâèâ zglPSound è ID âîò òàê:
   //     snd_Get(Sound, ID...
@@ -106,10 +104,23 @@ begin
   // EN: Check if music playing(1 - playing, 0 - not playing). Sounds also can be checked this way - just use zglPSound and ID:
   //     snd_Get(Sound, ID...
   //     ID returns by function snd_Play.
-  state := snd_Get(SND_STREAM, audio, SND_STATE_PLAYING);
+  state := snd_Get( SND_STREAM, audio, SND_STATE_PLAYING );
   if state = 0 Then
     audio := 0;
 
+  // RU: Ïîëó÷àåì â ïðîöåíòàõ ïîçèöèþ ïðîèãðûâàíèÿ àóäèîïîòîêà è ñòàâèì ãðîìêîñòü äëÿ ïëàâíûõ ïåðåõîäîâ.
+  // EN: Get position in percent's for audio stream and set volume for smooth playing.
+  p := snd_Get( SND_STREAM, audio, SND_STATE_PERCENT );
+  if ( p >= 0 ) and ( p < 25 ) Then
+    snd_SetVolume( SND_STREAM, audio, ( 1 / 24 ) * p );
+  if ( p >= 75 ) and ( p < 100 ) Then
+    snd_SetVolume( SND_STREAM, audio, 1 - ( 1 / 24 ) * ( p - 75 ) );
+end;
+
+procedure KeyMouseEvent;
+var
+    r : zglTRect;
+begin
   if mBClickCanClick(M_BLEFT_CLICK) Then
   begin
       // RU:  äàííîì ñëó÷àå ìû íà÷èíàåì âîñïðîèçâîäèòü çâóê ñðàçó â óêàçàííûõ êîîðäèíàòàõ, íî èõ ìîæíî ìåíÿòü è â ïðîöåññå èñïîëüçóÿ ïðîöåäóðó snd_SetPos.
@@ -121,38 +132,27 @@ begin
 // ýòà ÷àñòü èçìåíåíà!!! Òåïåðü ìîæíî çàíîâî âîñïðîèçâîäèòü çâóêè, äàæå åñëè îíè íå çàêîí÷èëè èãðàòü.
     if snd_Get(sound, IDSound, SND_STATE_PLAYING) = IDSound then
       snd_Stop(sound, IDSound);
-    IDSound := snd_Play(sound, FALSE, CalcX2D(mouse_X), CalcY2D(mouse_Y));
+    IDSound := snd_Play(sound, FALSE, CalcX2D(mouseX), CalcY2D(mouseY));
 // ------------------------------------------------------------------------------------------
 
-    r.X := (SCREEN_WIDTH - 128) / 2;
-    r.Y := (SCREEN_HEIGHT - 128) / 2;
+    snd_Play( sound, FALSE, CalcX2D( mouse_X ), CalcY2D( mouse_Y ) );
+
+    r.X := ( SCREEN_WIDTH - 128 ) / 2;
+    r.Y := ( SCREEN_HEIGHT - 128 ) / 2;
     r.W := 128;
     r.H := 128;
 
 // äîáàâëÿåì ïðîâåðêó íà ïðîèãðûâàíèå çâóêà, òîëüêî åñëè ìíîãî ðàçâíûõ çâóêîâ/ìóçûêè, òî íîìåðà íàäî ìåíÿòü (íå òîëüêî 1!!!)
-    if col2d_PointInRect(mouse_X, mouse_Y, r) and (audio = 1) Then
+    if col2d_PointInRect(mouseX, mouseY, r) and (audio = 1) Then
     begin
       p := snd_Get(SND_STREAM, audio, SND_STATE_PLAYING);
       if p = 1 then
         snd_StopStream(audio);
     end;
 // ---------------------------------------------------------------------------------------------------------------
-
-    if col2d_PointInRect(mouse_X, mouse_Y, r) and (audio = 0) Then
-      audio := snd_PlayFile(dirRes + 'music.ogg');
-
+    if col2d_PointInRect( mouse_X, mouse_Y, r ) and ( audio = 0 ) Then
+      audio := snd_PlayFile( dirRes + 'music.ogg');
   end;
-
-  // RU: Ïîëó÷àåì â ïðîöåíòàõ ïîçèöèþ ïðîèãðûâàíèÿ àóäèîïîòîêà è ñòàâèì ãðîìêîñòü äëÿ ïëàâíûõ ïåðåõîäîâ.
-  // EN: Get position in percent's for audio stream and set volume for smooth playing.
-  p := snd_Get(SND_STREAM, audio, SND_STATE_PERCENT);
-  if (p >= 0) and (p < 25) Then
-    snd_SetVolume(SND_STREAM, audio, (1 / 24) * p);
-  if (p >= 75) and (p < 100) Then
-    snd_SetVolume(SND_STREAM, audio, 1 - (1 / 24) * (p - 75));
-
-  key_ClearState();
-  mouse_ClearState();
 end;
 
 Begin
@@ -160,6 +160,7 @@ Begin
 
   TimeStart := timer_Add(@Timer, 16, Start);
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
 

+ 4 - 4
Zengl_SRC/demos/Delphi/15 - Video/demo15.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 6
Zengl_SRC/demos/Delphi/15 - Video/demo15.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,8 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
-[Excluded Packages]
-c:\program files\borland\delphi7\Bin\dclnet70.bpl=Borland Internet Components
-c:\program files\borland\delphi7\Bin\dclsoap70.bpl=Borland SOAP Components
-c:\program files\borland\delphi7\Bin\dclwbm70.bpl=Borland InternetExpress Components
-c:\program files\borland\delphi7\Bin\dclwebsnap70.bpl=Borland WebSnap Components
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 3 - 7
Zengl_SRC/demos/Delphi/15 - Video/demo15.dpr

@@ -26,7 +26,6 @@ var
   fntMain  : Byte;
   video    : zglPVideoStream;
   videoSeek: Boolean;
-  TimeStart: Byte;
 
 procedure Init;
 begin
@@ -36,7 +35,7 @@ begin
   // RU: Îòêðûòü âèäåî ôàéë.
   video := video_OpenFile(dirRes + 'video.ogv');
 
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -60,7 +59,7 @@ begin
     end;
 end;
 
-procedure Timer;
+procedure KeyMouseEvent;
 begin
     // EN: If left mouse button is down on progress bar, then seek the video.
   // RU: Åñëè çàæàòà ëåâàÿ êíîïêà ìûøè íàä ïîëîñîé ïðîãðåññà - ïåðåìåùàòüñÿ ïî âèäåî.
@@ -70,9 +69,6 @@ begin
     video_Seek(video, (mouse_X / 800) * video.Info.Duration);
   end else
     videoSeek := FALSE;
-
-  key_ClearState();
-  mouse_ClearState();
 end;
 
 procedure Update(dt: Double);
@@ -84,7 +80,7 @@ end;
 Begin
   randomize();
 
-  TimeStart := timer_Add(@Timer, 16, Start);
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
 
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);

+ 4 - 4
Zengl_SRC/demos/Delphi/16 - Physics/demo16.cfg

@@ -35,10 +35,10 @@
 -N"../tmp"
 -LE"d:\program files (x86)\delphi7\Projects\Bpl"
 -LN"d:\program files (x86)\delphi7\Projects\Bpl"
--U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
--R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi"
+-U"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-O"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-I"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
+-R"../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL"
 -w-UNSAFE_TYPE
 -w-UNSAFE_CODE
 -w-UNSAFE_CAST

+ 13 - 1
Zengl_SRC/demos/Delphi/16 - Physics/demo16.dof

@@ -94,7 +94,7 @@ OutputDir=../../../bin/i386-win32
 UnitOutputDir=../tmp
 PackageDLLOutputDir=
 PackageDCPOutputDir=
-SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi
+SearchPath=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
 Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP
 Conditionals=
 DebugSourceDirs=
@@ -134,3 +134,15 @@ OriginalFilename=
 ProductName=
 ProductVersion=1.0.0.0
 Comments=
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
+[HistoryLists\hlSearchPath]
+Count=1
+Item0=../../../headers;../../../extra;../../../src;../../../lib/theora/delphi;../../../lib/zlib/delphi;../../../lib/zip/delphi;../../../srcGEGL
+[HistoryLists\hlUnitOutputDirectory]
+Count=1
+Item0=../tmp
+[HistoryLists\hlOutputDirectorry]
+Count=1
+Item0=../../../bin/i386-win32

+ 4 - 7
Zengl_SRC/demos/Delphi/16 - Physics/demo16.dpr

@@ -29,7 +29,7 @@ var
   bCount : Integer;
   Bodies : array of PcpBody;
   Shapes : array of PcpShape;
-  TimeStart: Byte;
+
   TimePhisics: Byte;
 
 // RU: Äîáàâèòü îáúåêò "øàð"
@@ -158,7 +158,7 @@ begin
   ground.u := u;
   cpSpaceAddStaticShape(space, ground);
 
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -174,7 +174,7 @@ begin
 //  batch2d_End();
 end;
 
-procedure Proc;
+procedure KeyMouseEvent;
 begin
   // ïðîâåðÿåì îäèíî÷íîå êàñàíèå ëåâîé èëè ïðàâîé êëàâèøè ìûøè
   if mBClickCanClick(M_BLEFT_CLICK) Then
@@ -186,9 +186,6 @@ begin
     if (mouseClickCanClick and M_BLEFT_CLICK) > 0 then
       cpAddBox(mouse_X() - 10, mouse_Y() - 10, 48, 32, 1, 0.5, 0.5);
   *)
-
-  key_ClearState();
-  mouse_ClearState();
 end;
 
 procedure Phisics;
@@ -213,9 +210,9 @@ Begin
   if not cpLoad(libChipmunk) Then exit;
   {$ENDIF}
 
-  TimeStart := timer_Add(@Proc, 16, Start);
   TimePhisics := timer_Add(@Phisics, 16, Start);
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
   zgl_Reg(SYS_EXIT, @Quit);

+ 1 - 1
Zengl_SRC/demos/FreePascal/01 - Initialization/Makefile

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL -Fu../../../extra -Fu../../../src
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 35 - 10
Zengl_SRC/demos/FreePascal/01 - Initialization/demo01.pas

@@ -5,17 +5,21 @@ program demo01;
 {$I zglCustomConfig.cfg}
 
 uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
   {$IFDEF USE_ZENGL_STATIC}
   // RU: При использовании статической компиляции необходимо подключать модули ZenGL содержащие необходимый функционал.
   // EN: Using static compilation needs to use ZenGL units with needed functionality.
-  zgl_screen,
   zgl_window,
+  zgl_screen,
   zgl_timers,
-  zgl_utils
+  zgl_utils,
+  zgl_log
   {$ELSE}
   // RU: Используя ZenGL в качестве библиотеки(so, dll или dylib) нужен всего один заголовочный файл.
   // EN: Using ZenGL as a shared library(so, dll or dylib) needs only one header.
-  zglHeader
+//  zglHeader
   {$ENDIF}
   ;
 
@@ -43,6 +47,8 @@ begin
   // EN: This function is the best way to implement smooth moving of something, because accuracy of timers are restricted by FPS.
 end;
 
+// RU: Пример использования таймера.
+// EN: An example of using a timer.
 procedure Timer;
 begin
   // RU: Будем в заголовке показывать количество кадров в секунду.
@@ -50,15 +56,25 @@ begin
   wnd_SetCaption( '01 - Initialization[ FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) + ' ]' );
 end;
 
+procedure KeyMouseEvent;
+begin
+  // RU: Функция обработки клавиатуры, мыши, джойстика и тачпада. Все события связанные с ними очищаются после её обработки.
+  //     Все попытки обработать клавиатуру, мышь или тачпад в других функциях могут привести к непредвиденным ситуациям.
+  // EN: Keyboard, mouse, joystick and touchpad handling function. All events associated with them are cleared after processing it.
+  //     Any attempt to handle the keyboard, mouse, or touchpad in other functions may lead to unexpected situations.
+end;
+
 procedure Quit;
 begin
- //
+  // RU: События которые надо произвести по завершению программы.
+  // EN: Events to be performed at the end of the program.
 end;
 
 Begin
+(*
   // RU: Код ниже загружает библиотеку если статическая компиляция не используется.
   // EN: Code below loads a library if static compilation is not used.
-(*  {$IFNDEF USE_ZENGL_STATIC}
+  {$IFNDEF USE_ZENGL_STATIC}
     {$IFDEF LINUX}
     // RU: В GNU/Linux все библиотеки принято хранить в /usr/lib, поэтому libZenGL.so должна быть предварительно установлена.
     // Но zglLoad сначала проверить есть ли libZenGL.so рядом с исполняемым файлом.
@@ -78,16 +94,24 @@ Begin
     // Also you must know, that log-file will be created in root directory, so you must disable a log, or choose your own path and name for it. How to do this you can find in documentation.
     if not zglLoad( libZenGL ) Then exit;
     {$ENDIF}
-  {$ENDIF}   *)
+  {$ENDIF}
+*)
 
   // RU: Для загрузки/создания каких-то своих настроек/профилей/etc. можно получить путь к домашенему каталогу пользователя, или к исполняемому файлу(не работает для GNU/Linux).
   // EN: For loading/creating your own options/profiles/etc. you can get path to user home directory, or to executable file(not works for GNU/Linux).
   DirApp  := utf8_Copy( PAnsiChar( zgl_Get( DIRECTORY_APPLICATION ) ) );
   DirHome := utf8_Copy( PAnsiChar( zgl_Get( DIRECTORY_HOME ) ) );
 
+  // RU: Устанавливаем интервал на обработку событий клавиатуры, мыши, тачпада. И регистрируем процедуру.
+  //     Вызывать zgl_SetEventInterval не обязательно. Значение 16 стоит по умолчанию.
+  // EN: We set the interval for processing keyboard, mouse, touchpad events. And we register the procedure.
+  //     Calling zgl_SetEventInterval is optional. The default is 16.
+  zgl_SetEventsInterval(16);
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
+
   // RU: Создаем таймер с интервалом 1000мс.
   // EN: Create a timer with interval 1000ms.
-  TimeStart := timer_Add( @Timer, 1000, start );
+  TimeStart := timer_Add( @Timer, 1000, Start );
 
   // RU: Регистрируем процедуру, что выполнится сразу после инициализации ZenGL.
   // EN: Register the procedure, that will be executed after ZenGL initialization.
@@ -104,16 +128,17 @@ Begin
 
   // RU: Устанавливаем заголовок окна.
   // EN: Set the caption of the window.
-  wnd_SetCaption( '01 - Initialization' );
-
+  wnd_SetCaption(utf8_Copy('01 - Initialization'));
   // RU: Разрешаем курсор мыши.
   // EN: Allow to show the mouse cursor.
-  wnd_ShowCursor( TRUE );
+  wnd_ShowCursor( TRUE );                        // по умолчанию стоит
 
   // RU: Указываем первоначальные настройки.
   // EN: Set screen options.
   zgl_SetParam(800, 600, false, false);
 
+  scr_SetOptions();                              // это тоже не обязательно вызывать, по умолчанию прописано при инициализации
+
   // RU: Инициализируем ZenGL.
   // EN: Initialize ZenGL.
   zgl_Init();

+ 0 - 0
Zengl_SRC/demos/FreePascal/01 - Initialization/demo01_macosx.plist


+ 0 - 0
Zengl_SRC/demos/FreePascal/01 - Initialization/fp___.out


+ 1 - 1
Zengl_SRC/demos/FreePascal/01 - Initialization/macosx_postbuild.sh

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 8 - 6
Zengl_SRC/demos/FreePascal/02 - Resources/demo02.pas

@@ -121,7 +121,9 @@ begin
   texLogo := tex_LoadFromFile( 'zengl.png' );
   file_CloseArchive();
 
-  setTextScale(15, fntMain);
+  // RU: Устанавливаем размер шрифта fntMain (в пикселях).
+  // EN: Set the fntMain font size (in pixels).
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -129,11 +131,11 @@ begin
   // RU: К ресурсам, которые загружаются в многопоточном режиме, можно обращаться только после завершения загрузки. Код ниже рисует экран загрузки если ресурсы ещё не загрузились.
   // EN: Resources which are loading in multithreaded mode can be used only after finishing the loading process. Code below renders loading screen if resources are not loaded yet.
   if res_GetCompleted() < 100 Then
-    begin
-      ssprite2d_Draw( texLogo, ( 800 - texLogo.Width ) / 2, ( 600 - texLogo.Height ) / 2, texLogo.Width, texLogo.Height, 0 );
-      text_Draw( fntMain, 400, 300 + texLogo.Height / 4, 'Loading... ' + u_IntToStr( res_GetCompleted() ) + '%', TEXT_HALIGN_CENTER );
-      exit;
-    end;
+  begin
+    ssprite2d_Draw( texLogo, ( 800 - texLogo.Width ) / 2, ( 600 - texLogo.Height ) / 2, texLogo.Width, texLogo.Height, 0 );
+    text_Draw( fntMain, 400, 300 + texLogo.Height / 4, 'Loading... ' + u_IntToStr( res_GetCompleted() ) + '%', TEXT_HALIGN_CENTER );
+    exit;
+  end;
 
   ssprite2d_Draw( texTest, 0, 0, 800, 600, 0 );
   text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );

+ 1 - 1
Zengl_SRC/demos/FreePascal/02 - Resources/demo02_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 102 - 19
Zengl_SRC/demos/FreePascal/03 - Input/demo03.pas

@@ -1,6 +1,7 @@
 program demo03;
 
 {$I zglCustomConfig.cfg}
+{$I zgl_config.cfg}
 
 uses
   {$IFDEF UNIX}
@@ -17,32 +18,102 @@ uses
   zgl_text,
   zgl_textures_png,
   zgl_types,
+  {$IfDef OLD_METHODS}
   zgl_collision_2d,
+  {$Else}
+  gegl_VElements,
+  {$EndIf}
   zgl_utils
   ;
 
 var
   dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
 
-  fntMain    : Byte;
+  fntMain, fntEdit: Byte;
 
   joyCount   : Integer;
+  // RU: строка для получения значения из поля ввода
+  // EN: string to get value from input field
   userInput  : UTF8String;
+  {$IfDef OLD_METHODS}
   trackInput : Boolean;
   inputRect  : zglTRect;
   lineAlpha  : Byte;
 
   TimeStart  : Byte;
+  {$Else}
+  // RU: прямоугольник описывающий поле ввода
+  // EN: rectangle describing the input field
+  myRect: zglTRect;
+
+  // "перепись" полей ввода для того, чтоб знать с каким полем работаем.
+  // RU: объявляем переменную для работы с полем ввода
+  // EN: we declare a variable to work with the input field
+  myEdit, myEdit2: Word;
+
+// RU: прорисовываем основание поля ввода. Всё ограничено только вашим воображением. )))
+// EN: draw the base of the input field. Everything is limited only by your imagination. )))
+procedure EditCont;
+begin
+  // RU: при прорисовке поля ввода, смешениt и поворот уже будут сделаны. Я показываю как нарисовать рамку.
+  // Текст будет выведен поверх того, что вы здесь нарисуете.
+  // EN: displacement and rotation will be done prior to performing the procedure. I am showing you how to draw a frame.
+  // The text will be drawn on top of what you draw here.
+  pr2d_Rect(- 2, - 1, myRect.W + 5, myRect.H, $FFFFFF, 128, PR2D_FILL);
+end;
+  {$EndIf}
 
 procedure Init;
+{$IfNDef OLD_METHODS}
+var
+  TextColor: zglTColor;
+{$EndIf}
 begin
   fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
-  setTextScale(15, fntMain);
-
+  {$IfNDef OLD_METHODS}
+  // RU: Загружаем данные о шрифте.
+  // EN: Load the font.
+  fntEdit := font_LoadFromFile( dirRes + 'CalibriBold50pt.zfi');
+  // RU: устанавливаем размеры шрифтов
+  // EN: set font sizes
+  setFontTextScale(15, fntMain);
+  setFontTextScale(20, fntEdit);
+  // RU: указываем размеры поля ввода
+  // EN: specify the size of the input field
+  myRect.X := 200;
+  myRect.Y := 150;
+  myRect.W := 200;
+  myRect.H := 33;
+  // RU: указываем точку вращения, в данном случае центр поля ввода (по необходимости) и угол поворота (например 45)
+  // EN: specify the point of rotation, in this case the center of the input field (if necessary) and the angle of rotation (for example 45)
+  SetOfRotateAngleAndPoint(myRect.x + myRect.W / 2, myRect.y + myRect.H / 2, 30);
+  // RU: указываем цвет текста
+  // EN: specify the color of the text
+  TextColor.R := 0.1;
+  TextColor.G := 0.5;
+  TextColor.B := 0.3;
+  TextColor.A := 1;            // max = 1, min = 0
+  // RU: передаём цвет в данные менеджера
+  // EN: transfer the color to the manager data
+  SetColorElementText(@TextColor);
+  // RU: создаём само поле ввода с данными указанными выше
+  // EN: create the input field itself with the data specified above
+  myEdit := CreateEdit(myRect, fntEdit, 20, @EditCont);
+
+  // RU: корректируем курсор
+  // EN: adjust the cursor
+//  CorrectEditCursor(myEdit, 3);
+
+  // RU: задаём очистку экрана заданным цветом
+  // EN: set the screen to clear with a specified color
+  scr_SetClearColor(true, $7090af);
+
+  {$Else}
   inputRect.X := 400 - 192;
   inputRect.Y := 300 - 100 - 32;
   inputRect.W := 384;
   inputRect.H := 96;
+  {$EndIf}
 
   // RU: Инициализируем обработку ввода джойстиков и получаем количество подключенных джойстиков.
   // EN: Initialize processing joystick input and get count of plugged joysticks.
@@ -50,8 +121,10 @@ begin
 end;
 
 procedure Draw;
-  var
-    w : Single;
+{$IfDef OLD_METHODS}
+var
+  w : Single;
+{$EndIf}
 begin
   text_Draw( fntMain, 0, 0, 'Escape - Exit' );
 
@@ -59,6 +132,7 @@ begin
   // EN: Mouse coordinates can be got using functions mouse_X and mouse_Y.
   text_Draw( fntMain, 0, 18, 'Mouse X, Y: ' + u_IntToStr( mouseX ) + '; ' + u_IntToStr( mouseY ) );
 
+  {$IfDef OLD_METHODS}
   // RU: Выводим введённый пользователем текст.
   // EN: Show the inputted text.
   pr2d_Rect( inputRect.X, inputRect.Y, inputRect.W, inputRect.H, $FFFFFF, 255 );
@@ -70,7 +144,12 @@ begin
     end else
       text_Draw( fntMain, 400, 300 - 100, 'Click here to enter text(maximum - 24 symbols):', TEXT_HALIGN_CENTER );
   text_Draw( fntMain, 400, 300 - 70, userInput, TEXT_HALIGN_CENTER );
-
+  {$Else}
+  text_Draw(fntMain, 0, 36, 'Press F5 to copy from Edit and draw');  // какой я нафиг англичанин? ))))
+  text_Draw(fntMain, 0, 54, 'Press F12 - Rus/Eng');
+  if userInput <> '' then
+    text_Draw(fntMain, 400, 300 - 70, userInput, TEXT_HALIGN_CENTER);
+  {$EndIf}
 
   // RU: Вывод состояния осей и кнопок первого джойстика в системе.
   // EN: Show the state of axes and buttons of first joystick in the system.
@@ -103,13 +182,19 @@ begin
   text_Draw( fntMain, 550, 540, 'Button16: ' + u_BoolToStr( joy_Down( 0, 15 ) ) );
 end;
 
+{$IfDef OLD_METHODS}
 procedure Timer;
 begin
   if lineAlpha > 5 Then
     DEC( lineAlpha, 10 )
   else
     lineAlpha := 255;
+end;
+{$EndIf}
 
+procedure KeyMouseEvent;
+begin
+  {$IfDef OLD_METHODS}
   // RU: Проверить нажата ли левая кнопка мыши в пределах inputRect и начать отслеживать ввод текста.
   // EN: Check if left mouse button was pressed inside inputRect and start to track text input.
   if mBClickCanClick( M_BLEFT_CLICK ) and col2d_PointInRect( mouseX, mouseY, inputRect ) Then
@@ -130,24 +215,22 @@ begin
   // EN: Get inputted by user text.
   if trackInput Then
     userInput := key_GetText();
-
-  // RU: По нажатию Escape завершить приложение.
-  // EN: If Escape was pressed - shutdown the application.
-
-  // if key_Press( K_ESCAPE ) Then zgl_Exit;
-                   // больше не нужно это делать, но если для чего-то понадобится клавиша Escape, надо
-                   // отключить дефайн (USE_EXIT_ESCAPE) на её обработку
-
-  // RU: Обязательно очищаем состояния всех подсистем ввода.
-  // EN: Necessarily clear all the states of input subsystems.
-  mouse_ClearState();
-  key_ClearState();
-  joy_ClearState();
+  {$Else}
+  // RU: по нажатию F5 копируем то, что написано в поле ввода
+  // EN: by pressing F5, copy what is written in the input field
+  if keysDown[K_F5] then
+  begin
+    userInput := GetEditToText(myEdit);
+  end;
+  {$EndIf}
 end;
 
 Begin
+  {$IfDef OLD_METHODS}
   TimeStart := timer_Add( @Timer, 16, Start );
+  {$EndIf}
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg( SYS_LOAD, @Init );
   zgl_Reg( SYS_DRAW, @Draw );
 

+ 1 - 1
Zengl_SRC/demos/FreePascal/03 - Input/demo03_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 3 - 7
Zengl_SRC/demos/FreePascal/04 - Screen Settings/demo04.pas

@@ -34,14 +34,12 @@ var
   fntMain : Byte;
   texBack : zglPTexture;
 
-  TimeStart  : Byte = 0;
-
 procedure Init;
 begin
   fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
   texBack := tex_LoadFromFile( dirRes + 'back03.jpg' );
 
-  setTextScale(15, fntMain);                  // razmery shrifta
+  setFontTextScale(15, fntMain);                  // razmery shrifta
 end;
 
 procedure Draw;
@@ -55,7 +53,7 @@ begin
   text_Draw( fntMain, 0, 20 * 4, 'F4 - Windowed mode' );
 end;
 
-procedure Timer;
+procedure KeyMouseEvent;
 begin
   // RU: Рекомендуемый к использованию полноэкранный режим. Основная идея - переключиться в полноэкранный режим используя текущее разрешение рабочего стола пользователя, но при этом
   //     сохранить пропорции изображения. Это позволит избежать некоторых проблем с LCD.
@@ -132,8 +130,6 @@ begin
    -------------------------------------------------------------------- *)
       scr_SetOptions();
     end;
-
-  key_ClearState();
 end;
 
 Begin
@@ -141,7 +137,7 @@ Begin
   if not zglLoad( libZenGL ) Then exit;
   {$ENDIF}
 
-  TimeStart := timer_Add( @Timer, 16, Start );
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
 
   zgl_Reg( SYS_LOAD, @Init );
   zgl_Reg( SYS_DRAW, @Draw );

+ 1 - 1
Zengl_SRC/demos/FreePascal/04 - Screen Settings/demo04_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 15 - 15
Zengl_SRC/demos/FreePascal/05 - Primitives/demo05.pas

@@ -28,19 +28,19 @@ var
   TimeStart  : Byte = 0;
 
 procedure Init;
-  var
-    i : Integer;
+var
+  i : Integer;
 begin
   for i := 0 to 359 do
-    begin
-      points[ i ].X := 400 + m_Cos( i ) * ( 96 + random( 32 ) );
-      points[ i ].Y := 300 + m_Sin( i ) * ( 96 + random( 32 ) );
-    end;
+  begin
+    points[ i ].X := 400 + m_Cos( i ) * ( 96 + random( 32 ) );
+    points[ i ].Y := 300 + m_Sin( i ) * ( 96 + random( 32 ) );
+  end;
 end;
 
 procedure Draw;
-  var
-    i : Integer;
+var
+  i : Integer;
 begin
   // RU: Устанавливаем цвет и альфу для каждой вершины.
   // EN: Set color and alpha for each vertex.
@@ -53,10 +53,6 @@ begin
   // EN: Render circle in the center of screen with radius 128 pixels.
   pr2d_Circle( 400, 300, 128, $000000, 155, 32, PR2D_FILL );
 
-  INC( calc );
-  if calc > 359 Then calc := 0;
-  points[ calc ].X := 400 + m_Cos( calc ) * ( 96 + random( 32 ) );
-  points[ calc ].Y := 300 + m_Sin( calc ) * ( 96 + random( 32 ) );
   // RU: Рисуем линии внутри круга.
   // EN: Render lines inside the circle.
   for i := 0 to 359 do
@@ -64,16 +60,20 @@ begin
 
   // RU: Рисуем эллипсы с заливкой и без, со сглаженными контурами(флаг PR2D_SMOOTH).
   // EN: Render filled ellipses with smoothed edges(flag PR2D_SMOOTH).
-  pr2d_Ellipse( 400 + 300, 300, 64, 256, $FFFFFF, 55, 32, PR2D_FILL or PR2D_SMOOTH );
+  pr2d_Ellipse( 400 + 300, 300, 64, 256, $FFFFFF, 75, 64, PR2D_FILL or PR2D_SMOOTH );
   pr2d_Ellipse( 400 + 300, 300, 64, 256, $000000, 255, 32, PR2D_SMOOTH );
 
-  pr2d_Ellipse( 400 - 300, 300, 64, 256, $FFFFFF, 55, 32, PR2D_FILL or PR2D_SMOOTH );
+  pr2d_Ellipse( 400 - 300, 300, 64, 256, $FFFFFF, 75, 64, PR2D_FILL{ or PR2D_SMOOTH });
   pr2d_Ellipse( 400 - 300, 300, 64, 256, $000000, 255, 32, PR2D_SMOOTH );
 end;
 
 procedure Timer;
 begin
-  key_ClearState();
+  INC( calc );
+  if calc > 359 Then
+    calc := 0;
+  points[ calc ].X := 400 + m_Cos( calc ) * ( 96 + random( 32 ) );
+  points[ calc ].Y := 300 + m_Sin( calc ) * ( 96 + random( 32 ) );
 end;
 
 Begin

+ 1 - 1
Zengl_SRC/demos/FreePascal/05 - Primitives/demo05_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 5 - 19
Zengl_SRC/demos/FreePascal/06 - Text/demo06.pas

@@ -16,6 +16,7 @@ uses
   zgl_primitives_2d,
   zgl_textures,
   zgl_textures_png,
+  zgl_textures_jpg,
   zgl_font,
   zgl_text,
   zgl_file,
@@ -31,19 +32,17 @@ var
   dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};            // в демо-версиях!!!
   fntMain : Byte;
 
-  TimeStart  : Byte = 0;
-
 procedure Init;
 begin
-//  file_SetPath('');                       // если dirRes = '../data/'   !!!!!     в демо-версиях!!!
   // RU: Загружаем данные о шрифте.
   // EN: Load the font.
-
   fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
   // RU: Если же текстуры именуются без использования маски вида "$(имя_шрифта)FontName-page$(номер).$(расширение)", то загрузку можно произвести следующим образом(для png):
   // EN: If textures were named without special mask - "$(font_name)-page$(number).$(extension)", then use this method to load them(for png):
   //for i := 0 to fntMain.Count.Pages - 1 do
   //  fntMain.Pages[ i ] := tex_LoadFromFile( dirRes + 'font-page' + u_IntToStr( i ) + '.png' );
+
+  setFontTextScale(15, fntMain);              // установка шкалы размерности шрифта
 end;
 
 procedure Draw;
@@ -51,17 +50,13 @@ procedure Draw;
     r : zglTRect;
     s : UTF8String;
 begin
-  batch2d_Begin();
-//  setTextScale(1.5, fntMain);
-
+//  batch2d_Begin();       требуется только для мобильных систем в данное время
   // RU: ZenGL работает исключительно с кодировкой UTF-8, поэтому весь текст должен быть в UTF-8.
   // EN: ZenGL works only with UTF-8 encoding, so all text should be encoded with UTF-8.
-
   text_Draw( fntMain, 400, 25, 'String with center alignment', TEXT_HALIGN_CENTER );
 
   text_DrawEx( fntMain, 400, 65, 3, 0, 'Scaling', 255, $FFFFFF, TEXT_HALIGN_CENTER );
 
-  setTextScale(15, fntMain);
   fx2d_SetVCA( $FF0000, $00FF00, $0000FF, $FFFFFF, 255, 255, 255, 255 );
   text_Draw( fntMain, 400, 125, 'Gradient color for every symbol', TEXT_FX_VCA or TEXT_HALIGN_CENTER );
 
@@ -102,14 +97,7 @@ begin
   // EN: Render FPS in the top right corner using text_GetWidth.
   s := 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) );
   text_Draw( fntMain, 800 - text_GetWidth( fntMain, s ), 0, s );
-
-  batch2d_End();
-end;
-
-procedure Timer;
-begin
-
-  key_ClearState();
+//  batch2d_End();    требуется для мобильных систем
 end;
 
 Begin
@@ -118,8 +106,6 @@ Begin
   {$ENDIF}
   randomize();
 
-  timer_Add( @Timer, 16, TimeStart, Start );
-
   zgl_Reg( SYS_LOAD, @Init );
   zgl_Reg( SYS_DRAW, @Draw );
 

+ 1 - 1
Zengl_SRC/demos/FreePascal/06 - Text/demo06_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 269 - 256
Zengl_SRC/demos/FreePascal/07 - Sprites/demo07.pas

@@ -1,256 +1,269 @@
-program demo07;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_camera_2d,
-  zgl_render_2d,
-  zgl_fx,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_textures_jpg,
-  zgl_sprite_2d,
-  zgl_primitives_2d,
-  zgl_font,
-  zgl_text,
-  zgl_types,
-  zgl_utils;
-
-type
-  TTux = record
-    Texture : zglPTexture;
-    Frame   : Integer;
-    Pos     : zglTPoint2D;
-end;
-
-var
-  dirRes      : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};    // äèðåêòîðèÿ ðåñóðñîâ
-  fntMain     : Byte;                                             // ýòî ôîíò
-  texLogo     : zglPTexture;
-  texBack     : zglPTexture;
-  texGround   : zglPTexture;
-  texTuxWalk  : zglPTexture;
-  texTuxStand : zglPTexture;
-  tux         : array[0..20] of TTux;
-  time        : Integer;
-  camMain     : zglTCamera2D;
-
-  TimeStart: Byte;
-procedure Init;
-  var
-    i : Integer;
-begin
-  // RU: Ò.ê. ïî óìîë÷àíèþ âñÿ ñòðóêòóðà êàìåðû çàïîëíÿåòñÿ íóëÿìè, ñëåäóåò èíèöèàëèçèðîâàòü å¸ ñòàíäàðòíûìè çíà÷åíèÿìè.
-  // EN: Camera must be initialized, because camera structure is zero-filled by default.
-  cam2d_Init(camMain);
-
-  // RU: Çàãðóæàåì òåêñòóðó.
-  //     $FF000000 - óêàçûâàåò íà òî, ÷òî áû èñïîëüçîâàòü àëüôà-êàíàë èç èçîáðàæåíèÿ.
-  //     TEX_DEFAULT_2D - êîìïëåêñ ôëàãîâ, íåîáõîäèìûõ äëÿ 2D-ñïðàéòîâ. Îïèñàíèå åñòü â ñïðàâêå.
-  // EN: Load the texture.
-  //     $FF000000 - means that alpha channel must be used from file, without colorkey.
-  //     TEX_DEFAULT_2D - complex of flags that needed for 2D sprites. Description can be found in help.
-  texLogo := tex_LoadFromFile(dirRes + 'zengl.png', $FF000000, TEX_DEFAULT_2D);
-
-  texBack := tex_LoadFromFile(dirRes + 'back01.jpg');
-
-  texGround := tex_LoadFromFile(dirRes + 'ground.png');
-  // RU: Óêàçûâàåì ðàçìåð êàäðà â òåêñòóðå.
-  // EN: Set the size of single frame for texture.
-  tex_SetFrameSize(texGround, 32, 32);
-
-  texTuxWalk := tex_LoadFromFile(dirRes + 'tux_walking.png');
-  tex_SetFrameSize(texTuxWalk, 64, 64);
-  texTuxStand := tex_LoadFromFile(dirRes + 'tux_stand.png');
-  tex_SetFrameSize(texTuxStand, 64, 64);
-
-  for i := 0 to 9 do
-  begin
-    tux[i].Texture := texTuxWalk;
-    tux[i].Frame   := random(19) + 2;
-    tux[i].Pos.X   := i * 96;
-    tux[i].Pos.Y   := 32;
-  end;
-  for i := 10 to 19 do
-  begin
-    tux[i].Texture := texTuxWalk;
-    tux[i].Frame   := random(19) + 2;
-    tux[i].Pos.X   := (i - 9) * 96;
-    tux[i].Pos.Y   := 600 - 96;
-  end;
-  tux[20].Texture := texTuxStand;
-  tux[20].Frame   := random(19) + 2;
-  tux[20].Pos.X   := 400 - 32;
-  tux[20].Pos.Y   := 300 - 64 - 4;
-
-  // RU: Çàãðóæàåì øðèôò.
-  // EN: Load the font.
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-var
-  i : Integer;
-  t : Single;
-  ScaleF: LongWord;
-begin
-//  batch2d_Begin();          // íå ðåêîìåíäóåòñÿ äëÿ ÏÊ    not reccomended for PC
-                              // use for Android and iOS
-  ScaleF := 15;
-  if time > 255 Then
-  begin
-      // RU: Äëÿ óâåëè÷åíèÿ áûñòðîäåéñòâèÿ ìîæíî îòêëþ÷èòü î÷èñòêó áóôåðà öâåòà, ó÷èòûâàÿ ÷òî ýêðàí ïîëíîñòüþ çàïîëíåí.
-      // EN: Rendering perfomance can be increased by disabling clearing the color buffer. This is a good idea because screen is full of objects.
-    zgl_Disable(COLOR_BUFFER_CLEAR);
-
-      // RU: Ðèñóåì çàäíèé ôîí ñ ðàçìåðàìè 800õ600 èñïîëüçóÿ òåêñòóðó back.
-      // EN: Render the background with size 800x600 and using texture "back".
-    ssprite2d_Draw(texBack, 0, 0, 800, 600, 0);
-
-      // RU: Óñòàíîâèòü òåêóùóþ êàìåðó.
-      // EN: Set the current camera.
-    cam2d_Set(@camMain);
-
-      // RU: Ðèñóåì çåìëþ.
-      // EN: Render the ground.
-    for i := - 2 to 800 div 32 + 1 do
-      asprite2d_Draw(texGround, i * 32, 96 - 12, 32, 32, 0, 2);
-    for i := - 2 to 800 div 32 + 1 do
-      asprite2d_Draw(texGround, i * 32, 600 - 32 - 12, 32, 32, 0, 2);
-
-      // RU: Ðèñóåì øàãàþùèõ ïèíãâèíîâ.
-      // EN: Render penguins
-    for i := 0 to 9 do
-      if i = 2 Then
-      begin
-            // RU: Ðèñóåì íàäïèñü â "ðàìî÷êå" íàä ïèíãâèíîì.
-            // EN: Render the text in frame over penguins.
-        t := text_GetWidth( fntMain, 'I''m so red...' ) * 0.75;
-        pr2d_Rect(tux[i].Pos.X - 1, tux[i].Pos.Y - ScaleF + 4, t, ScaleF, $000000, 200, PR2D_FILL);
-        pr2d_Rect(tux[i].Pos.X - 2, tux[i].Pos.Y - ScaleF + 3, t + 2, ScaleF + 2, $FFFFFF);
-        text_DrawEx(fntMain, tux[i].Pos.X, tux[i].Pos.Y - ScaleF + 5, 1, 0, 'I''m so red...');
-            // RU: Ðèñóåì êðàñíîãî ïèíãâèíà èñïîëüçóÿ fx2d-ôóíêöèþ è ôëàã FX_COLOR.
-            // EN: Render red penguin using fx2d-function and flag FX_COLOR.
-        fx2d_SetColor($FF0000);
-        asprite2d_Draw(tux[i].Texture, tux[i].Pos.X, tux[i].Pos.Y, 64, 64, 0, tux[i].Frame div 2, 255, FX_BLEND or FX_COLOR);
-      end else
-      if i = 7 Then
-      begin
-        t := text_GetWidth(fntMain, '???') * 0.75;
-        pr2d_Rect(tux[i].Pos.X + 32 - t / 2, tux[i].Pos.Y - ScaleF + 4, t, ScaleF, $000000, 200, PR2D_FILL);
-        pr2d_Rect(tux[i].Pos.X + 32 - t / 2 - 1, tux[i].Pos.Y - ScaleF + 3, t + 2, ScaleF + 2, $FFFFFF);
-        text_DrawEx(fntMain, tux[i].Pos.X + 32, tux[i].Pos.Y - ScaleF + 5, 1, 0, '???', 255, $FFFFFF, TEXT_HALIGN_CENTER);
-                // RU: Ðèñóåì ïèíãâèíà ïðèâåäåíèå èñïîëüçóÿ ôëàã FX_COLOR óñòàíîâèâ ðåæèì â FX_COLOR_SET :)
-                // EN: Render penguin ghost using flag FX_COLOR and mode FX_COLOR_SET :)
-        fx_SetColorMode(FX_COLOR_SET);
-        fx2d_SetColor($FFFFFF);
-        asprite2d_Draw(tux[i].Texture, tux[i].Pos.X, tux[i].Pos.Y, 64, 64, 0, tux[i].Frame div 2, 155, FX_BLEND or FX_COLOR);
-                // RU: Âîçâðàùàåì îáû÷íûé ðåæèì.
-                // EN: Return default mode.
-        fx_SetColorMode(FX_COLOR_MIX);
-      end else
-        asprite2d_Draw(tux[i].Texture, tux[i].Pos.X, tux[i].Pos.Y, 64, 64, 0, tux[i].Frame div 2);
-
-      // RU: Ðèñóåì ïèíãâèíîâ øàãàþùèõ â îáðàòíóþ ñòîðîíó èñïîëüçóÿ ôëàã îòðàæåíèÿ òåêñòóðû FX2D_FLIPX.
-      // EN: Render penguins, that go another way using special flag for flipping texture - FX2D_FLIPX.
-    for i := 10 to 19 do
-      if i = 13 Then
-      begin
-        t := text_GetWidth(fntMain, 'I''m so big...') * 0.75;
-        pr2d_Rect(tux[i].Pos.X - 2, tux[i].Pos.Y - ScaleF - 10, t, ScaleF, $000000, 200, PR2D_FILL);
-        pr2d_Rect(tux[i].Pos.X - 3, tux[i].Pos.Y - ScaleF - 11, t + 2, ScaleF + 2, $FFFFFF);
-        text_DrawEx(fntMain, tux[i].Pos.X, tux[i].Pos.Y - ScaleF - 9, 1, 0, 'I''m so big...');
-            // RU: Ðèñóåì "áîëüøåãî" ïèíãâèíà. Ò.ê. FX2D_SCALE óâåëè÷èâàåò ñïðàéò îòíîñèòåëüíî öåíòðà, òî ïèíãâèíà ñëåäóåò íåìíîãî "ïîäíÿòü".
-            // EN: Render "big" penguin. It must be shifted up, because FX2D_SCALE scale sprite relative to the center.
-        fx2d_SetScale(1.25, 1.25);
-        asprite2d_Draw(tux[i].Texture, tux[i].Pos.X, tux[i].Pos.Y - 8, 64, 64, 0, tux[i].Frame div 2, 255, FX_BLEND or FX2D_FLIPX or FX2D_SCALE);
-      end else
-      if i = 17 Then
-      begin
-                // RU: Ðèñóåì "âûñîêîãî" ïèíãâèíà èñïîëüçóÿ âìåñòî ôëàãà FX2D_SCALE ôëàã FX2D_VCHANGE è ôóíêöèþ fx2d_SetVertexes äëÿ ñìåùåíèÿ êîîðäèíàò äâóõ âåðõíèõ âåðøèí ñïðàéòà.
-                // EN: Render "tall" penguin using flag FX2D_VCHANGE instead of FX2D_SCALE, and function fx2d_SetVertexes for shifting upper vertexes of sprite.
-        fx2d_SetVertexes(0, -16, 0, -16, 0, 0, 0, 0);
-        asprite2d_Draw(tux[i].Texture, tux[i].Pos.X, tux[i].Pos.Y, 64, 64, 0, tux[i].Frame div 2, 255, FX_BLEND or FX2D_FLIPX or FX2D_VCHANGE);
-      end else
-        asprite2d_Draw(tux[i].Texture, tux[i].Pos.X, tux[i].Pos.Y, 64, 64, 0, tux[i].Frame div 2, 255, FX_BLEND or FX2D_FLIPX);
-
-      // RU: Ñáðîñèòü êàìåðó.
-      // EN: Reset the camera.
-    cam2d_Set(nil);
-
-      // RU: Ðèñóåì ó÷àñòîê çåìëè ïî öåíòðó ýêðàíà.
-      // EN: Render piece of ground in the center of screen.
-    asprite2d_Draw(texGround, 11 * 32, 300 - 16, 32, 32, 0, 1);
-    asprite2d_Draw(texGround, 12 * 32, 300 - 16, 32, 32, 0, 2);
-    asprite2d_Draw(texGround, 13 * 32, 300 - 16, 32, 32, 0, 3);
-
-    t := text_GetWidth(fntMain, 'o_O') * 0.75;
-    pr2d_Rect(tux[20].Pos.X + 32 - t / 2 - 1, tux[20 ].Pos.Y - ScaleF + 3, t + 2, ScaleF + 2, $000000, 200, PR2D_FILL);
-    pr2d_Rect(tux[20].Pos.X + 32 - t / 2 - 2, tux[20 ].Pos.Y - ScaleF + 2, t + 4, ScaleF + 4, $FFFFFF);
-    text_DrawEx(fntMain, tux[20].Pos.X + 32, tux[20].Pos.Y - ScaleF + 5, 1, 0, 'o_O', 255, $FFFFFF, TEXT_HALIGN_CENTER);
-    asprite2d_Draw(tux[20].Texture, tux[20].Pos.X, tux[20].Pos.Y, 64, 64, 0, tux[20].Frame div 2);
-  end;
-
-  if time <= 255 Then
-    ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, time)
-  else
-  if time < 510 Then
-  begin
-    pr2d_Rect(0, 0, 800, 600, $000000, 510 - time, PR2D_FILL);
-    ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time);
-  end;
-
-  if time > 255 Then
-    text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-
-//  batch2d_End();                // íå ðåêîìåíäóåòñÿ äëÿ ÏÊ    not reccomended for PC
-                                  // use for Android and iOS
-end;
-
-procedure Timer;
-  var
-    i : Integer;
-begin
-  INC(time, 2);
-
-  camMain.Angle := camMain.Angle + cos(time / 1000) / 10;
-
-  for i := 0 to 20 do                       // êàäðû
-    begin
-      INC(tux[i].Frame );
-      if tux[i].Frame > 20 Then
-        tux[i].Frame := 2;
-    end;
-  for i := 0 to 9 do                        // ñìåùåíèå â îäíó ñòîðîíó
-    begin
-      tux[i].Pos.X := tux[i].Pos.X + 1.5;
-      if tux[i].Pos.X > 864 Then
-        tux[i].Pos.X := - 96;
-    end;
-  for i := 10 to 19 do                      // ñìåùåíèå â äðóãóþ ñòîðîíó
-    begin
-      tux[i].Pos.X := tux[i].Pos.X - 1.5;
-      if tux[i].Pos.X < - 96 Then
-        tux[i].Pos.X := 864;
-    end;
-
-  key_ClearState();
-end;
-
-Begin
-  randomize();
-
-  TimeStart := timer_Add(@Timer, 16, Start);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw );
-
-  wnd_SetCaption(utf8_Copy('07 - Sprites'));
-
-  zgl_Init();
-End.
+program demo07;
+
+{$I zglCustomConfig.cfg}
+
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_camera_2d,
+  zgl_render_2d,
+  zgl_fx,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_textures_jpg,
+  zgl_sprite_2d,
+  zgl_primitives_2d,
+  zgl_font,
+  zgl_text,
+  zgl_types,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+type
+  TTux = record
+    Texture : zglPTexture;
+    Frame   : Integer;
+    Pos     : zglTPoint2D;
+end;
+
+var
+  dirRes      : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain     : Byte;
+  texLogo     : zglPTexture;
+  texBack     : zglPTexture;
+  texGround   : zglPTexture;
+  texTuxWalk  : zglPTexture;
+  texTuxStand : zglPTexture;
+  tux         : array[ 0..20 ] of TTux;
+  time        : Integer;
+  camMain     : zglTCamera2D;
+
+  TimeStart  : Byte = 0;
+
+procedure Init;
+  var
+    i : Integer;
+begin
+  // RU: Т.к. по умолчанию в�� �труктура камеры заполн�ет�� нул�ми, �ледует инициализировать её �тандартными значени�ми.
+  // EN: Camera must be initialized, because camera structure is zero-filled by default.
+  cam2d_Init( camMain );
+
+  // RU: Загружаем тек�туру.
+  //     $FF000000 - указывает на то, что бы и�пользовать альфа-канал из изображени�.
+  //     TEX_DEFAULT_2D - комплек� флагов, необходимых дл� 2D-�прайтов. Опи�ание е�ть в �правке.
+  // EN: Load the texture.
+  //     $FF000000 - means that alpha channel must be used from file, without colorkey.
+  //     TEX_DEFAULT_2D - complex of flags that needed for 2D sprites. Description can be found in help.
+  texLogo := tex_LoadFromFile( dirRes + 'zengl.png', $FF000000, TEX_DEFAULT_2D );
+
+  texBack := tex_LoadFromFile( dirRes + 'back01.jpg' );
+
+  texGround := tex_LoadFromFile( dirRes + 'ground.png' );
+  // RU: Указываем размер кадра в тек�туре.
+  // EN: Set the size of single frame for texture.
+  tex_SetFrameSize( texGround, 32, 32 );
+
+  texTuxWalk := tex_LoadFromFile( dirRes + 'tux_walking.png' );
+  tex_SetFrameSize( texTuxWalk, 64, 64 );
+  texTuxStand := tex_LoadFromFile( dirRes + 'tux_stand.png' );
+  tex_SetFrameSize( texTuxStand, 64, 64 );
+
+  for i := 0 to 9 do
+    begin
+      tux[ i ].Texture := texTuxWalk;
+      tux[ i ].Frame   := random( 19 ) + 2;
+      tux[ i ].Pos.X   := i * 96;
+      tux[ i ].Pos.Y   := 32;
+    end;
+  for i := 10 to 19 do
+    begin
+      tux[ i ].Texture := texTuxWalk;
+      tux[ i ].Frame   := random( 19 ) + 2;
+      tux[ i ].Pos.X   := ( i - 9 ) * 96;
+      tux[ i ].Pos.Y   := 600 - 96;
+    end;
+  tux[ 20 ].Texture := texTuxStand;
+  tux[ 20 ].Frame   := random( 19 ) + 2;
+  tux[ 20 ].Pos.X   := 400 - 32;
+  tux[ 20 ].Pos.Y   := 300 - 64 - 4;
+
+  // RU: Загружаем шрифт.
+  // EN: Load the font.
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+  setFontTextScale(15, fntMain);
+
+  // RU: У�танавливаем FPS.
+  // EN: Set FPS.
+  scr_SetFPS(60);
+end;
+
+procedure Draw;
+  var
+    i : Integer;
+    t : Single;
+    ScaleF: LongWord;
+begin
+//  batch2d_Begin();
+  ScaleF := 15;
+  if time > 255 Then
+    begin
+      // RU: Дл� увеличени� бы�тродей�тви� можно отключить очи�тку буфера цвета, учитыва� что �кран полно�тью заполнен.
+      // EN: Rendering perfomance can be increased by disabling clearing the color buffer. This is a good idea because screen is full of objects.
+      zgl_Disable( COLOR_BUFFER_CLEAR );
+
+      // RU: Ри�уем задний фон � размерами 800х600 и�пользу� тек�туру back.
+      // EN: Render the background with size 800x600 and using texture "back".
+      ssprite2d_Draw( texBack, 0, 0, 800, 600, 0 );
+
+      // RU: У�тановить текущую камеру.
+      // EN: Set the current camera.
+      cam2d_Set( @camMain );
+
+      // RU: Ри�уем землю.
+      // EN: Render the ground.
+      for i := -2 to 800 div 32 + 1 do
+        asprite2d_Draw( texGround, i * 32, 96 - 12, 32, 32, 0, 2 );
+      for i := -2 to 800 div 32 + 1 do
+        asprite2d_Draw( texGround, i * 32, 600 - 32 - 12, 32, 32, 0, 2 );
+
+      // RU: Ри�уем шагающих пингвинов.
+      // EN: Render penguins
+      for i := 0 to 9 do
+        if i = 2 Then
+          begin
+            // RU: Ри�уем надпи�ь в "рамочке" над пингвином.
+            // EN: Render the text in frame over penguins.
+            t := text_GetWidth( fntMain, 'I''m so red...' ) * 0.75;
+            pr2d_Rect( tux[ i ].Pos.X - 2, tux[ i ].Pos.Y - ScaleF + 4, t, ScaleF, $000000, 200, PR2D_FILL );
+            pr2d_Rect( tux[ i ].Pos.X - 2, tux[ i ].Pos.Y - ScaleF + 3, t, ScaleF + 1, $FFFFFF );
+            text_DrawEx( fntMain, tux[ i ].Pos.X, tux[ i ].Pos.Y - ScaleF + 4, 1, 0, 'I''m so red...' );
+            // RU: Ри�уем кра�ного пингвина и�пользу� fx2d-функцию и флаг FX_COLOR.
+            // EN: Render red penguin using fx2d-function and flag FX_COLOR.
+            fx2d_SetColor( $FF0000 );
+            asprite2d_Draw( tux[ i ].Texture, tux[ i ].Pos.X, tux[ i ].Pos.Y, 64, 64, 0, tux[ i ].Frame div 2, 255, FX_BLEND or FX_COLOR );
+          end else
+            if i = 7 Then
+              begin
+                t := text_GetWidth( fntMain, '???' ) * 0.75;
+                pr2d_Rect( tux[ i ].Pos.X + 32 - t / 2, tux[ i ].Pos.Y - ScaleF + 4, t, ScaleF, $000000, 200, PR2D_FILL );
+                pr2d_Rect( tux[ i ].Pos.X + 32 - t / 2, tux[ i ].Pos.Y - ScaleF + 3, t, ScaleF + 1, $FFFFFF );
+                text_DrawEx( fntMain, tux[ i ].Pos.X + 32, tux[ i ].Pos.Y - ScaleF + 4, 1, 0, '???', 255, $FFFFFF, TEXT_HALIGN_CENTER );
+                // RU: Ри�уем пингвина приведение и�пользу� флаг FX_COLOR у�тановив режим в FX_COLOR_SET :)
+                // EN: Render penguin ghost using flag FX_COLOR and mode FX_COLOR_SET :)
+                fx_SetColorMode( FX_COLOR_SET );
+                fx2d_SetColor( $FFFFFF );
+                asprite2d_Draw( tux[ i ].Texture, tux[ i ].Pos.X, tux[ i ].Pos.Y, 64, 64, 0, tux[ i ].Frame div 2, 155, FX_BLEND or FX_COLOR );
+                // RU: Возвращаем обычный режим.
+                // EN: Return default mode.
+                fx_SetColorMode( FX_COLOR_MIX );
+              end else
+                asprite2d_Draw( tux[ i ].Texture, tux[ i ].Pos.X, tux[ i ].Pos.Y, 64, 64, 0, tux[ i ].Frame div 2 );
+
+      // RU: Ри�уем пингвинов шагающих в обратную �торону и�пользу� флаг отражени� тек�туры FX2D_FLIPX.
+      // EN: Render penguins, that go another way using special flag for flipping texture - FX2D_FLIPX.
+      for i := 10 to 19 do
+        if i = 13 Then
+          begin
+            t := text_GetWidth( fntMain, 'I''m so big...' ) * 0.75;
+            pr2d_Rect( tux[ i ].Pos.X - 2, tux[ i ].Pos.Y - ScaleF - 10, t, ScaleF, $000000, 200, PR2D_FILL );
+            pr2d_Rect( tux[ i ].Pos.X - 2, tux[ i ].Pos.Y - ScaleF - 10, t, ScaleF + 1, $FFFFFF{, 255, PR2D_SMOOTH });
+            text_DrawEx( fntMain, tux[ i ].Pos.X, tux[ i ].Pos.Y - ScaleF - 8, 1, 0, 'I''m so big...' );
+            // RU: Ри�уем "большего" пингвина. Т.к. FX2D_SCALE увеличивает �прайт отно�ительно центра, то пингвина �ледует немного "подн�ть".
+            // EN: Render "big" penguin. It must be shifted up, because FX2D_SCALE scale sprite relative to the center.
+            fx2d_SetScale( 1.25, 1.25 );
+            asprite2d_Draw( tux[ i ].Texture, tux[ i ].Pos.X, tux[ i ].Pos.Y - 8, 64, 64, 0, tux[ i ].Frame div 2, 255, FX_BLEND or FX2D_FLIPX or FX2D_SCALE );
+          end else
+            if i = 17 Then
+              begin
+                // RU: Ри�уем "вы�окого" пингвина и�пользу� вме�то флага FX2D_SCALE флаг FX2D_VCHANGE и функцию fx2d_SetVertexes дл� �мещени� координат двух верхних вершин �прайта.
+                // EN: Render "tall" penguin using flag FX2D_VCHANGE instead of FX2D_SCALE, and function fx2d_SetVertexes for shifting upper vertexes of sprite.
+                fx2d_SetVertexes( 0, -16, 0, -16, 0, 0, 0, 0 );
+                asprite2d_Draw( tux[ i ].Texture, tux[ i ].Pos.X, tux[ i ].Pos.Y, 64, 64, 0, tux[ i ].Frame div 2, 255, FX_BLEND or FX2D_FLIPX or FX2D_VCHANGE );
+              end else
+                asprite2d_Draw( tux[ i ].Texture, tux[ i ].Pos.X, tux[ i ].Pos.Y, 64, 64, 0, tux[ i ].Frame div 2, 255, FX_BLEND or FX2D_FLIPX );
+
+      // RU: Сбро�ить камеру.
+      // EN: Reset the camera.
+      cam2d_Set( nil );
+
+      // RU: Ри�уем уча�ток земли по центру �крана.
+      // EN: Render piece of ground in the center of screen.
+      asprite2d_Draw( texGround, 11 * 32, 300 - 16, 32, 32, 0, 1 );
+      asprite2d_Draw( texGround, 12 * 32, 300 - 16, 32, 32, 0, 2 );
+      asprite2d_Draw( texGround, 13 * 32, 300 - 16, 32, 32, 0, 3 );
+
+      t := text_GetWidth( fntMain, 'o_O' ) * 0.75;
+      pr2d_Rect( tux[ 20 ].Pos.X + 32 - t / 2 -1, tux[ 20 ].Pos.Y - ScaleF + 3, t + 2, ScaleF + 2, $000000, 200, PR2D_FILL );
+      pr2d_Rect( tux[ 20 ].Pos.X + 32 - t / 2 - 2, tux[ 20 ].Pos.Y - ScaleF + 2, t + 4, ScaleF + 4, $FFFFFF );
+      text_DrawEx( fntMain, tux[ 20 ].Pos.X + 32, tux[ 20 ].Pos.Y - ScaleF + 4, 1, 0, 'o_O', 255, $FFFFFF, TEXT_HALIGN_CENTER );
+      asprite2d_Draw( tux[ 20 ].Texture, tux[ 20 ].Pos.X, tux[ 20 ].Pos.Y, 64, 64, 0, tux[ 20 ].Frame div 2 );
+    end;
+
+  if time <= 255 Then
+    ssprite2d_Draw( texLogo, 400 - 256, 300 - 128, 512, 256, 0, time )
+  else
+    if time < 510 Then
+      begin
+        pr2d_Rect( 0, 0, 800, 600, $000000, 510 - time, PR2D_FILL );
+        ssprite2d_Draw( texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time );
+      end;
+
+  if time > 255 Then
+  begin
+    text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+  end;
+//  batch2d_End();
+end;
+
+procedure Timer;
+  var
+    i : Integer;
+begin
+  INC( time, 2 );
+
+  camMain.Angle := camMain.Angle + cos( time / 1000 ) / 10;
+
+  for i := 0 to 20 do
+    begin
+      INC( tux[ i ].Frame );
+      if tux[ i ].Frame > 20 Then
+        tux[ i ].Frame := 2;
+    end;
+  for i := 0 to 9 do
+    begin
+      tux[ i ].Pos.X := tux[ i ].Pos.X + 1.5;
+      if tux[ i ].Pos.X > 864 Then
+        tux[ i ].Pos.X := -96;
+    end;
+  for i := 10 to 19 do
+    begin
+      tux[ i ].Pos.X := tux[ i ].Pos.X - 1.5;
+      if tux[ i ].Pos.X < -96 Then
+        tux[ i ].Pos.X := 864;
+    end;
+end;
+
+Begin
+  {$IFNDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+  randomize();
+
+  TimeStart := timer_Add( @Timer, 16, Start );
+
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+
+  wnd_SetCaption(utf8_Copy('07 - Sprites'));
+
+  zgl_Init(16, 8);
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/07 - Sprites/demo07_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 223 - 202
Zengl_SRC/demos/FreePascal/08 - Sprite Engine/demo08.pas

@@ -1,202 +1,223 @@
-program demo08;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_render_2d,
-  zgl_fx,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_sprite_2d,
-  zgl_sengine_2d,
-  zgl_primitives_2d,
-  zgl_font,
-  zgl_text,
-  zgl_types,
-  zgl_utils
-  ;
-
-type
-  zglPMikuSprite = ^zglTMikuSprite;
-  zglTMikuSprite = record
-    // RU: Îáÿçàòåëüíàÿ ÷àñòü íîâîãî òèïà ñïðàéòà.
-    // EN: New type should start with this.
-    Sprite: zglTSprite2D;
-
-    // RU: Íîâûå ïàðàìåòðû.
-    // EN: New params.
-    Speed : zglTPoint2D;
-  end;
-
-var
-  dirRes   : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain  : Byte;
-  texLogo  : zglPTexture;
-  texMiku  : zglPTexture;
-  time     : Integer;
-  sengine2d: zglTSEngine2D;
-  TimeStart: Byte;
-  TimeMiku : Byte;
-
-// Miku
-procedure MikuInit(var Miku: zglTMikuSprite);
-begin
-  with Miku, Miku.Sprite do
-    begin
-      X := 800 + random(800);
-      Y := random(600 - 128);
-
-      // RU: Çàäàåì ñêîðîñòü äâèæåíèÿ.  Íî ýòî âîîáùå áðåä, åñëè ìû äåëàåì óïðàâëÿåìîãî ïåðñîíàæà
-      // EN: Set the moving speed.
-      Speed.X := - random(10) / 5 - 0.5;
-      Speed.Y := (random(10) - 5) / 5;
-    end;
-end;
-
-procedure MikuDraw(var Miku: zglTMikuSprite);
-begin
-  with Miku.Sprite do
-    asprite2d_Draw(Texture, X, Y, W, H, Angle, Round(Frame), Alpha, FxFlags);
-end;
-
-procedure MikuProc(var Miku: zglTMikuSprite);
-begin
-  with Miku, Miku.Sprite do
-    begin
-      X := X + Speed.X;
-      Y := Y + Speed.Y;
-      Frame := Frame + (abs(speed.X) + abs(speed.Y)) / 25;
-      if Frame > 8 Then
-        Frame := 1;
-
-      // RU: Åñëè ñïðàéò âûõîäèò çà ïðåäåëû ïî X, ñðàçó æå óäàëÿåì åãî.
-      // EN: Delete the sprite if it goes beyond X.
-      if X < -128 Then sengine2d_DelSprite(ID);
-
-      // RU: Åñëè ñïðàéò âûõîäèò çà ïðåäåëû ïî Y, ñòàâèì åãî â î÷åðåäü íà óäàëåíèå.
-      // EN: Add sprite to queue for delete if it goes beyond Y.
-      if Y < -128 Then Destroy := TRUE;
-      if Y > 600  Then Destroy := TRUE;
-    end;
-end;
-
-procedure MikuFree(var Miku: zglTMikuSprite);
-begin
-end;
-
-// RU: Äîáàâèòü 100 ñïðàéòîâ.
-// EN: Add 100 sprites.
-procedure AddMiku;
-  var
-    i: Integer;
-begin
-  // RU: Ïðè äîáàâëåíèè ñïðàéòà â ìåíåäæåð ñïðàéòîâ óêàçûâàåòñÿ òåêñòóðà, ñëîé(ïîëîæåíèå ïî Z) è óêàçàòåëè íà îñíîâíûå ôóíêöèè - Èíèöèàëèçàöèÿ, Ðåíäåð, Îáðàáîòêà è Óíè÷òîæåíèå.
-  // EN: For adding sprite to sprite engine must be set next parameters: texture, layer(Z-coordinate) and pointers to Initialization, Render, Process and Destroy functions.
-  for i := 1 to 100 do
-    sengine2d_AddCustom(texMiku, SizeOf(zglTMikuSprite), random(10), @MikuInit, @MikuDraw, @MikuProc, @MikuFree);
-end;
-
-// RU: Óäàëèòü 100 ñïðàéòîâ.
-// EN: Delete 100 sprites.
-procedure DelMiku;
-  var
-    i: Integer;
-begin
-  // RU: Óäàëèì 100 ñïðàéòîâ ñî ñëó÷àéíûì ID.
-  // EN: Delete 100 sprites with random ID.
-  for i := 1 to 100 do
-    sengine2d_DelSprite(random(sengine2d.Count));
-end;
-
-procedure Init;
-  var
-    i: Integer;
-begin
-  texLogo := tex_LoadFromFile(dirRes + 'zengl.png');
-
-  texMiku := tex_LoadFromFile(dirRes + 'miku.png');
-  tex_SetFrameSize(texMiku, 128, 128);
-
-  // RU: Óñòàíàâëèâàåì òåêóùèì ìåíåäæåðîì ñïðàéòîâ ñâîé.
-  // EN: Set own sprite engine as current.
-  sengine2d_Set(@sengine2d);
-
-  // RU: Ñîçäàäèì 1000 ñïðàéòîâ Miku-chan :)
-  // EN: Create 1000 sprites of Miku-chan :)
-//  for i := 0 to 9 do
-//    AddMiku();
-
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-begin
-//  batch2d_Begin();
-  // RU: Ðèñóåì âñå ñïðàéòû íàõîäÿùèåñÿ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
-  // EN: Render all sprites contained in current sprite engine.
-  if time > 255 Then
-    sengine2d_Draw();
-
-  if time <= 255 Then
-    ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, time)
-  else
-    if time < 510 Then
-      begin
-        pr2d_Rect(0, 0, 800, 600, $000000, 510 - time, PR2D_FILL);
-        ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time);
-      end;
-
-  if time > 255 Then
-    begin
-      pr2d_Rect(0, 0, 256, 64, $000000, 200, PR2D_FILL);
-      text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-      text_Draw(fntMain, 0, 20, 'Sprites: ' + u_IntToStr(sengine2d.Count));
-      text_Draw(fntMain, 0, 40, 'Up/Down - Add/Delete Miku :)');
-    end;
-//  batch2d_End();
-end;
-
-procedure Timer;
-begin
-  INC(time, 2);
-
-  // RU: Âûïîëíÿåì îáðàáîòêó âñåõ ñïðàéòîâ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
-  // EN: Process all sprites contained in current sprite engine.
-  sengine2d_Proc();
-
-  // RU: Ïî íàæàòèþ ïðîáåëà î÷èñòèòü âñå ñïðàéòû.
-  // EN: Delete all sprites if space was pressed.
-  if key_Press(K_SPACE) Then sengine2d_ClearAll();
-  if key_Press(K_UP) Then AddMiku();
-  if key_Press(K_DOWN) Then DelMiku();
-
-  key_ClearState();
-end;
-
-procedure Quit;
-begin
-  // RU: Î÷èùàåì ïàìÿòü îò ñîçäàííûõ ñïðàéòîâ.
-  // EN: Free allocated memory for sprites.
-  sengine2d_Set(@sengine2d);
-  sengine2d_ClearAll();
-end;
-
-Begin
-  randomize;
-
-  TimeStart := timer_Add(@Timer, 16, Start);
-  TimeMiku := timer_Add(@AddMiku, 1000, SleepToStart, 10);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-  zgl_Reg(SYS_EXIT, @Quit);
-
-  wnd_SetCaption(utf8_Copy('08 - Sprite Engine'));
-
-  zgl_Init();
-End.
+program demo08;
+
+{$I zglCustomConfig.cfg}
+
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_render_2d,
+  zgl_fx,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_textures_jpg,
+  zgl_sprite_2d,
+  zgl_sengine_2d,
+  zgl_primitives_2d,
+  zgl_font,
+  zgl_text,
+  zgl_types,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+type
+  zglPMikuSprite = ^zglTMikuSprite;
+  zglTMikuSprite = record
+    // RU: Об�зательна� ча�ть нового типа �прайта.
+    // EN: New type should start with this.
+    Sprite : zglTSprite2D;
+
+    // RU: �овые параметры.
+    // EN: New params.
+    Speed  : zglTPoint2D;
+  end;
+
+var
+  dirRes    : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain   : Byte; // zglPFont;
+  texLogo   : zglPTexture;
+  texMiku   : zglPTexture;
+  time      : Integer;
+  sengine2d : zglTSEngine2D;
+
+  TimeStart : Byte;
+  TimeMiku  : Byte;
+
+// Miku
+procedure MikuInit( var Miku : zglTMikuSprite );
+begin
+  with Miku, Miku.Sprite do
+    begin
+      X := 800 + random( 800 );
+      Y := random( 600 - 128 );
+
+      // RU: Задаем �коро�ть движени�.
+      // EN: Set the moving speed.
+      Speed.X := -random( 10 ) / 5 - 0.5;
+      Speed.Y := ( random( 10 ) - 5 ) / 5;
+    end;
+end;
+
+procedure MikuDraw( var Miku : zglTMikuSprite );
+begin
+  with Miku.Sprite do
+    asprite2d_Draw( Texture, X, Y, W, H, Angle, Round( Frame ), Alpha, FxFlags );
+end;
+
+procedure MikuProc( var Miku : zglTMikuSprite );
+begin
+  with Miku, Miku.Sprite do
+    begin
+      X := X + Speed.X;
+      Y := Y + Speed.Y;
+      Frame := Frame + ( abs( speed.X ) + abs( speed.Y ) ) / 25;
+      if Frame > 8 Then
+        Frame := 1;
+
+      // RU: Е�ли �прайт выходит за пределы по X, �разу же удал�ем его.
+      // EN: Delete the sprite if it goes beyond X.
+      if X < -128 Then sengine2d_DelSprite( ID );
+
+      // RU: Е�ли �прайт выходит за пределы по Y, �тавим его в очередь на удаление.
+      // EN: Add sprite to queue for delete if it goes beyond Y.
+      if Y < -128 Then Destroy := TRUE;
+      if Y > 600  Then Destroy := TRUE;
+    end;
+end;
+
+procedure MikuFree( var Miku : zglTMikuSprite );
+begin
+end;
+
+// RU: Добавить 100 �прайтов.
+// EN: Add 100 sprites.
+procedure AddMiku;
+  var
+    i : Integer;
+begin
+  // RU: При добавлении �прайта в менеджер �прайтов указывает�� тек�тура, �лой(положение по Z) и указатели на о�новные функции - Инициализаци�, Рендер, Обработка и Уничтожение.
+  // EN: For adding sprite to sprite engine must be set next parameters: texture, layer(Z-coordinate) and pointers to Initialization, Render, Process and Destroy functions.
+  for i := 1 to 100 do
+    sengine2d_AddCustom( texMiku, SizeOf( zglTMikuSprite ), random( 10 ), @MikuInit, @MikuDraw, @MikuProc, @MikuFree );
+end;
+
+// RU: Удалить 100 �прайтов.
+// EN: Delete 100 sprites.
+procedure DelMiku;
+  var
+    i : Integer;
+begin
+  // RU: Удалим 100 �прайтов �о �лучайным ID.
+  // EN: Delete 100 sprites with random ID.
+  for i := 1 to 100 do
+    sengine2d_DelSprite( random( sengine2d.Count ) );
+end;
+
+procedure Init;
+  var
+    i : Integer;
+begin
+  texLogo := tex_LoadFromFile( dirRes + 'zengl.png' );
+
+  texMiku := tex_LoadFromFile( dirRes + 'miku.png' );
+  tex_SetFrameSize( texMiku, 128, 128 );
+
+  // RU: У�танавливаем текущим менеджером �прайтов �вой.
+  // EN: Set own sprite engine as current.
+  sengine2d_Set( @sengine2d );
+
+  // RU: Создадим 1000 �прайтов Miku-chan :)
+  // EN: Create 1000 sprites of Miku-chan :)
+//  for i := 0 to 9 do
+//    AddMiku();
+
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+  setFontTextScale(15, fntMain);
+end;
+
+procedure Draw;
+begin
+  batch2d_Begin();
+  // RU: Ри�уем в�е �прайты наход�щие�� в текущем �прайтовом менеджере.
+  // EN: Render all sprites contained in current sprite engine.
+  if time > 255 Then
+    sengine2d_Draw();
+
+  if time <= 255 Then
+    ssprite2d_Draw( texLogo, 400 - 256, 300 - 128, 512, 256, 0, time )
+  else
+    if time < 510 Then
+      begin
+        pr2d_Rect( 0, 0, 800, 600, $AFAFAF, 510 - time, PR2D_FILL );
+        ssprite2d_Draw( texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time );
+      end;
+
+  if time > 255 Then
+    begin
+      pr2d_Rect( 0, 0, 256, 64, $80A080, 200, PR2D_FILL );
+      text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+      text_Draw( fntMain, 0, 20, 'Sprites: ' + u_IntToStr( sengine2d.Count ) );
+      text_Draw( fntMain, 0, 40, 'Up/Down - Add/Delete Miku :)' );
+    end;
+  batch2d_End();
+end;
+
+procedure Timer;
+begin
+  INC( time );
+
+  // RU: Выполн�ем обработку в�ех �прайтов в текущем �прайтовом менеджере.
+  // EN: Process all sprites contained in current sprite engine.
+  sengine2d_Proc();
+end;
+
+procedure KeyMouseEvent;
+begin
+  // RU: По нажатию пробела очи�тить в�е �прайты.
+  // EN: Delete all sprites if space was pressed.
+  if key_Press( K_SPACE ) Then
+    sengine2d_ClearAll();
+  if key_Press( K_UP ) Then
+    AddMiku();
+  if key_Press( K_DOWN ) Then
+    DelMiku();
+end;
+
+procedure Quit;
+begin
+  // RU: Очищаем пам�ть от �озданных �прайтов.
+  // EN: Free allocated memory for sprites.
+  sengine2d_Set( @sengine2d );
+  sengine2d_ClearAll();
+end;
+
+Begin
+  {$IFNDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+
+  randomize;
+
+  TimeStart := timer_Add( @Timer, 16, Start );
+  // RU: Таймер � задержкой в 6 �екунд.
+  // EN: Timer with a 6 second delay.
+  TimeMiku := timer_Add( @AddMiku, 1000, SleepToStart, 6);
+
+  zgl_SetEventsInterval(16);
+  zgl_Reg(SYS_EVENTS, @KEyMouseEvent);
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+  zgl_Reg( SYS_EXIT, @Quit );
+
+  wnd_SetCaption(utf8_Copy('08 - Sprite Engine'));
+
+  zgl_Init();
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/08 - Sprite Engine/demo08_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 83 - 63
Zengl_SRC/demos/FreePascal/09 - Sprite Engine(Classes)/demo09.pas

@@ -3,63 +3,71 @@ program demo09;
 {$I zglCustomConfig.cfg}
 
 uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
   zglSpriteEngine,
+  {$IFDEF USE_ZENGL_STATIC}
   zgl_screen,
   zgl_window,
-  zgl_application,
   zgl_timers,
   zgl_keyboard,
   zgl_render_2d,
   zgl_fx,
   zgl_textures,
   zgl_textures_png,
+  zgl_textures_jpg,
   zgl_sprite_2d,
   zgl_primitives_2d,
   zgl_font,
   zgl_text,
   zgl_types,
   zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
   ;
 
 type
   CMiku = class(zglCSprite2D)
   protected
-    FSpeed: zglTPoint2D;
+    FSpeed : zglTPoint2D;
   public
-    procedure OnInit(_Texture: zglPTexture; _Layer: Integer); override;
+    procedure OnInit( _Texture : zglPTexture; _Layer : Integer ); override;
     procedure OnDraw; override;
     procedure OnProc; override;
     procedure OnFree; override;
   end;
 
 var
-  dirRes   : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain  : Byte;
-  texLogo  : zglPTexture;
-  texMiku  : zglPTexture;
-  time     : Integer;
-  sengine2d: zglCSEngine2D;
-  TimeStart : Byte;
-  TimeMiku  : Byte;
+  dirRes    : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain   : Byte;
+  texLogo   : zglPTexture;
+  texMiku   : zglPTexture;
+  time      : Integer;
+  sengine2d : zglCSEngine2D;
+
+  TimeStart : Byte = 0;
+  TimeMiku  : Byte = 0;
 
 // Miku
-procedure CMiku.OnInit(_Texture: zglPTexture; _Layer: Integer);
+procedure CMiku.OnInit( _Texture : zglPTexture; _Layer : Integer );
 begin
-  // RU: Óêàæåì ñâîþ òåêñòóðó è ñëîé äëÿ ñïðàéòà, çàîäíî óñòàíîâÿòñÿ ñòàíäàðòíûå ïàðàìåòðû âðîäå øèðèíû è âûñîòû íà îñíîâå äàííûõ î êàäðå â òåêñòóðå.
+  // RU: Укажем �вою тек�туру и �лой дл� �прайта, заодно у�танов�т�� �тандартные параметры вроде ширины и вы�оты на о�нове данных о кадре в тек�туре.
   // EN: Set own texture and layer for sprite, also standard parameters will be set automatically(like width and height from info about texture).
-  inherited OnInit(texMiku, random(10));
+  inherited OnInit( texMiku, random( 10 ) );
 
-  X := 800 + random(800);
-  Y := random(600 - 128);
-  // RU: Çàäàåì ñêîðîñòü äâèæåíèÿ.
+  X := 800 + random( 800 );
+  Y := random( 600 - 128 );
+  // RU: Задаем �коро�ть движени�.
   // EN: Set the moving speed.
-  FSpeed.X := -random(10) / 5 - 0.5;
-  FSpeed.Y := (random(10) - 5) / 5;
+  FSpeed.X := -random( 10 ) / 5 - 0.5;
+  FSpeed.Y := ( random( 10 ) - 5 ) / 5;
 end;
 
 procedure CMiku.OnDraw;
 begin
-  // RU: Ò.ê. ïî ñóòè ýòà ïðîöåäóðà îáúÿâëåíà òîëüêî äëÿ ïðèìåðà, òî âûçîâåì îñíîâíîé ìåòîä OnDraw êëàññà zglCSprite2D.
+  // RU: Т.к. по �ути �та процедура объ�влена только дл� примера, то вызовем о�новной метод OnDraw кла��а zglCSprite2D.
   // EN: Because in fact, this procedure is declared only for example, so call to the main method OnDraw of class zglCSprite2D.
   inherited;
 end;
@@ -69,15 +77,15 @@ begin
   inherited;
   X := X + FSpeed.X;
   Y := Y + FSpeed.Y;
-  Frame := Frame + (abs(FSpeed.X) + abs(FSpeed.Y)) / 25;
+  Frame := Frame + ( abs( FSpeed.X ) + abs( FSpeed.Y ) ) / 25;
   if Frame > 8 Then
     Frame := 1;
 
-  // RU: Åñëè ñïðàéò âûõîäèò çà ïðåäåëû ïî X, ñðàçó æå óäàëÿåì åãî.
+  // RU: Е�ли �прайт выходит за пределы по X, �разу же удал�ем его.
   // EN: Delete the sprite if it goes beyond X.
-  if X < -128 Then sengine2d.DelSprite(ID);
+  if X < -128 Then sengine2d.DelSprite( ID );
 
-  // RU: Åñëè ñïðàéò âûõîäèò çà ïðåäåëû ïî Y, ñòàâèì åãî â î÷åðåäü íà óäàëåíèå
+  // RU: Е�ли �прайт выходит за пределы по Y, �тавим его в очередь на удаление
   // EN: Add sprite to queue for delete if it goes beyond Y.
   if Y < -128 Then Kill := TRUE;
   if Y > 600  Then Kill := TRUE;
@@ -88,117 +96,129 @@ begin
   inherited;
 end;
 
-// RU: Äîáàâèòü 100 ñïðàéòîâ.
+// RU: Добавить 100 �прайтов.
 // EN: Add 100 sprites.
 procedure AddMiku;
   var
-    i, ID: Integer;
+    i, ID : Integer;
 begin
   for i := 1 to 100 do
     begin
-      // RU: Çàïðàøèâàåì ó ñïðàéòîâîãî ìåíåäæåðà íîâîå "ìåñòî" ïîä ñïðàéò :)
+      // RU: Запрашиваем у �прайтового менеджера новое "ме�то" под �прайт :)
       // EN: Request a "place" for a new sprite :)
       ID := sengine2d.AddSprite();
-      // RU: Ñîçäàåì ýêçåìïëÿð ñïðàéòà CMiku. Àðãóìåíòàìè êîíñòðóêòîðà ÿâëÿþòñÿ ñàì ìåíåäæåð è áóäóùèé ID äëÿ ñïðàéòà.
+      // RU: Создаем �кземпл�р �прайта CMiku. �ргументами кон�труктора �вл�ют�� �ам менеджер и будущий ID дл� �прайта.
       // EN: Create a new CMiku. Constructor arguments must be current sprite engine and future ID for sprite.
-      sengine2d.List[ID] := CMiku.Create(sengine2d, ID);
+      sengine2d.List[ ID ] := CMiku.Create( sengine2d, ID );
     end;
 end;
 
-// RU: Óäàëèòü 100 ñïðàéòîâ.
+// RU: Удалить 100 �прайтов.
 // EN: Delete 100 sprites.
 procedure DelMiku;
   var
-    i: Integer;
+    i : Integer;
 begin
-  // RU: Óäàëèì 100 ñïðàéòîâ ñî ñëó÷àéíûì ID.
+  // RU: Удалим 100 �прайтов �о �лучайным ID.
   // EN: Delete 100 sprites with random ID.
   for i := 1 to 100 do
-    sengine2d.DelSprite(random(sengine2d.Count));
+    sengine2d.DelSprite( random( sengine2d.Count ) );
 end;
 
 procedure Init;
   var
-    i: Integer;
+    i : Integer;
 begin
-  texLogo := tex_LoadFromFile(dirRes + 'zengl.png');
+  texLogo := tex_LoadFromFile( dirRes + 'zengl.png' );
 
-  texMiku := tex_LoadFromFile(dirRes + 'miku.png');
-  tex_SetFrameSize(texMiku, 128, 128);
+  texMiku := tex_LoadFromFile( dirRes + 'miku.png' );
+  tex_SetFrameSize( texMiku, 128, 128 );
 
-  // RU: Ñîçäàåì ýêçåìïëÿð zglCSEngine2D.
+  // RU: Создаем �кземпл�р zglCSEngine2D.
   // EN: Create zglCSEngine2D object.
   sengine2d := zglCSEngine2D.Create();
 
-  // RU: Ñîçäàäèì 1000 ñïðàéòîâ Miku-chan :)
+  // RU: Создадим 1000 �прайтов Miku-chan :)
   // EN: Create 1000 sprites of Miku-chan :)
-//  for i := 0 to 9 do
-//    AddMiku();
+{  for i := 0 to 9 do
+    AddMiku(); }
 
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
 begin
-  setTextScale(15, fntMain);
 //  batch2d_Begin();
-  // RU: Ðèñóåì âñå ñïðàéòû íàõîäÿùèåñÿ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
+  // RU: Ри�уем в�е �прайты наход�щие�� в текущем �прайтовом менеджере.
   // EN: Render all sprites contained in current sprite engine.
   if time > 255 Then
     sengine2d.Draw();
 
   if time <= 255 Then
+  begin
+    pr2d_Rect(0, 0, 800, 600, $7FAF7F, 255, PR2D_FILL);
     ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, time)
+  end
   else
     if time < 510 Then
       begin
-        pr2d_Rect(0, 0, 800, 600, $000000, 510 - time, PR2D_FILL);
-        ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time);
+        pr2d_Rect( 0, 0, 800, 600, $AFAFAF, 510 - time, PR2D_FILL );
+        ssprite2d_Draw( texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time );
       end;
 
   if time > 255 Then
     begin
-      pr2d_Rect(0, 0, 256, 64, $000000, 200, PR2D_FILL);
-      text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-      text_Draw(fntMain, 0, 20, 'Sprites: ' + u_IntToStr(sengine2d.Count));
-      text_Draw(fntMain, 0, 40, 'Up/Down - Add/Delete Miku :)');
+      pr2d_Rect( 0, 0, 256, 64, $80A080, 200, PR2D_FILL );
+      text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+      text_Draw( fntMain, 0, 20, 'Sprites: ' + u_IntToStr( sengine2d.Count ) );
+      text_Draw( fntMain, 0, 40, 'Up/Down - Add/Delete Miku :)' );
     end;
 //  batch2d_End();
 end;
 
 procedure Timer;
 begin
-  INC(time, 2);
+  INC( time );
 
-  // RU: Âûïîëíÿåì îáðàáîòêó âñåõ ñïðàéòîâ â òåêóùåì ñïðàéòîâîì ìåíåäæåðå.
+  // RU: Выполн�ем обработку в�ех �прайтов в текущем �прайтовом менеджере.
   // EN: Process all sprites contained in current sprite engine.
   sengine2d.Proc();
+end;
 
-  // RU: Ïî íàæàòèþ ïðîáåëà î÷èñòèòü âñå ñïðàéòû.
+procedure KeyMouseEvent;
+begin
+  // RU: По нажатию пробела очи�тить в�е �прайты.
   // EN: Delete all sprites if space was pressed.
-  if key_Press(K_SPACE) Then sengine2d.ClearAll();
-  if key_Press(K_UP) Then AddMiku();
-  if key_Press(K_DOWN) Then DelMiku();
-
-  key_ClearState();
+  if key_Press( K_SPACE ) Then
+    sengine2d.ClearAll();
+  if key_Press( K_UP ) Then
+    AddMiku();
+  if key_Press( K_DOWN ) Then
+    DelMiku();
 end;
 
 procedure Quit;
 begin
-  // RU: Î÷èùàåì ïàìÿòü îò ñîçäàííûõ ñïðàéòîâ.
+  // RU: Очищаем пам�ть от �озданных �прайтов.
   // EN: Free allocated memory for sprites.
   sengine2d.Destroy();
 end;
 
 Begin
+  {$IFNDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+
   randomize();
 
   TimeStart := timer_Add( @Timer, 16, Start );
-  TimeMiku := timer_Add( @AddMiku, 1000, SleepToStart, 10 );
+  TimeMiku := timer_Add( @AddMiku, 1000, SleepToStart, 6 );
 
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-  zgl_Reg(SYS_EXIT, @Quit);
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+  zgl_Reg( SYS_EXIT, @Quit );
 
   wnd_SetCaption(utf8_Copy('09 - Sprite Engine(Classes)'));
 

+ 1 - 1
Zengl_SRC/demos/FreePascal/09 - Sprite Engine(Classes)/demo09_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 91 - 90
Zengl_SRC/demos/FreePascal/10 - Tiles/demo10.pas

@@ -1,90 +1,91 @@
-program demo10;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_fx,
-  zgl_file,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_textures_jpg,
-  zgl_tiles_2d,
-  zgl_font,
-  zgl_text,
-  zgl_math_2d,
-  zgl_utils
-  ;
-
-var
-  dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain : Byte;
-  map     : zglTTiles2D;
-  texTiles: zglPTexture;
-  TimeStart: Byte;
-
-procedure Init;
-  var
-    i, j: Integer;
-    f   : zglTFile;
-begin
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-
-  texTiles := tex_LoadFromFile(dirRes + 'tiles.png');
-  tex_SetFrameSize(texTiles, 32, 32);
-
-  // RU: Èíèöèàëèçàöèÿ òàéëîâ ðàçìåðîì 32x32. Ïàðàìåòð Count óêàçûâàåò íà êîëè÷åñòâî òàéëîâ ïî X è Y. Ìàññèâ Tiles ñîäåðæèò êàäðû äëÿ êàæäîãî òàéëà.
-  // EN: Initialization of tiles with size 32x32. Parameter Count set amount of tiles on X and Y. Array Tiles contains frames for every tile.
-  map.Width  := 32;
-  map.Height  := 32;
-  map.X := 25;
-  map.Y := 19;
-  SetLength(map.Tiles, map.X, map.Y);
-  // RU: Çàïîëíÿåì êàðòó "òðàâîé", 19 êàäð.
-  // EN: Fill the map by "grass", 19 frame.
-  for i := 0 to map.X - 1 do
-    for j := 0 to map.Y - 1 do
-      map.Tiles[i, j] := 19;
-
-  // RU: Çàãðóæàåì êàðòó èç áèíàðíîãî ôàéëà.
-  // EN: Load map from binary file.
-  file_Open(f, dirRes + 'ground.map', FOM_OPENR);
-  for i := 0 to map.X - 1 do
-    file_Read(f, map.Tiles[i, 0], map.Y * SizeOf(Integer));
-  file_Close(f);
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-begin
-  // RU: Ðåíäåðèì òàéëû â êîîðäèíàòàõ 0,0.
-  // EN: Render tiles in coordinates 0,0.
-  tiles2d_Draw(texTiles, 0, 0, @map);
-
-  text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-
-  text_Draw(fntMain, 180, 30, 'This is a tarrible example of tile map, but main idea should be clear :)');
-end;
-
-procedure Timer;
-begin
-//  if key_Press(K_ESCAPE) Then winOn := FALSE;
-
-  key_ClearState();
-end;
-
-Begin
-  randomize();
-
-  TimeStart := timer_Add(@Timer, 16, Start);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-
-  wnd_SetCaption(utf8_Copy('10 - Tiles'));
-
-  zgl_Init();
-End.
+program demo10;
+
+{$I zglCustomConfig.cfg}
+
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_fx,
+  zgl_file,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_textures_jpg,
+  zgl_tiles_2d,
+  zgl_font,
+  zgl_text,
+  zgl_math_2d,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+var
+  dirRes   : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain  : Byte;
+  map      : zglTTiles2D;
+  texTiles : zglPTexture;
+
+procedure Init;
+  var
+    i, j : Integer;
+    f    : zglTFile;
+begin
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+
+  texTiles := tex_LoadFromFile( dirRes + 'tiles.png' );
+  tex_SetFrameSize( texTiles, 32, 32 );
+
+  // RU: Инициализаци� тайлов размером 32x32. Параметр Count указывает на количе�тво тайлов по X и Y. Ма��ив Tiles �одержит кадры дл� каждого тайла.
+  // EN: Initialization of tiles with size 32x32. Parameter Count set amount of tiles on X and Y. Array Tiles contains frames for every tile.
+  map.Width  := 32;
+  map.Height  := 32;
+  map.X := 25;
+  map.Y := 19;
+  SetLength( map.Tiles, map.X, map.Y );
+  // RU: Заполн�ем карту "травой", 19 кадр.
+  // EN: Fill the map by "grass", 19 frame.
+  for i := 0 to map.X - 1 do
+    for j := 0 to map.Y - 1 do
+      map.Tiles[ i, j ] := 19;
+
+  // RU: Загружаем карту из бинарного файла.
+  // EN: Load map from binary file.
+  file_Open( f, dirRes + 'ground.map', FOM_OPENR );
+  for i := 0 to map.X - 1 do
+    file_Read( f, map.Tiles[ i, 0 ], map.Y * SizeOf( Integer ) );
+  file_Close( f );
+  setFontTextScale(15, fntMain);
+end;
+
+procedure Draw;
+begin
+  // RU: Рендерим тайлы в координатах 0,0.
+  // EN: Render tiles in coordinates 0,0.
+  tiles2d_Draw( texTiles, 0, 0, @map );
+
+  text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+
+  text_Draw( fntMain, 180, 30, 'This is a tarrible example of tile map, but main idea should be clear :)' );
+end;
+
+Begin
+  {$IFNDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+
+  randomize();
+
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+
+  wnd_SetCaption(utf8_Copy('10 - Tiles'));
+
+  zgl_Init();
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/10 - Tiles/demo10_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 109 - 100
Zengl_SRC/demos/FreePascal/11 - Grid/demo11.pas

@@ -1,100 +1,109 @@
-program demo11;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_fx,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_textures_jpg,
-  zgl_grid_2d,
-  zgl_font,
-  zgl_text,
-  zgl_math_2d,
-  zgl_utils
-  ;
-
-var
-  dirRes     : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain    : Byte;
-  texBack    : zglPTexture;
-  grid       : zglTGrid2D;
-  wave       : Single;
-  TimeStart  : Byte;
-
-procedure Init;
-  var
-    i, j: Integer;
-begin
-  texBack := tex_LoadFromFile(dirRes + 'back04.jpg');
-
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-
-  // RU: Èíèöèàëèçàöèÿ ñåòêè ðàçìåðîì 21x16. Îñíîâíàÿ èäåÿ - êàæäûé óçåë ñåòêè ýòî ñìåùåíèå îòíîñèòåëüíî å¸ âåðõíåãî ëåâîãî óãëà.
-  // EN: Initialization of grid with size 21x16. Main idea - every node of grid is an offset from the top left corner.
-  grid.Cols := 21;
-  grid.Rows := 16;
-  SetLength(grid.Grid, grid.Cols, grid.Rows);
-  for i := 0 to grid.Cols - 1 do
-    for j := 0 to grid.Rows - 1 do
-      begin
-        grid.Grid[i, j].X := i * 40;
-        grid.Grid[i, j].Y := j * 40;
-      end;
-
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-begin
-  // RU: Ðåíäåðèì ñåòêó â êîîðäèíàòàõ 0,0.
-  // EN: Render grid in coordinates 0,0.
-  sgrid2d_Draw(texBack, 0, 0, @grid);
-
-  text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-end;
-
-procedure Timer;
-  var
-    i, j: Integer;
-    cwave, swave: Single;
-begin
-  wave  := wave + random(1000) / 10000;
-  cwave := cos(wave);
-  swave := sin(wave);
-
-  // RU: Ñèìóëÿöèÿ ïðîñòîãî ýôôåêòà ïîä âîäîé.
-  // EN: Simulation of simple underwater effect.
-  for i := 1 to grid.Cols - 2 do
-    for j := 1 to grid.Rows - 2 do
-    begin
-      if (i mod 2 = 0) and (j mod 2 = 0) Then
-      begin
-        grid.Grid[i, j].X := i * 40 + cwave;
-        grid.Grid[i, j].Y := j * 40 + swave;
-      end else
-      begin
-        grid.Grid[i, j].X := i * 40 - cwave;
-        grid.Grid[i, j].Y := j * 40 - swave;
-      end;
-    end;
-
-  key_ClearState();
-end;
-
-Begin
-  randomize();
-
-  TimeStart := timer_Add(@Timer, 16, SleepToStart, 3);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-
-  wnd_SetCaption(utf8_Copy('11 - Grid'));
-
-  zgl_Init();
-End.
+program demo11;
+
+{$I zglCustomConfig.cfg}
+
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_fx,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_textures_jpg,
+  zgl_grid_2d,
+  zgl_font,
+  zgl_text,
+  zgl_math_2d,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+var
+  dirRes      : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain     : Byte;
+  texBack     : zglPTexture;
+  grid        : zglTGrid2D;
+  wave        : Single;
+
+  TimeStart  : Byte = 0;
+
+procedure Init;
+  var
+    i, j : Integer;
+begin
+  texBack := tex_LoadFromFile( dirRes + 'back04.jpg' );
+
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+
+  // RU: Инициализаци� �етки размером 21x16. О�новна� иде� - каждый узел �етки �то �мещение отно�ительно её верхнего левого угла.
+  // EN: Initialization of grid with size 21x16. Main idea - every node of grid is an offset from the top left corner.
+  grid.Cols := 21;
+  grid.Rows := 16;
+  SetLength( grid.Grid, grid.Cols, grid.Rows );
+  for i := 0 to grid.Cols - 1 do
+    for j := 0 to grid.Rows - 1 do
+      begin
+        grid.Grid[ i, j ].X := i * 40;
+        grid.Grid[ i, j ].Y := j * 40;
+      end;
+  setFontTextScale(15, fntMain);
+end;
+
+procedure Draw;
+begin
+  // RU: Рендерим �етку в координатах 0,0.
+  // EN: Render grid in coordinates 0,0.
+  sgrid2d_Draw( texBack, 0, 0, @grid );
+
+  text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+end;
+
+procedure Timer;
+  var
+    i, j : Integer;
+    cwave, swave : Single;
+begin
+  wave  := wave + random( 1000 ) / 10000;
+  cwave := cos( wave );
+  swave := sin( wave );
+
+  // RU: Симул�ци� про�того �ффекта под водой.
+  // EN: Simulation of simple underwater effect.
+  for i := 1 to grid.Cols - 2 do
+    for j := 1 to grid.Rows - 2 do
+      begin
+        if ( i mod 2 = 0 ) and ( j mod 2 = 0 ) Then
+          begin
+            grid.Grid[ i, j ].X := i * 40 + cwave;
+            grid.Grid[ i, j ].Y := j * 40 + swave;
+          end else
+            begin
+              grid.Grid[ i, j ].X := i * 40 - cwave;
+              grid.Grid[ i, j ].Y := j * 40 - swave;
+            end;
+      end;
+end;
+
+Begin
+  {$IFNDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+
+  randomize();
+
+  TimeStart := timer_Add( @Timer, 16, Start );
+
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+
+  wnd_SetCaption(utf8_Copy('11 - Grid'));
+
+  zgl_Init();
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/11 - Grid/demo11_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 93 - 90
Zengl_SRC/demos/FreePascal/12 - Render into Texture/demo12.pas

@@ -1,90 +1,93 @@
-program demo12;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_render_2d,
-  zgl_fx,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_render_target,
-  zgl_sprite_2d,
-  zgl_font,
-  zgl_text,
-  zgl_math_2d,
-  zgl_utils
-  ;
-
-var
-  dirRes   : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain  : Byte;
-  texTux   : zglPTexture;
-  rtFull   : zglPRenderTarget;
-  rtDefault: zglPRenderTarget;
-  TimeStart: Byte;
-
-procedure Init;
-begin
-  texTux := tex_LoadFromFile(dirRes + 'tux_stand.png');
-  tex_SetFrameSize(texTux, 64, 64);
-
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-
-  // RU: Ñîçäàåì RenderTarget è "öåïëÿåì" ïóñòóþ òåêñòóðó. Â ïðîöåññå òåêñòóðó ìîæíî ñìåíèòü ïðèñâîèâ rtarget.Surface äðóãóþ zglPTexture, ãëàâíîå ÷òî áû ñîâïàäàëè ðàçìåðû ñ òåìè, ÷òî óêàçàíû â
-  //     tex_CreateZero. Òàðãåòó òàêæå óêàçàí ôëàã RT_FULL_SCREEN, îòâå÷àþùèé çà òî, ÷òî áû â òåêñòóðó ïîìåùàëîñü âñå ñîäåðæèìîå ýêðàíà à íå îáëàñòü 256x256(êàê ñ ôëàãîì RT_DEFAULT).
-  // EN: Create a RenderTarget and "bind" empty texture to it. Later texture can be changed via changing rtarget.Surface to another zglPTexture, the only requirement - the same size, that was
-  //     set in tex_CreateZero. Also target use flag RT_FULL_SCREEN that responsible for rendering whole content of screen into target, not only region 256x256(like with flag RT_DEFAULT).
-  rtFull := rtarget_Add(tex_CreateZero(256, 256), RT_FULL_SCREEN);
-
-  // RU: Äëÿ ñðàâíåíèÿ ñîçäàäèì åù¸ îäèí RenderTarget ñ ôëàãîì RT_DEFAULT.
-  // EN: Create one more RenderTarget with flag RT_DEFAULT for comparison.
-  rtDefault := rtarget_Add(tex_CreateZero(256, 256), RT_DEFAULT);
-
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-begin
-  // RU: Óñòàíàâëèâàåì òåêóùèé RenderTarget.
-  // EN: Set current RenderTarget.
-  rtarget_Set(rtFull);
-  // RU: Ðèñóåì â íåãî.
-  // EN: Render to it.
-  asprite2d_Draw(texTux, random(800 - 64), random(600 - 64), 64, 64, 0, random(9) + 1);
-  // RU: Âîçâðàùàåìñÿ ê îáû÷íîìó ðåíäåðó.
-  // EN: Return to default rendering.
-  rtarget_Set(nil);
-
-  rtarget_Set(rtDefault);
-  asprite2d_Draw(texTux, random(800 - 64), random(600 - 64), 64, 64, 0, random(9) + 1);
-  rtarget_Set(nil);
-
-  // RU: Òåïåðü ðèñóåì ñîäåðæèìîå RenderTarget'îâ.
-  // EN: Render content of RenderTargets.
-  ssprite2d_Draw(rtFull.Surface, (400 - 256) / 2, (600 - 256) / 2, 256, 256, 0);
-  ssprite2d_Draw(rtDefault.Surface, (400 - 256) / 2 + 400, (600 - 256) / 2, 256, 256, 0);
-
-  text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-end;
-
-procedure Timer;
-begin
-  key_ClearState();
-end;
-
-Begin
-  randomize();
-
-  TimeStart := timer_Add(@Timer, 16, Start);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-
-  wnd_SetCaption(utf8_Copy('12 - Render into Texture'));
-
-  zgl_Init();
-End.
+program demo12;
+
+{$I zglCustomConfig.cfg}
+
+  // MacOS Cocoa not work. Deprecated.
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_render_2d,
+  zgl_fx,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_render_target,
+  zgl_sprite_2d,
+  zgl_font,
+  zgl_text,
+  zgl_math_2d,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+var
+  dirRes    : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain   : Byte;
+  texTux    : zglPTexture;
+  rtFull    : zglPRenderTarget;
+  rtDefault : zglPRenderTarget;
+
+procedure Init;
+begin
+  texTux := tex_LoadFromFile( dirRes + 'tux_stand.png' );
+  tex_SetFrameSize( texTux, 64, 64 );
+
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+  setFontTextScale(15, fntMain);
+
+  // RU: Создаем RenderTarget и "цепл�ем" пу�тую тек�туру. В проце��е тек�туру можно �менить при�воив rtarget.Surface другую zglPTexture, главное что бы �овпадали размеры � теми, что указаны в
+  //     tex_CreateZero. Таргету также указан флаг RT_FULL_SCREEN, отвечающий за то, что бы в тек�туру помещало�ь в�е �одержимое �крана а не обла�ть 256x256(как � флагом RT_DEFAULT).
+  // EN: Create a RenderTarget and "bind" empty texture to it. Later texture can be changed via changing rtarget.Surface to another zglPTexture, the only requirement - the same size, that was
+  //     set in tex_CreateZero. Also target use flag RT_FULL_SCREEN that responsible for rendering whole content of screen into target, not only region 256x256(like with flag RT_DEFAULT).
+  rtFull := rtarget_Add( tex_CreateZero( 256, 256 ), RT_FULL_SCREEN );
+
+  // RU: Дл� �равнени� �оздадим ещё один RenderTarget � флагом RT_DEFAULT.
+  // EN: Create one more RenderTarget with flag RT_DEFAULT for comparison.
+  rtDefault := rtarget_Add( tex_CreateZero( 256, 256 ), RT_DEFAULT );
+end;
+
+procedure Draw;
+begin
+  // RU: У�танавливаем текущий RenderTarget.
+  // EN: Set current RenderTarget.
+  rtarget_Set( rtFull );
+  // RU: Ри�уем в него.
+  // EN: Render to it.
+  asprite2d_Draw( texTux, random( 800 - 64 ), random( 600 - 64 ), 64, 64, 0, random( 9 ) + 1 );
+  // RU: Возвращаем�� к обычному рендеру.
+  // EN: Return to default rendering.
+  rtarget_Set( nil );
+
+  rtarget_Set( rtDefault );
+  asprite2d_Draw( texTux, random( 800 - 64 ), random( 600 - 64 ), 64, 64, 0, random( 9 ) + 1 );
+  rtarget_Set( nil );
+
+  // RU: Теперь ри�уем �одержимое RenderTarget'ов.
+  // EN: Render content of RenderTargets.
+  ssprite2d_Draw( rtFull.Surface, ( 400 - 256 ) / 2, ( 600 - 256 ) / 2, 256, 256, 0 );
+  ssprite2d_Draw( rtDefault.Surface, ( 400 - 256 ) / 2 + 400, ( 600 - 256 ) / 2, 256, 256, 0 );
+
+  text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+end;
+
+Begin
+  {$IFnDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+
+  randomize();
+
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+
+  wnd_SetCaption(utf8_Copy('12 - Render into Texture'));
+
+  zgl_Init();
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/12 - Render into Texture/demo12_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 138 - 131
Zengl_SRC/demos/FreePascal/13 - Particles/demo13.pas

@@ -1,131 +1,138 @@
-program demo13;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_render_2d,
-  zgl_fx,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_textures_jpg,
-  zgl_sprite_2d,
-  zgl_particles_2d,
-  zgl_primitives_2d,
-  zgl_font,
-  zgl_text,
-  zgl_math_2d,
-  zgl_utils
-  ;
-
-var
-  dirRes        : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain       : Byte;
-  texBack       : zglPTexture;
-  debug         : Boolean;
-  particles     : zglTPEngine2D;
-  emitterFire   : array[0..2] of zglPEmitter2D;
-  emitterDiamond: zglPEmitter2D;
-  emitterRain   : zglPEmitter2D;
-  TimeStart     : Byte;
-
-procedure Init;
-begin
-  texBack := tex_LoadFromFile(dirRes + 'back02.png');
-
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-
-  // EN: Load three types of fire emitters.
-  // RU: Çàãðóçêà òð¸õ ðàçíûõ âèäîâ ýìèòòåðîâ îãíÿ.
-  emitterFire[0] := emitter2d_LoadFromFile(dirRes + 'emitter_fire00.zei');
-  emitterFire[1] := emitter2d_LoadFromFile(dirRes + 'emitter_fire01.zei');
-  emitterFire[2] := emitter2d_LoadFromFile(dirRes + 'emitter_fire02.zei');
-
-  // EN: Set own particels engine.
-  // RU: Óñòàíîâêà ñîáñòâåííîãî äâèæêà ýìèòòåðîâ.
-  pengine2d_Set(@particles);
-
-  // EN: Add 6 fire emitters to particles engine. Second parameter of function returns pointer to instance of new emitter, which can be processed manually.
-  //     This instance will be nil after the death, so check everything.
-  // RU: Äîáàâëÿåì â äâèæîê 6 ýìèòòåðîâ îãíÿ. Âòîðîé ïàðàìåòð ôóíêöèè ïîçâîëÿåò ïîëó÷èòü óêàçàòåëü íà êîíêðåòíûé ýêçåìïëÿð ýìèòòåðà, êîòîðûé ìîæíî áóäåò îáðàáàòûâàòü âðó÷íóþ.
-  //     Äàííûé ýêçåìïëÿð ïîñëå ñìåðòè áóäåò ñîäåðæàòü nil, ïîýòîìó èñïîëüçóéòå ïðîâåðêó.
-  pengine2d_AddEmitter(emitterFire[0], nil, 642, 190);
-  pengine2d_AddEmitter(emitterFire[0], nil, 40, 368);
-  pengine2d_AddEmitter(emitterFire[0], nil, 246, 368);
-  pengine2d_AddEmitter(emitterFire[1], nil, 532, 244);
-  pengine2d_AddEmitter(emitterFire[1], nil, 318, 422);
-  pengine2d_AddEmitter(emitterFire[1], nil, 583, 420);
-  pengine2d_AddEmitter(emitterFire[2], nil, 740, 525);
-
-  emitterDiamond := emitter2d_LoadFromFile(dirRes + 'emitter_diamond.zei');
-  pengine2d_AddEmitter(emitterDiamond, nil);
-
-  emitterRain := emitter2d_LoadFromFile(dirRes + 'emitter_rain.zei');
-  pengine2d_AddEmitter(emitterRain, nil);
-
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-  var
-    i: Integer;
-begin
-  batch2d_Begin();
-
-  ssprite2d_Draw(texBack, 0, 0, 800, 600, 0);
-
-  // EN: Rendering of all emitters in current particles engine.
-  // RU: Ðåíäåðèíã âñåõ ýìèòòåðîâ â òåêóùåì äâèæêå ÷àñòèö.
-  pengine2d_Draw();
-
-  if debug Then
-    for i := 0 to particles.Count.Emitters - 1 do
-      with particles.List[i].BBox do
-        pr2d_Rect(MinX, MinY, MaxX - MinX, MaxY - MinY, $FF0000, 255);
-
-  text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-  text_Draw(fntMain, 0, 20, 'Particles: ' + u_IntToStr(particles.Count.Particles));
-  text_Draw(fntMain, 0, 40, 'Debug(F1): ' + u_BoolToStr(debug));
-
-  batch2d_End();
-end;
-
-procedure Timer;
-begin
-  if key_Press(K_F1) Then debug := not debug;
-
-  key_ClearState();
-end;
-
-procedure Update(dt: Double);
-begin
-  // EN: Process all emitters in current particles engine.
-  // RU: Îáðàáîòêà âñåõ ýìèòòåðîâ â òåêóùåì äâèæêå ÷àñòèö.
-  pengine2d_Proc(dt);
-end;
-
-procedure Quit;
-begin
-  // RU: Î÷èùàåì ïàìÿòü îò ñîçäàííûõ ýìèòòåðîâ.
-  // EN: Free allocated memory for emitters.
-  pengine2d_Set(@particles);
-  pengine2d_ClearAll();
-end;
-
-Begin
-  randomize();
-
-  TimeStart := timer_Add(@Timer, 16, Start);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-  zgl_Reg(SYS_UPDATE, @Update);
-  zgl_Reg(SYS_EXIT, @Quit);
-
-  wnd_SetCaption(utf8_Copy('13 - Particles'));
-
-  zgl_Init();
-End.
+program demo13;
+
+{$I zglCustomConfig.cfg}
+
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_render_2d,
+  zgl_fx,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_textures_jpg,
+  zgl_sprite_2d,
+  zgl_particles_2d,
+  zgl_primitives_2d,
+  zgl_font,
+  zgl_text,
+  zgl_math_2d,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+var
+  dirRes         : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain        : Byte;
+  texBack        : zglPTexture;
+  debug          : Boolean;
+  particles      : zglTPEngine2D;
+  emitterFire    : array[ 0..2 ] of zglPEmitter2D;
+  emitterDiamond : zglPEmitter2D;
+  emitterRain    : zglPEmitter2D;
+
+procedure Init;
+  var
+    i : Integer;
+begin
+  texBack := tex_LoadFromFile( dirRes + 'back02.png' );
+
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+  setFontTextScale(15, fntMain);
+
+  // EN: Load three types of fire emitters.
+  // RU: Загрузка трёх разных видов �миттеров огн�.
+  emitterFire[ 0 ] := emitter2d_LoadFromFile( dirRes + 'emitter_fire00.zei' );
+  emitterFire[ 1 ] := emitter2d_LoadFromFile( dirRes + 'emitter_fire01.zei' );
+  emitterFire[ 2 ] := emitter2d_LoadFromFile( dirRes + 'emitter_fire02.zei' );
+
+  // EN: Set own particels engine.
+  // RU: У�тановка �об�твенного движка �миттеров.
+  pengine2d_Set( @particles );
+
+  // EN: Add 6 fire emitters to particles engine. Second parameter of function returns pointer to instance of new emitter, which can be processed manually.
+  //     This instance will be nil after the death, so check everything.
+  // RU: Добавл�ем в движок 6 �миттеров огн�. Второй параметр функции позвол�ет получить указатель на конкретный �кземпл�р �миттера, который можно будет обрабатывать вручную.
+  //     Данный �кземпл�р по�ле �мерти будет �одержать nil, по�тому и�пользуйте проверку.
+  pengine2d_AddEmitter( emitterFire[ 0 ], nil, 642, 190 );
+  pengine2d_AddEmitter( emitterFire[ 0 ], nil, 40, 368 );
+  pengine2d_AddEmitter( emitterFire[ 0 ], nil, 246, 368 );
+  pengine2d_AddEmitter( emitterFire[ 1 ], nil, 532, 244 );
+  pengine2d_AddEmitter( emitterFire[ 1 ], nil, 318, 422 );
+  pengine2d_AddEmitter( emitterFire[ 1 ], nil, 583, 420 );
+  pengine2d_AddEmitter( emitterFire[ 2 ], nil, 740, 525 );
+
+  emitterDiamond := emitter2d_LoadFromFile( dirRes + 'emitter_diamond.zei' );
+  pengine2d_AddEmitter( emitterDiamond, nil );
+
+  emitterRain := emitter2d_LoadFromFile( dirRes + 'emitter_rain.zei' );
+  pengine2d_AddEmitter( emitterRain, nil );
+end;
+
+procedure Draw;
+  var
+    i : Integer;
+begin
+//  batch2d_Begin();
+
+  ssprite2d_Draw( texBack, 0, 0, 800, 600, 0 );
+
+  // EN: Rendering of all emitters in current particles engine.
+  // RU: Рендеринг в�ех �миттеров в текущем движке ча�тиц.
+  pengine2d_Draw();
+
+  if debug Then
+    for i := 0 to particles.Count.Emitters - 1 do
+      with particles.List[ i ].BBox do
+        pr2d_Rect( MinX, MinY, MaxX - MinX, MaxY - MinY, $FF0000, 255 );
+
+  text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+  text_Draw( fntMain, 0, 20, 'Particles: ' + u_IntToStr( particles.Count.Particles ) );
+  text_Draw( fntMain, 0, 40, 'Debug(F1): ' + u_BoolToStr( debug ) );
+
+//  batch2d_End();
+end;
+
+procedure KeyMouseEvent;
+begin
+  if key_Press( K_F1 ) Then debug := not debug;
+end;
+
+procedure Update( dt : Double );
+begin
+  // EN: Process all emitters in current particles engine.
+  // RU: Обработка в�ех �миттеров в текущем движке ча�тиц.
+  pengine2d_Proc( dt );
+end;
+
+procedure Quit;
+begin
+  // RU: Очищаем пам�ть от �озданных �миттеров.
+  // EN: Free allocated memory for emitters.
+  pengine2d_Set( @particles );
+  pengine2d_ClearAll();
+end;
+
+Begin
+  {$IFnDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+  randomize();
+
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+  zgl_Reg( SYS_UPDATE, @Update );
+  zgl_Reg( SYS_EXIT, @Quit );
+
+  wnd_SetCaption(utf8_Copy('13 - Particles'));
+
+  zgl_Init();
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/13 - Particles/demo13_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 178 - 167
Zengl_SRC/demos/FreePascal/14 - Sound/demo14.pas

@@ -1,167 +1,178 @@
-program demo14;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_mouse,
-  zgl_render_2d,
-  zgl_fx,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_font,
-  zgl_text,
-  zgl_sprite_2d,
-  zgl_sound,
-  zgl_sound_wav,
-  zgl_sound_ogg,
-  zgl_types,
-  zgl_collision_2d,
-  zgl_utils,
-  zgl_memory
-  ;
-
-const
-  SCREEN_WIDTH  = 800;
-  SCREEN_HEIGHT = 600;
-
-var
-  dirRes : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain: Byte;
-  icon   : array[0..1] of zglPTexture;
-  sound  : zglPSound;
-  audio  : Integer;
-  state  : Integer;
-
-  musicMem: zglTMemory;
-
-  // äîáàâëÿåì íîìåð çâóêà, ïîêà äëÿ îäíîãî çâóêà
-  IDSound: Integer;
-  TimeStart: Byte;
-
-// RU: Ò.ê. çâóêîâàÿ ïîäñèñòåìà íàöåëåíà íà 3D, äëÿ ïîçèöèîíèðîâàíèÿ çâóêîâ â 2D íóæíû íåêîòîðûå óõèùðåíèÿ.
-// EN: Because sound subsystem using 3D, there is some tricky way to calculate sound position in 2D.
-function CalcX2D(const X: Single): Single;
-begin
-  Result := (X - SCREEN_WIDTH / 2) * (20 / SCREEN_WIDTH / 2);          // ñìåíèë ñìåùåíèå ïî X è Y, òåïåðü áîëåå ÿâíî ìîæíî
-end;                                                                    // îòäàëèòü/ïðèáëèçèòü çâóê
-
-function CalcY2D(const Y: Single): Single;
-begin
-  Result := (Y - SCREEN_HEIGHT / 2) * (20 / SCREEN_HEIGHT / 2);
-end;
-
-procedure Init;
-begin
-  // RU: Èíèöèàëèçèðóåì çâóêîâóþ ïîäñèñòåìó. Äëÿ Windows ìîæíî ñäåëàòü âûáîð ìåæäó DirectSound è OpenAL îòðåäàêòèðîâàâ ôàéë zgl_config.cfg.
-  // EN: Initializing sound subsystem. For Windows can be used DirectSound or OpenAL, see zgl_config.cfg.
-  snd_Init();
-
-  // RU: Çàãðóæàåì çâóêîâîé ôàéë è óñòàíàâëèâàåì äëÿ íåãî ìàêñèìàëüíîe êîëè÷åñòâî ïðîèãðûâàåìûõ èñòî÷íèêîâ â 2.
-  // EN: Load the sound file and set maximum count of sources that can be played to 2.
-  sound := snd_LoadFromFile(dirRes + 'click.wav', 2);
-
-  // RU: Çàãðóæàåì òåêñòóðû, êîòîðûå áóäóò èíäèêàòîðàìè.
-  // EN: Load the textures, that will be indicators.
-  icon[0] := tex_LoadFromFile(dirRes + 'audio-stop.png');
-  icon[1] := tex_LoadFromFile(dirRes + 'audio-play.png');
-
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-  var
-    r: zglTRect;
-begin
-  ssprite2d_Draw(icon[state], (SCREEN_WIDTH - 128) / 2, (SCREEN_HEIGHT - 128) / 2, 128, 128, 0);
-  text_Draw(fntMain, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 64, 'Skillet - Comatose - Whispers In The Dark', TEXT_HALIGN_CENTER);
-
-  r.X := (SCREEN_WIDTH - 128) / 2;
-  r.Y := (SCREEN_HEIGHT - 128) / 2;
-  r.W := 128;
-  r.H := 128;
-  if col2d_PointInRect(mouseX, mouseY, r) Then
-    begin
-      fx_SetBlendMode(FX_BLEND_ADD);
-      ssprite2d_Draw(icon[state], (SCREEN_WIDTH - 132) / 2, (SCREEN_HEIGHT - 132) / 2, 132, 132, 0, 155);
-      fx_SetBlendMode(FX_BLEND_NORMAL);
-    end;
-end;
-
-procedure Timer;
-  var
-    r: zglTRect;
-    p: Integer;
-begin
-  // RU: Ïðîâåðÿåì èãðàåò ëè ìóçûêà(1 - èãðàåò, 0 - íå èãðàåò). Òàê æå ìîæíî ïðîâåðèòü è çâóêè - ïîäñòàâèâ zglPSound è ID âîò òàê:
-  //     snd_Get(Sound, ID...
-  //     ID âîçâðàùàåòñÿ ôóíêöèåé snd_Play
-  //
-  // EN: Check if music playing(1 - playing, 0 - not playing). Sounds also can be checked this way - just use zglPSound and ID:
-  //     snd_Get(Sound, ID...
-  //     ID returns by function snd_Play.
-  state := snd_Get(SND_STREAM, audio, SND_STATE_PLAYING);
-  if state = 0 Then
-    audio := 0;
-
-  if mBClickCanClick(M_BLEFT_CLICK) Then
-  begin
-      // RU:  äàííîì ñëó÷àå ìû íà÷èíàåì âîñïðîèçâîäèòü çâóê ñðàçó â óêàçàííûõ êîîðäèíàòàõ, íî èõ ìîæíî ìåíÿòü è â ïðîöåññå èñïîëüçóÿ ïðîöåäóðó snd_SetPos.
-      //     Âàæíî: Äëÿ OpenAL ìîæíî ïîçèöèîíèðîâàòü òîëüêî mono-çâóêè
-      //
-      // EN: In this case, we begin to play the sound directly in these coordinates, but they can be changed later using procedure snd_SetPos.
-      //     Important: OpenAL can position only mono-sounds.
-
-// ýòà ÷àñòü èçìåíåíà!!! Òåïåðü ìîæíî çàíîâî âîñïðîèçâîäèòü çâóêè, äàæå åñëè îíè íå çàêîí÷èëè èãðàòü.
-    if snd_Get(sound, IDSound, SND_STATE_PLAYING) = IDSound then
-      snd_Stop(sound, IDSound);
-    IDSound := snd_Play(sound, FALSE, CalcX2D(mouse_X), CalcY2D(mouse_Y));
-// ------------------------------------------------------------------------------------------
-
-    r.X := (SCREEN_WIDTH - 128) / 2;
-    r.Y := (SCREEN_HEIGHT - 128) / 2;
-    r.W := 128;
-    r.H := 128;
-
-// äîáàâëÿåì ïðîâåðêó íà ïðîèãðûâàíèå çâóêà, òîëüêî åñëè ìíîãî ðàçâíûõ çâóêîâ/ìóçûêè, òî íîìåðà íàäî ìåíÿòü (íå òîëüêî 1!!!)
-    if col2d_PointInRect(mouse_X, mouse_Y, r) and (audio = 1) Then
-    begin
-      p := snd_Get(SND_STREAM, audio, SND_STATE_PLAYING);
-      if p = 1 then
-        snd_StopStream(audio);
-    end;
-// ---------------------------------------------------------------------------------------------------------------
-
-    if col2d_PointInRect(mouse_X, mouse_Y, r) and (audio = 0) Then
-      audio := snd_PlayFile(dirRes + 'music.ogg');
-
-  end;
-
-  // RU: Ïîëó÷àåì â ïðîöåíòàõ ïîçèöèþ ïðîèãðûâàíèÿ àóäèîïîòîêà è ñòàâèì ãðîìêîñòü äëÿ ïëàâíûõ ïåðåõîäîâ.
-  // EN: Get position in percent's for audio stream and set volume for smooth playing.
-  p := snd_Get(SND_STREAM, audio, SND_STATE_PERCENT);
-  if (p >= 0) and (p < 25) Then
-    snd_SetVolume(SND_STREAM, audio, (1 / 24) * p);
-  if (p >= 75) and (p < 100) Then
-    snd_SetVolume(SND_STREAM, audio, 1 - (1 / 24) * (p - 75));
-
-  key_ClearState();
-  mouse_ClearState();
-end;
-
-Begin
-  randomize();
-
-  TimeStart := timer_Add(@Timer, 16, Start);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-
-  wnd_SetCaption(utf8_Copy('14 - Sound'));
-
-  zgl_Init();
-End.
+program demo14;
+
+{$I zglCustomConfig.cfg}
+
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_mouse,
+  zgl_render_2d,
+  zgl_fx,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_font,
+  zgl_text,
+  zgl_sprite_2d,
+  zgl_sound,
+  zgl_sound_wav,
+  zgl_sound_ogg,
+  zgl_types,
+  zgl_collision_2d,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+const
+  SCREEN_WIDTH  = 800;
+  SCREEN_HEIGHT = 600;
+
+var
+  dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain : Byte;
+  icon    : array[ 0..1 ] of zglPTexture;
+  sound   : zglPSound;
+  audio   : Integer;
+  state   : Integer;
+
+  // добавл�ем номер звука, пока дл� одного звука
+  IDSound : Integer;
+
+  TimeStart: Byte = 0;
+
+  p : Integer;
+
+// RU: Т.к. звукова� под�и�тема нацелена на 3D, дл� позиционировани� звуков в 2D нужны некоторые ухищрени�.
+// EN: Because sound subsystem using 3D, there is some tricky way to calculate sound position in 2D.
+function CalcX2D( const X : Single ) : Single;
+begin
+  Result := ( X - SCREEN_WIDTH / 2 ) * ( 10 / SCREEN_WIDTH / 2 );             // �менил �мещение по X и Y, теперь более �вно можно
+end;                                                                           // отдалить/приблизить звук
+
+function CalcY2D( const Y : Single ) : Single;
+begin
+  Result := ( Y - SCREEN_HEIGHT / 2 ) * ( 10 / SCREEN_HEIGHT / 2 );
+end;
+
+procedure Init;
+begin
+  // RU: Инициализируем звуковую под�и�тему. Дл� Windows можно �делать выбор между DirectSound и OpenAL отредактировав файл zgl_config.cfg.
+  // EN: Initializing sound subsystem. For Windows can be used DirectSound or OpenAL, see zgl_config.cfg.
+  snd_Init();
+
+  // RU: Загружаем звуковой файл и у�танавливаем дл� него мак�имальноe количе�тво проигрываемых и�точников в 2.
+  // EN: Load the sound file and set maximum count of sources that can be played to 2.
+  sound := snd_LoadFromFile( dirRes + 'click.wav', 2 );
+
+  // RU: Загружаем тек�туры, которые будут индикаторами.
+  // EN: Load the textures, that will be indicators.
+  icon[ 0 ] := tex_LoadFromFile( dirRes + 'audio-stop.png' );
+  icon[ 1 ] := tex_LoadFromFile( dirRes + 'audio-play.png' );
+
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+  setFontTextScale(15, fntMain);
+end;
+
+procedure Draw;
+  var
+    r : zglTRect;
+begin
+  ssprite2d_Draw( icon[ state ], ( SCREEN_WIDTH - 128 ) / 2, ( SCREEN_HEIGHT - 128 ) / 2, 128, 128, 0 );
+  text_Draw( fntMain, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 64, 'Skillet - Comatose - Whispers In The Dark', TEXT_HALIGN_CENTER );
+
+  r.X := ( SCREEN_WIDTH - 128 ) / 2;
+  r.Y := ( SCREEN_HEIGHT - 128 ) / 2;
+  r.W := 128;
+  r.H := 128;
+  if col2d_PointInRect( mouse_X, mouse_Y, r ) Then
+    begin
+      fx_SetBlendMode( FX_BLEND_ADD );
+      ssprite2d_Draw( icon[ state ], ( SCREEN_WIDTH - 132 ) / 2, ( SCREEN_HEIGHT - 132 ) / 2, 132, 132, 0, 155 );
+      fx_SetBlendMode( FX_BLEND_NORMAL );
+    end;
+end;
+
+procedure Timer;
+begin
+  // RU: Провер�ем играет ли музыка(1 - играет, 0 - не играет). Так же можно проверить и звуки - под�тавив zglPSound и ID вот так:
+  //     snd_Get( Sound, ID...
+  //     ID возвращает�� функцией snd_Play
+  //
+  // EN: Check if music playing(1 - playing, 0 - not playing). Sounds also can be checked this way - just use zglPSound and ID:
+  //     snd_Get( Sound, ID...
+  //     ID returns by function snd_Play.
+  state := snd_Get( SND_STREAM, audio, SND_STATE_PLAYING );
+  if state = 0 Then
+    audio := 0;
+
+  // RU: Получаем в процентах позицию проигрывани� аудиопотока и �тавим громко�ть дл� плавных переходов.
+  // EN: Get position in percent's for audio stream and set volume for smooth playing.
+  p := snd_Get( SND_STREAM, audio, SND_STATE_PERCENT );
+  if ( p >= 0 ) and ( p < 25 ) Then
+    snd_SetVolume( SND_STREAM, audio, ( 1 / 24 ) * p );
+  if ( p >= 75 ) and ( p < 100 ) Then
+    snd_SetVolume( SND_STREAM, audio, 1 - ( 1 / 24 ) * ( p - 75 ) );
+end;
+
+procedure KeyMouseEvent;
+var
+    r : zglTRect;
+begin
+  if mBClickCanClick(M_BLEFT_CLICK) Then
+  begin
+      // RU: В данном �лучаи мы начинаем во�производить звук �разу в указанных координатах, но их можно мен�ть и в проце��е и�пользу� процедуру snd_SetPos.
+      //     Важно: Дл� OpenAL можно позиционировать только mono-звуки
+      //
+      // EN: In this case, we begin to play the sound directly in these coordinates, but they can be changed later using procedure snd_SetPos.
+      //     Important: OpenAL can position only mono-sounds.
+
+// �та ча�ть изменена!!! Теперь можно заново во�производить звуки, даже е�ли они не закончили играть.
+    if snd_Get(sound, IDSound, SND_STATE_PLAYING) = IDSound then
+      snd_Stop(sound, IDSound);
+    IDSound := snd_Play(sound, FALSE, CalcX2D(mouseX), CalcY2D(mouseY));
+// ------------------------------------------------------------------------------------------
+
+    snd_Play( sound, FALSE, CalcX2D( mouse_X ), CalcY2D( mouse_Y ) );
+
+    r.X := ( SCREEN_WIDTH - 128 ) / 2;
+    r.Y := ( SCREEN_HEIGHT - 128 ) / 2;
+    r.W := 128;
+    r.H := 128;
+
+// добавл�ем проверку на проигрывание звука, только е�ли много развных звуков/музыки, то номера надо мен�ть (не только 1!!!)
+    if col2d_PointInRect(mouseX, mouseY, r) and (audio = 1) Then
+    begin
+      p := snd_Get(SND_STREAM, audio, SND_STATE_PLAYING);
+      if p = 1 then
+        snd_StopStream(audio);
+    end;
+// ---------------------------------------------------------------------------------------------------------------
+    if col2d_PointInRect( mouse_X, mouse_Y, r ) and ( audio = 0 ) Then
+      audio := snd_PlayFile( dirRes + 'music.ogg');
+  end;
+end;
+
+Begin
+  {$IFNDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+
+  randomize();
+
+  TimeStart := timer_Add( @Timer, 16, Start );
+
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+
+  wnd_SetCaption(utf8_Copy('14 - Sound'));
+
+  zgl_Init();
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/14 - Sound/demo14_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 101 - 94
Zengl_SRC/demos/FreePascal/15 - Video/demo15.pas

@@ -1,94 +1,101 @@
-program demo15;
-
-{$I zglCustomConfig.cfg}
-
-uses
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_mouse,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_font,
-  zgl_text,
-  zgl_primitives_2d,
-  zgl_sprite_2d,
-  zgl_video,
-  zgl_video_theora,
-  zgl_utils
-  ;
-
-var
-  dirRes   : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
-  fntMain  : Byte;
-  video    : zglPVideoStream;
-  videoSeek: Boolean;
-  TimeStart: Byte;
-
-procedure Init;
-begin
-  fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-
-  // EN: Open the video file.
-  // RU: Îòêðûòü âèäåî ôàéë.
-  video := video_OpenFile(dirRes + 'video.ogv');
-
-  setTextScale(15, fntMain);
-end;
-
-procedure Draw;
-begin
-  if Assigned(video) Then
-    begin
-      // EN: Rendering the current video frame in the center of screen using parameters of it from video.Info.
-      // RU: Ðåíäåðèíã òåêóùåãî êàäðà âèäåî â öåíòðå ýêðàíà èñïîëüçóÿ ïàðàìåòðû èç video.Info.
-      ssprite2d_Draw(video.Texture, (800 - video.Info.Width) / 2, (600 - video.Info.Height) / 2, video.Info.Width, video.Info.Height, 0);
-
-      // EN: Rendering of progress bar.
-      // RU: Ðåíäåðèíã ïîëîñû ïðîãðåññà.
-      pr2d_Rect(0, 600 - 100, 800, 20, $00FF00, 255);
-      pr2d_Rect(0, 600 - 100, (800 / video.Info.Duration) * video.Time, 20, $00FF00, 155, PR2D_FILL);
-
-      text_Draw(fntMain, 0, 0, 'FPS: ' + u_IntToStr(zgl_Get(RENDER_FPS)));
-      text_Draw(fntMain, 0, 20, 'Frame: ' + u_IntToStr(video.Frame));
-      text_Draw(fntMain, 100, 0, 'Duration: ' + u_FloatToStr(video.Info.Duration / 1000));
-      text_Draw(fntMain, 100, 20, 'Frames: ' + u_IntToStr(video.Info.Frames));
-      text_Draw(fntMain, 230, 0, 'Time: ' + u_FloatToStr(video.Time / 1000));
-    end;
-end;
-
-procedure Timer;
-begin
-    // EN: If left mouse button is down on progress bar, then seek the video.
-  // RU: Åñëè çàæàòà ëåâàÿ êíîïêà ìûøè íàä ïîëîñîé ïðîãðåññà - ïåðåìåùàòüñÿ ïî âèäåî.
-  if mBUpDown(M_BLEFT_DOWN) and (mouse_Y > 500) and (mouse_Y < 520) Then
-  begin
-    videoSeek := TRUE;
-    video_Seek(video, (mouse_X / 800) * video.Info.Duration);
-  end else
-    videoSeek := FALSE;
-
-  key_ClearState();
-  mouse_ClearState();
-end;
-
-procedure Update(dt: Double);
-begin
-  if not videoSeek Then
-    video_Update(video, dt, TRUE);
-end;
-
-Begin
-  randomize();
-
-  TimeStart := timer_Add(@Timer, 16, Start);
-
-  zgl_Reg(SYS_LOAD, @Init);
-  zgl_Reg(SYS_DRAW, @Draw);
-  zgl_Reg(SYS_UPDATE, @Update);
-
-  wnd_SetCaption(utf8_Copy('15 - Video'));
-
-  zgl_Init();
-End.
+program demo15;
+
+{$I zglCustomConfig.cfg}
+
+uses
+  {$IFDEF UNIX}
+  cthreads,
+  {$ENDIF}
+  {$IFDEF USE_ZENGL_STATIC}
+  zgl_screen,
+  zgl_window,
+  zgl_timers,
+  zgl_keyboard,
+  zgl_mouse,
+  zgl_textures,
+  zgl_textures_png,
+  zgl_font,
+  zgl_text,
+  zgl_primitives_2d,
+  zgl_sprite_2d,
+  zgl_video,
+  zgl_video_theora,
+  zgl_utils
+  {$ELSE}
+  zglHeader
+  {$ENDIF}
+  ;
+
+var
+  dirRes    : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
+  fntMain   : Byte;
+  video     : zglPVideoStream;
+  videoSeek : Boolean;
+
+procedure Init;
+begin
+  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
+
+  // EN: Open the video file.
+  // RU: Открыть видео файл.
+  video := video_OpenFile( dirRes + 'video.ogv' );
+
+  setFontTextScale(15, fntMain);
+end;
+
+procedure Draw;
+begin
+  if Assigned( video ) Then
+    begin
+      // EN: Rendering the current video frame in the center of screen using parameters of it from video.Info.
+      // RU: Рендеринг текущего кадра видео в центре �крана и�пользу� параметры из video.Info.
+      ssprite2d_Draw( video.Texture, ( 800 - video.Info.Width ) / 2, ( 600 - video.Info.Height ) / 2, video.Info.Width, video.Info.Height, 0 );
+
+      // EN: Rendering of progress bar.
+      // RU: Рендеринг поло�ы прогре��а.
+      pr2d_Rect( 0, 600 - 100, 800, 20, $00FF00, 255 );
+      pr2d_Rect( 0, 600 - 100, ( 800 / video.Info.Duration ) * video.Time, 20, $00FF00, 155, PR2D_FILL );
+
+      text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
+      text_Draw( fntMain, 0, 20, 'Frame: ' + u_IntToStr( video.Frame ) );
+      text_Draw( fntMain, 100, 0, 'Duration: ' + u_FloatToStr( video.Info.Duration / 1000 ) );
+      text_Draw( fntMain, 100, 20, 'Frames: ' + u_IntToStr( video.Info.Frames ) );
+      text_Draw( fntMain, 230, 0, 'Time: ' + u_FloatToStr( video.Time / 1000 ) );
+    end;
+end;
+
+procedure KeyMouseEvent;
+begin
+  // EN: If left mouse button is down on progress bar, then seek the video.
+  // RU: Е�ли зажата лева� кнопка мыши над поло�ой прогре��а - перемещать�� по видео.
+  if mBUpDown(M_BLEFT_DOWN) and ( mouse_Y() > 500 ) and ( mouse_Y() < 520 ) Then
+    begin
+      videoSeek := TRUE;
+      video_Seek( video, ( mouse_X() / 800 ) * video.Info.Duration );
+    end else
+      videoSeek := FALSE;
+end;
+
+procedure Update( dt : Double );
+begin
+  if not videoSeek Then
+    video_Update( video, dt, TRUE );
+end;
+
+Begin
+  {$IFNDEF USE_ZENGL_STATIC}
+  if not zglLoad( libZenGL ) Then exit;
+  {$ENDIF}
+
+  randomize();
+
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
+
+  zgl_Reg( SYS_LOAD, @Init );
+  zgl_Reg( SYS_DRAW, @Draw );
+  zgl_Reg( SYS_UPDATE, @Update );
+
+  wnd_SetCaption(utf8_Copy('15 - Video'));
+
+  zgl_Init();
+End.

+ 1 - 1
Zengl_SRC/demos/FreePascal/15 - Video/demo15_macosx.plist

@@ -16,7 +16,7 @@ endif
 # Variables
 FPC     = fpc
 FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src
+INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fi../../../srcGEGL -Fi../../../src  -Fu../../../srcGEGL
 LIBS    = -Fu../../../lib/chipmunk/$(ARCH)-$(OS) -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
 LIBSPPC = -Fu../../../lib/chipmunk/powerpc-$(OS) -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
 OUTPUT  = ../../../bin/

+ 4 - 8
Zengl_SRC/demos/FreePascal/16 - Physics/demo16.pas

@@ -36,7 +36,6 @@ var
   Bodies  : array of PcpBody;
   Shapes  : array of PcpShape;
 
-  TimeStart: Byte;
   TimePhisics: Byte;
 
 // RU: Добавить объект "шар"
@@ -113,7 +112,7 @@ procedure Init;
     e, u       : cpFloat;
 begin
   fntMain := font_LoadFromFile(dirRes + 'font.zfi');
-  setTextScale(15, fntMain);
+  setFontTextScale(15, fntMain);
 
   cpInitChipmunk();
 
@@ -180,20 +179,17 @@ begin
 //  batch2d_End();
 end;
 
-procedure Proc;
+procedure KeyMouseEvent;
 begin
   if mBClickCanClick(M_BLEFT_CLICK) Then
     cpAddBox(mouseX - 10, mouseY - 10, 48, 32, 1, 0.5, 0.5);
   if mBClickCanClick(M_BRIGHT_CLICK) Then
-    cpAddBall(mouseX, mouseY, 16, 1, 0.5, 0.9);
+    cpAddBall(mouseX, mouseY, 16, 2, 0.5, 0.1);
 
   (*           код, который можно использовать, если ZenGL не скомпилированная библиотека.
     if (mouseClickCanClick and M_BLEFT_CLICK) > 0 then
       cpAddBox(mouse_X() - 10, mouse_Y() - 10, 48, 32, 1, 0.5, 0.5);
   *)
-
-  key_ClearState();
-  mouse_ClearState();
 end;
 
 procedure Phisics;
@@ -219,9 +215,9 @@ Begin
   if not cpLoad( libChipmunk ) Then exit;
   {$ENDIF}
 
-  TimeStart := timer_Add(@Proc, 16, Start);
   TimePhisics := timer_Add(@Phisics, 16, Start);
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg(SYS_LOAD, @Init);
   zgl_Reg(SYS_DRAW, @Draw);
   zgl_Reg(SYS_EXIT, @Quit);

+ 0 - 86
Zengl_SRC/demos/FreePascal/16 - Physics/demo16_macosx.plist

@@ -1,86 +0,0 @@
-# Get current platform
-ifeq ($(shell uname -m), x86_64)
-  ARCH  = x86_64
-else
-  ARCH  = i386
-endif
-
-# Get current OS
-ifeq ($(shell uname), Linux)
-  OS    = linux
-else ifeq ($(shell uname), Darwin)
-  OS    = darwin
-  ARCH  = i386
-endif
-
-# Variables
-FPC     = fpc
-FLAGS   = -O3 -XsX -CX -Sd
-INCLUDE = -Fu../../../headers -Fi../../../headers -Fu../../../extra -Fu../../../src -Fu../../../srcGEGL
-LIBS    = -Fu../../../lib/chipmunk/$(ARCH)-$(OS) -Fu../../../lib/jpeg/$(ARCH)-$(OS) -Fu../../../lib/ogg/$(ARCH)-$(OS) -Fu../../../lib/theora/$(ARCH)-$(OS) -Fu../../../lib/zlib/$(ARCH)-$(OS) -Fu../../../lib/zip/$(ARCH)-$(OS)
-LIBSPPC = -Fu../../../lib/chipmunk/powerpc-$(OS) -Fu../../../lib/jpeg/powerpc-$(OS) -Fu../../../lib/ogg/powerpc-$(OS) -Fu../../../lib/theora/powerpc-$(OS) -Fu../../../lib/zlib/powerpc-$(OS) -Fu../../../lib/zip/powerpc-$(OS)
-OUTPUT  = ../../../bin/
-TMP     = ../tmp/
-UNIT    = demo17.pas
-TARGET  = demo17
-TARGETW = demo17.exe
-TARGETM = demo17
-BUNDLE  = $(OUTPUT)$(TARGETM).app
-
-# Targets
-all: clean
-	$(FPC) $(UNIT) $(INCLUDE) $(LIBS) -FE$(OUTPUT)$(ARCH)-$(OS)/ -FU$(TMP) $(FLAGS) -o$(TARGET) -TLINUX
-	strip $(OUTPUT)$(ARCH)-$(OS)/$(TARGET) --strip-unneeded -R .comment -R .note
-
-linux32: clean
-	$(FPC) $(UNIT) $(INCLUDE) \
-	-Fu../../../lib/chipmunk/i386-linux \
-	-Fu../../../lib/jpeg/i386-linux \
-	-Fu../../../lib/ogg/i386-linux \
-	-Fu../../../lib/theora/i386-linux \
-	-Fu../../../lib/zlib/i386-linux \
-	-Fu../../../lib/zip/i386-linux \
-	-FE$(OUTPUT)i386-linux/ -FU$(TMP) $(FLAGS) -o$(TARGET) -TLINUX -Pi386 -Xd
-	strip $(OUTPUT)i386-linux/$(TARGET) --strip-unneeded -R .comment -R .note
-
-win32: clean
-	$(FPC) $(UNIT) $(INCLUDE) \
-	-Fu../../../lib/chipmunk/i386-win32 \
-	-Fu../../../lib/jpeg/i386-win32 \
-	-Fu../../../lib/msvcrt/i386 \
-	-Fu../../../lib/ogg/i386-win32 \
-	-Fu../../../lib/theora/i386-win32 \
-	-Fu../../../lib/zlib/i386-win32 \
-	-Fu../../../lib/zip/i386-win32 \
-	-FE$(OUTPUT)i386-win32/ -FU$(TMP) $(FLAGS) -o$(TARGETW) -TWIN32 -Pi386 -WG
-
-win64: clean
-	$(FPC) $(UNIT) $(INCLUDE) \
-	-Fu../../../lib/chipmunk/x86_64-win64 \
-	-Fu../../../lib/jpeg/x86_64-win64 \
-	-Fu../../../lib/msvcrt/x86_64 \
-	-Fu../../../lib/ogg/x86_64-win64 \
-	-Fu../../../lib/theora/x86_64-win64 \
-	-Fu../../../lib/zlib/x86_64-win64 \
-	-Fu../../../lib/zip/x86_64-win64 \
-	-FE$(OUTPUT)x86_64-win64/ -FU$(TMP) $(FLAGS) -o$(TARGETW) -TWIN64 -Px86_64 -WG
-
-macosx: clean
-	rm -Rf $(BUNDLE)
-	mkdir {$(BUNDLE),$(BUNDLE)/{Contents,Contents/{MacOS,Resources,Frameworks}}}
-	$(FPC) $(UNIT) $(INCLUDE) $(LIBS) -FE$(OUTPUT) -FU$(TMP) $(FLAGS) -o$(TARGETM) -TDARWIN -Pi386 -k"-macosx_version_min" -k"10.4"
-	mv $(OUTPUT)$(TARGETM) $(BUNDLE)/Contents/MacOS/
-	sh macosx_postbuild.sh
-
-macosx_uni: clean
-	rm -Rf $(BUNDLE)
-	mkdir {$(BUNDLE),$(BUNDLE)/{Contents,Contents/{MacOS,Resources,Frameworks}}}
-	$(FPC) $(UNIT) $(INCLUDE) $(LIBS) -FE$(OUTPUT) -FU$(TMP) $(FLAGS) -o$(TARGETM)-386 -TDARWIN -Pi386 -k"-macosx_version_min" -k"10.4"
-	$(FPC) $(UNIT) $(INCLUDE) $(LIBSPPC) -FE$(OUTPUT) -FU$(TMP) $(FLAGS) -o$(TARGETM)-ppc -TDARWIN -Ppowerpc -k"-macosx_version_min" -k"10.4"
-	lipo -create $(OUTPUT)$(TARGETM)-ppc $(OUTPUT)$(TARGETM)-386 -output $(BUNDLE)/Contents/MacOS/$(TARGETM)
-	rm $(OUTPUT)$(TARGETM)-386 $(OUTPUT)$(TARGETM)-ppc
-	sh macosx_postbuild.sh
-
-clean:
-	rm -f *.*~
-	rm -f $(TMP)*.*

+ 0 - 141
Zengl_SRC/demos/FreePascal/17 - Menu(touch menu)/demo17.pas

@@ -1,141 +0,0 @@
-program demo17;
-
-{$I zglCustomConfig.cfg}
-
-// включить USE_MENUGUI в zgl_config
-uses
-  {$IFDEF UNIX}
-  cthreads,
-  {$ENDIF}
-  {$IFDEF USE_ZENGL_STATIC}
-  gegl_touch_menu,
-  zgl_screen,
-  zgl_window,
-  zgl_timers,
-  zgl_keyboard,
-  zgl_render_2d,
-  zgl_fx,
-  zgl_primitives_2d,
-  zgl_textures,
-  zgl_textures_png,
-  zgl_font,
-  zgl_text,
-  zgl_file,
-  zgl_types,
-  zgl_mouse,
-  gegl_draw_gui,
-
-  zgl_utils
-  {$ELSE}
-  zglHeader
-  {$ENDIF}
-  ;
-
-var
-  //  dirRes  : UTF8String {$IFNDEF MACOSX} = 'data/' {$ENDIF};             // вне демо-версий
-  dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};            // в демо-версиях!!!
-  TimeStart: Byte = 0;
-
-
-procedure Init;
-begin
-  file_SetPath('');                       // если dirRes = '../data/'   !!!!!     в демо-версиях!!!
-  // RU: Загружаем данные о шрифте.
-  // EN: Load the font.
-
-//  fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
-  // RU: Если же текстуры именуются без использования маски вида "$(имя_шрифта)FontName-page$(номер).$(расширение)", то загрузку можно произвести следующим образом(для png):
-  // EN: If textures were named without special mask - "$(font_name)-page$(number).$(extension)", then use this method to load them(for png):
-  //for i := 0 to fntMain.Count.Pages - 1 do
-  //  fntMain.Pages[ i ] := tex_LoadFromFile( dirRes + 'font-page' + u_IntToStr( i ) + '.png' );
-
-  // обязательный код! Данные для отображения клавиатуры.
-  fontUse := font_LoadFromFile(dirRes + 'CalibriBold50pt.zfi');
-  JoyArrow := tex_LoadFromFile(dirRes + 'arrow.png');     // загрузили текстуру
-  tex_SetFrameSize(JoyArrow, 64, 64);                     // и разбили её на части, но в записях не будет указано количество полученных текстур
-  CreateTouchKeyboard;
-end;
-
-procedure Draw;
-  var
-    r : zglTRect;
-    s : UTF8String;
-begin
-  batch2d_Begin();
-  setTextScale(15, fontUse);
-
-  // RU: ZenGL работает исключительно с кодировкой UTF-8, поэтому весь текст должен быть в UTF-8.
-  // EN: ZenGL works only with UTF-8 encoding, so all text should be encoded with UTF-8.
-
-  text_Draw( fontUse, 400, 25, 'String with center alignment', TEXT_HALIGN_CENTER );
-
-  text_DrawEx( fontUse, 400, 65, 3, 0, 'Scaling', 255, $FFFFFF, TEXT_HALIGN_CENTER );
-
-  setTextScale(15, fontUse);
-  fx2d_SetVCA( $FF0000, $00FF00, $0000FF, $FFFFFF, 255, 255, 255, 255 );
-  text_Draw( fontUse, 400, 125, 'Gradient color for every symbol', TEXT_FX_VCA or TEXT_HALIGN_CENTER );
-
-  r.X := 0;
-  r.Y := 300 - 128;
-  r.W := 192;
-  r.H := 256;
-
-  pr2d_Rect( r.X, r.Y, r.W, r.H, $FF0000 );
-  text_DrawInRect( fontUse, r, 'Simple text rendering in rectangle' + #10 + 'Текст написанный в квадрате');
-  // для использования другой кодировки надо указать Lazarus что страница в кодировке UTF-8
-  // File setting -> encoding -> UTF-8 with BOM
-
-  r.X := 800 - 192;
-  r.Y := 300 - 128;
-  r.W := 192;
-  r.H := 256;
-  pr2d_Rect( r.X, r.Y, r.W, r.H, $FF0000 );
-  text_DrawInRect( fontUse, r, 'Text rendering using horizontal right alignment and vertical bottom alignment', TEXT_HALIGN_RIGHT or TEXT_VALIGN_BOTTOM );
-
-  r.X := 400 - 192;
-  r.Y := 300 - 128;
-  r.W := 384;
-  r.H := 256;
-  pr2d_Rect( r.X, r.Y, r.W, r.H, $FF0000 );
-  text_DrawInRect( fontUse, r, 'This text uses justify alignment and centered vertically. Text which doesn''t fit inside the rectangle will be cropped.',
-                   TEXT_HALIGN_JUSTIFY or TEXT_VALIGN_CENTER );
-
-  r.X := 400 - 320;
-  r.Y := 300 + 160;
-  r.W := 640;
-  r.H := 128;
-  pr2d_Rect( r.X, r.Y, r.W, r.H, $FF0000 );
-  text_DrawInRect( fontUse, r, 'For starting new line LF symbol can be used' + #10 + 'code of which is equal to 10 and named in Unicode as "Line Feed"',
-                   TEXT_HALIGN_CENTER or TEXT_VALIGN_CENTER );
-
-  // RU: Выводим количество FPS в правом углу, используя text_GetWidth.
-  // EN: Render FPS in the top right corner using text_GetWidth.
-  s := 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) );
-  text_Draw( fontUse, 800 - text_GetWidth( fontUse, s ), 0, s );
-
-  batch2d_End();
-end;
-
-procedure Timer;
-begin
-
-  key_ClearState();
-  mouse_ClearState;
-end;
-
-begin
-  {$IFNDEF USE_ZENGL_STATIC}
-  if not zglLoad( libZenGL ) Then exit;
-  {$ENDIF}
-  randomize();
-
-  timer_Add( @Timer, 16, TimeStart, Start );
-
-  zgl_Reg( SYS_LOAD, @Init );
-  zgl_Reg( SYS_DRAW, @Draw );
-
-  wnd_SetCaption(utf8_Copy('06 - Text'));
-
-  zgl_Init();
-end.
-

+ 0 - 24
Zengl_SRC/demos/FreePascal/17 - Menu(touch menu)/demo17_macosx.plist

@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-  <key>CFBundleExecutable</key>
-  <string>demo17</string>
-  <key>CFBundleIconFile</key>
-  <string>demo17</string>
-  <key>CFBundleName</key>
-  <string>demo17</string>
-  <key>CFBundleIdentifier</key>
-  <string>zengl.demo17</string>
-  <key>CFBundlePackageType</key>
-  <string>APPL</string>
-  <key>CFBundleSignature</key>
-  <string>demo</string>
-  <key>CFBundleShortVersionString</key>
-  <string>1.0</string>
-  <key>CFBundleVersion</key>
-  <string>1</string>
-  <key>CSResourcesFileMapped</key>
-  <true/>
-</dict>
-</plist>

+ 0 - 5
Zengl_SRC/demos/FreePascal/17 - Menu(touch menu)/macosx_postbuild.sh

@@ -1,5 +0,0 @@
-# copy resources
-cp ../../../bin/data/font* ../../../bin/demo17.app/Contents/Resources/
-# make Info.plist and copy icon
-cp -f demo17_macosx.plist ../../../bin/demo17.app/Contents/Info.plist
-cp ../../../bin/data/zengl.icns ../../../bin/demo17.app/Contents/Resources/demo17.icns

+ 10 - 4
Zengl_SRC/demos/FreePascal/Makefile

@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <General>
       <Flags>
         <SaveOnlyProjectUnits Value="True"/>
         <MainUnitHasCreateFormStatements Value="False"/>
         <MainUnitHasTitleStatement Value="False"/>
         <MainUnitHasScaledStatement Value="False"/>
+        <CompatibilityMode Value="True"/>
       </Flags>
       <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
       <Icon Value="0"/>
@@ -89,8 +89,8 @@
       <Filename Value="../../../bin/$(TargetCPU)-$(TargetOS)/demo01"/>
     </Target>
     <SearchPaths>
-      <IncludeFiles Value="$(ProjOutDir);../../../headers"/>
-      <OtherUnitFiles Value="../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
+      <IncludeFiles Value="$(ProjOutDir);../../../headers;../../../srcGEGL;../../../src"/>
+      <OtherUnitFiles Value="../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS);../../../srcGEGL"/>
       <UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>
     <Parsing>
@@ -100,6 +100,7 @@
     </Parsing>
     <CodeGeneration>
       <SmartLinkUnit Value="True"/>
+      <TargetCPU Value="x86_64"/>
       <Optimizations>
         <OptimizationLevel Value="3"/>
       </Optimizations>
@@ -110,6 +111,11 @@
         <StripSymbols Value="True"/>
       </Debugging>
       <LinkSmart Value="True"/>
+      <Options>
+        <Win32>
+          <GraphicApplication Value="True"/>
+        </Win32>
+      </Options>
     </Linking>
     <Other>
       <Verbosity>

+ 20 - 2
Zengl_SRC/demos/Lazarus/01 - Initialization/demo01.lpr

@@ -51,6 +51,8 @@ begin
   // EN: This function is the best way to implement smooth moving of something, because accuracy of timers are restricted by FPS.
 end;
 
+// RU: Пример использования таймера.
+// EN: An example of using a timer.
 procedure Timer;
 begin
   // RU: Будем в заголовке показывать количество кадров в секунду.
@@ -58,9 +60,18 @@ begin
   wnd_SetCaption( '01 - Initialization[ FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) + ' ]' );
 end;
 
+procedure KeyMouseEvent;
+begin
+  // RU: Функция обработки клавиатуры, мыши, джойстика и тачпада. Все события связанные с ними очищаются после её обработки.
+  //     Все попытки обработать клавиатуру, мышь или тачпад в других функциях могут привести к непредвиденным ситуациям.
+  // EN: Keyboard, mouse, joystick and touchpad handling function. All events associated with them are cleared after processing it.
+  //     Any attempt to handle the keyboard, mouse, or touchpad in other functions may lead to unexpected situations.
+end;
+
 procedure Quit;
 begin
- //
+  // RU: События которые надо произвести по завершению программы.
+  // EN: Events to be performed at the end of the program.
 end;
 
 Begin
@@ -95,9 +106,16 @@ Begin
   DirApp  := utf8_Copy( PAnsiChar( zgl_Get( DIRECTORY_APPLICATION ) ) );
   DirHome := utf8_Copy( PAnsiChar( zgl_Get( DIRECTORY_HOME ) ) );
 
+  // RU: Устанавливаем интервал на обработку событий клавиатуры, мыши, тачпада. И регистрируем процедуру.
+  //     Вызывать zgl_SetEventInterval не обязательно. Значение 16 стоит по умолчанию.
+  // EN: We set the interval for processing keyboard, mouse, touchpad events. And we register the procedure.
+  //     Calling zgl_SetEventInterval is optional. The default is 16.
+  zgl_SetEventsInterval(16);
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
+
   // RU: Создаем таймер с интервалом 1000мс.
   // EN: Create a timer with interval 1000ms.
-  TimeStart := timer_Add( @Timer, 100, Start );
+  TimeStart := timer_Add( @Timer, 1000, Start );
 
   // RU: Регистрируем процедуру, что выполнится сразу после инициализации ZenGL.
   // EN: Register the procedure, that will be executed after ZenGL initialization.

+ 5 - 5
Zengl_SRC/demos/Lazarus/01 - Initialization/demo01.lps

@@ -1,22 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <ProjectSession>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <BuildModes Active="Release"/>
     <Units Count="1">
       <Unit0>
         <Filename Value="demo01.lpr"/>
         <IsPartOfProject Value="True"/>
         <IsVisibleTab Value="True"/>
-        <CursorPos X="7" Y="18"/>
-        <UsageCount Value="31"/>
+        <TopLine Value="18"/>
+        <CursorPos X="9" Y="18"/>
+        <UsageCount Value="32"/>
         <Loaded Value="True"/>
-        <DefaultSyntaxHighlighter Value="Delphi"/>
       </Unit0>
     </Units>
     <RunParams>
       <FormatVersion Value="2"/>
-      <Modes Count="0" ActiveMode="default"/>
+      <Modes ActiveMode="default"/>
     </RunParams>
   </ProjectSession>
 </CONFIG>

+ 5 - 3
Zengl_SRC/demos/Lazarus/01 - Initialization/demo01_macosx.lps

@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <General>
       <Flags>
         <SaveOnlyProjectUnits Value="True"/>
         <MainUnitHasCreateFormStatements Value="False"/>
         <MainUnitHasTitleStatement Value="False"/>
+        <MainUnitHasScaledStatement Value="False"/>
+        <CompatibilityMode Value="True"/>
       </Flags>
       <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
       <Icon Value="0"/>
@@ -88,7 +89,7 @@
       <Filename Value="../../../bin/$(TargetCPU)-$(TargetOS)/demo02"/>
     </Target>
     <SearchPaths>
-      <IncludeFiles Value="$(ProjOutDir);../../../headers"/>
+      <IncludeFiles Value="$(ProjOutDir);../../../headers;../../../srcGEGL"/>
       <OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
       <UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>
@@ -106,6 +107,7 @@
     <Linking>
       <Debugging>
         <GenerateDebugInfo Value="False"/>
+        <StripSymbols Value="True"/>
       </Debugging>
       <LinkSmart Value="True"/>
       <Options>

+ 8 - 6
Zengl_SRC/demos/Lazarus/02 - Resources/demo02.lpr

@@ -125,7 +125,9 @@ begin
   texLogo := tex_LoadFromFile( 'zengl.png' );
   file_CloseArchive();
 
-  setTextScale(15, fntMain);
+  // RU: Устанавливаем размер шрифта fntMain (в пикселях).
+  // EN: Set the fntMain font size (in pixels).
+  setFontTextScale(15, fntMain);
 end;
 
 procedure Draw;
@@ -133,11 +135,11 @@ begin
   // RU: К ресурсам, которые загружаются в многопоточном режиме, можно обращаться только после завершения загрузки. Код ниже рисует экран загрузки если ресурсы ещё не загрузились.
   // EN: Resources which are loading in multithreaded mode can be used only after finishing the loading process. Code below renders loading screen if resources are not loaded yet.
   if res_GetCompleted() < 100 Then
-    begin
-      ssprite2d_Draw( texLogo, ( 800 - texLogo.Width ) / 2, ( 600 - texLogo.Height ) / 2, texLogo.Width, texLogo.Height, 0 );
-      text_Draw( fntMain, 400, 300 + texLogo.Height / 4, 'Loading... ' + u_IntToStr( res_GetCompleted() ) + '%', TEXT_HALIGN_CENTER );
-      exit;
-    end;
+  begin
+    ssprite2d_Draw( texLogo, ( 800 - texLogo.Width ) / 2, ( 600 - texLogo.Height ) / 2, texLogo.Width, texLogo.Height, 0 );
+    text_Draw( fntMain, 400, 300 + texLogo.Height / 4, 'Loading... ' + u_IntToStr( res_GetCompleted() ) + '%', TEXT_HALIGN_CENTER );
+    exit;
+  end;
 
   ssprite2d_Draw( texTest, 0, 0, 800, 600, 0 );
   text_Draw( fntMain, 0, 0, 'FPS: ' + u_IntToStr( zgl_Get( RENDER_FPS ) ) );

+ 5 - 4
Zengl_SRC/demos/Lazarus/02 - Resources/demo02.lps

@@ -2,22 +2,23 @@
 <CONFIG>
   <ProjectSession>
     <PathDelim Value="\"/>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <BuildModes Active="Release"/>
     <Units Count="1">
       <Unit0>
         <Filename Value="demo02.lpr"/>
         <IsPartOfProject Value="True"/>
         <IsVisibleTab Value="True"/>
-        <CursorPos X="4" Y="17"/>
-        <UsageCount Value="28"/>
+        <TopLine Value="114"/>
+        <CursorPos X="19" Y="130"/>
+        <UsageCount Value="29"/>
         <Loaded Value="True"/>
         <DefaultSyntaxHighlighter Value="Delphi"/>
       </Unit0>
     </Units>
     <RunParams>
       <FormatVersion Value="2"/>
-      <Modes Count="0" ActiveMode="default"/>
+      <Modes ActiveMode="default"/>
     </RunParams>
   </ProjectSession>
 </CONFIG>

BIN
Zengl_SRC/demos/Lazarus/02 - Resources/demo02.res


+ 5 - 4
Zengl_SRC/demos/Lazarus/02 - Resources/demo02_macosx.lps

@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <General>
       <Flags>
         <SaveOnlyProjectUnits Value="True"/>
         <MainUnitHasCreateFormStatements Value="False"/>
         <MainUnitHasTitleStatement Value="False"/>
+        <MainUnitHasScaledStatement Value="False"/>
+        <CompatibilityMode Value="True"/>
       </Flags>
       <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
       <Icon Value="0"/>
@@ -93,8 +94,8 @@
       <Filename Value="../../../bin/$(TargetCPU)-$(TargetOS)/demo03"/>
     </Target>
     <SearchPaths>
-      <IncludeFiles Value="$(ProjOutDir);../../../headers"/>
-      <OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
+      <IncludeFiles Value="$(ProjOutDir);../../../headers;../../../srcGEGL;../../../src"/>
+      <OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS);../../../srcGEGL"/>
       <UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>
     <Parsing>

+ 108 - 19
Zengl_SRC/demos/Lazarus/03 - Input/demo03.lpr

@@ -1,6 +1,7 @@
 program demo03;
 
 {$I zglCustomConfig.cfg}
+{$I zgl_config.cfg}
 
 {$IFDEF WINDOWS}
   {$R *.res}
@@ -21,32 +22,108 @@ uses
   zgl_text,
   zgl_textures_png,
   zgl_types,
+  {$IfDef OLD_METHODS}
   zgl_collision_2d,
+  {$Else}
+  gegl_VElements,
+  {$EndIf}
   zgl_utils
   ;
 
 var
   dirRes  : UTF8String {$IFNDEF MACOSX} = '../data/' {$ENDIF};
 
-  fntMain    : Byte;
+  fntMain, fntEdit: Byte;
 
   joyCount   : Integer;
+  // RU: строка для получения значения из поля ввода
+  // EN: string to get value from input field
   userInput  : UTF8String;
+  {$IfDef OLD_METHODS}
   trackInput : Boolean;
   inputRect  : zglTRect;
   lineAlpha  : Byte;
 
   TimeStart  : Byte;
+  {$Else}
+  // RU: прямоугольник описывающий поле ввода
+  // EN: rectangle describing the input field
+  myRect: zglTRect;
+
+  // "перепись" полей ввода для того, чтоб знать с каким полем работаем.
+  // RU: объявляем переменную для работы с полем ввода
+  // EN: we declare a variable to work with the input field
+  myEdit, myEdit2: Word;
+
+// RU: прорисовываем основание поля ввода. Всё ограничено только вашим воображением. )))
+// EN: draw the base of the input field. Everything is limited only by your imagination. )))
+procedure EditCont;
+begin
+  // RU: при прорисовке поля ввода, смешениt и поворот уже будут сделаны. Я показываю как нарисовать рамку.
+  // Текст будет выведен поверх того, что вы здесь нарисуете.
+  // EN: displacement and rotation will be done prior to performing the procedure. I am showing you how to draw a frame.
+  // The text will be drawn on top of what you draw here.
+  pr2d_Rect(- 2, - 1, myRect.W + 5, myRect.H, $FFFFFF, 128, PR2D_FILL);
+end;
+  {$EndIf}
 
 procedure Init;
+{$IfNDef OLD_METHODS}
+var
+  TextColor: zglTColor;
+  EScale: Word;
+{$EndIf}
 begin
   fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
-  setTextScale(15, fntMain);
-
+  {$IfNDef OLD_METHODS}
+  // RU: Загружаем данные о шрифте.
+  // EN: Load the font.
+  fntEdit := font_LoadFromFile( dirRes + 'CalibriBold50pt.zfi');
+  // RU: устанавливаем размеры шрифтов
+  // EN: set font sizes
+  setFontTextScale(15, fntMain);
+  // RU: размер шрифта поля ввода (для понимания что происходит). Изменяя размер шрифта, мы должны менять и
+  //     размеры поля ввода - myRect в данном случае. Сами они не изменятся.
+  // EN: the font size of the input field (to understand what's going on). By changing the font size,
+  //     we must also change the size of the input field - myRect in this case. They themselves will not change.
+  EScale := 20;
+  setFontTextScale(EScale, fntEdit);
+  // RU: указываем размеры поля ввода
+  // EN: specify the size of the input field
+  myRect.X := 200;
+  myRect.Y := 150;
+  myRect.W := 200;
+  myRect.H := 33;
+  // RU: указываем точку вращения, в данном случае центр поля ввода (по необходимости) и угол поворота (например 45)
+  // EN: specify the point of rotation, in this case the center of the input field (if necessary) and the angle of rotation (for example 45)
+  SetOfRotateAngleAndPoint(myRect.x + myRect.W / 2, myRect.y + myRect.H / 2, 30);
+  // RU: указываем цвет текста
+  // EN: specify the color of the text
+  TextColor.R := 0.1;
+  TextColor.G := 0.5;
+  TextColor.B := 0.3;
+  TextColor.A := 1;            // max = 1, min = 0
+  // RU: передаём цвет в данные менеджера
+  // EN: transfer the color to the manager data
+  SetColorElementText(@TextColor);
+  // RU: создаём само поле ввода с данными указанными выше и передаваемыми данными
+  // EN: create the input field itself with the data specified above and the data that needs to be transferred
+  myEdit := CreateEdit(myRect, fntEdit, EScale, @EditCont);
+
+  // RU: корректируем курсор
+  // EN: adjust the cursor
+  CorrectEditCursor(myEdit, 2);
+
+  // RU: задаём очистку экрана заданным цветом
+  // EN: set the screen to clear with a specified color
+  scr_SetClearColor(true, $7090af);
+
+  {$Else}
   inputRect.X := 400 - 192;
   inputRect.Y := 300 - 100 - 32;
   inputRect.W := 384;
   inputRect.H := 96;
+  {$EndIf}
 
   // RU: Инициализируем обработку ввода джойстиков и получаем количество подключенных джойстиков.
   // EN: Initialize processing joystick input and get count of plugged joysticks.
@@ -54,8 +131,10 @@ begin
 end;
 
 procedure Draw;
-  var
-    w : Single;
+{$IfDef OLD_METHODS}
+var
+  w : Single;
+{$EndIf}
 begin
   text_Draw( fntMain, 0, 0, 'Escape - Exit' );
 
@@ -63,6 +142,7 @@ begin
   // EN: Mouse coordinates can be got using functions mouse_X and mouse_Y.
   text_Draw( fntMain, 0, 18, 'Mouse X, Y: ' + u_IntToStr( mouseX ) + '; ' + u_IntToStr( mouseY ) );
 
+  {$IfDef OLD_METHODS}
   // RU: Выводим введённый пользователем текст.
   // EN: Show the inputted text.
   pr2d_Rect( inputRect.X, inputRect.Y, inputRect.W, inputRect.H, $FFFFFF, 255 );
@@ -74,7 +154,12 @@ begin
     end else
       text_Draw( fntMain, 400, 300 - 100, 'Click here to enter text(maximum - 24 symbols):', TEXT_HALIGN_CENTER );
   text_Draw( fntMain, 400, 300 - 70, userInput, TEXT_HALIGN_CENTER );
-
+  {$Else}
+  text_Draw(fntMain, 0, 36, 'Press F5 to copy from Edit and draw');  // какой я нафиг англичанин? ))))
+  text_Draw(fntMain, 0, 54, 'Press F12 - Rus/Eng');
+  if userInput <> '' then
+    text_Draw(fntMain, 400, 300 - 70, userInput, TEXT_HALIGN_CENTER);
+  {$EndIf}
 
   // RU: Вывод состояния осей и кнопок первого джойстика в системе.
   // EN: Show the state of axes and buttons of first joystick in the system.
@@ -107,13 +192,19 @@ begin
   text_Draw( fntMain, 550, 540, 'Button16: ' + u_BoolToStr( joy_Down( 0, 15 ) ) );
 end;
 
+{$IfDef OLD_METHODS}
 procedure Timer;
 begin
   if lineAlpha > 5 Then
     DEC( lineAlpha, 10 )
   else
     lineAlpha := 255;
+end;
+{$EndIf}
 
+procedure KeyMouseEvent;
+begin
+  {$IfDef OLD_METHODS}
   // RU: Проверить нажата ли левая кнопка мыши в пределах inputRect и начать отслеживать ввод текста.
   // EN: Check if left mouse button was pressed inside inputRect and start to track text input.
   if mBClickCanClick( M_BLEFT_CLICK ) and col2d_PointInRect( mouseX, mouseY, inputRect ) Then
@@ -134,24 +225,22 @@ begin
   // EN: Get inputted by user text.
   if trackInput Then
     userInput := key_GetText();
-
-  // RU: По нажатию Escape завершить приложение.
-  // EN: If Escape was pressed - shutdown the application.
-
-  // if key_Press( K_ESCAPE ) Then zgl_Exit;
-                   // больше не нужно это делать, но если для чего-то понадобится клавиша Escape, надо
-                   // отключить дефайн (USE_EXIT_ESCAPE) на её обработку
-
-  // RU: Обязательно очищаем состояния всех подсистем ввода.
-  // EN: Necessarily clear all the states of input subsystems.
-  mouse_ClearState();
-  key_ClearState();
-  joy_ClearState();
+  {$Else}
+  // RU: по нажатию F5 копируем то, что написано в поле ввода
+  // EN: by pressing F5, copy what is written in the input field
+  if keysDown[K_F5] then
+  begin
+    userInput := GetEditToText(myEdit);
+  end;
+  {$EndIf}
 end;
 
 Begin
+  {$IfDef OLD_METHODS}
   TimeStart := timer_Add( @Timer, 16, Start );
+  {$EndIf}
 
+  zgl_Reg(SYS_EVENTS, @KeyMouseEvent);
   zgl_Reg( SYS_LOAD, @Init );
   zgl_Reg( SYS_DRAW, @Draw );
 

+ 6 - 7
Zengl_SRC/demos/Lazarus/03 - Input/demo03.lps

@@ -2,17 +2,16 @@
 <CONFIG>
   <ProjectSession>
     <PathDelim Value="\"/>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <BuildModes Active="Release"/>
     <Units Count="2">
       <Unit0>
         <Filename Value="demo03.lpr"/>
         <IsPartOfProject Value="True"/>
-        <IsVisibleTab Value="True"/>
-        <CursorPos X="26" Y="11"/>
-        <UsageCount Value="161"/>
+        <TopLine Value="5"/>
+        <CursorPos X="8" Y="30"/>
+        <UsageCount Value="176"/>
         <Loaded Value="True"/>
-        <DefaultSyntaxHighlighter Value="Delphi"/>
       </Unit0>
       <Unit1>
         <Filename Value="..\..\..\extra\zglglutm.pas"/>
@@ -21,13 +20,13 @@
         <EditorIndex Value="-1"/>
         <TopLine Value="745"/>
         <CursorPos X="19" Y="739"/>
-        <UsageCount Value="27"/>
+        <UsageCount Value="42"/>
         <DefaultSyntaxHighlighter Value="Delphi"/>
       </Unit1>
     </Units>
     <RunParams>
       <FormatVersion Value="2"/>
-      <Modes Count="0" ActiveMode="default"/>
+      <Modes ActiveMode="default"/>
     </RunParams>
   </ProjectSession>
 </CONFIG>

BIN
Zengl_SRC/demos/Lazarus/03 - Input/demo03.res


+ 4 - 3
Zengl_SRC/demos/Lazarus/03 - Input/demo03_macosx.lps

@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <General>
       <Flags>
         <SaveOnlyProjectUnits Value="True"/>
         <MainUnitHasCreateFormStatements Value="False"/>
         <MainUnitHasTitleStatement Value="False"/>
+        <MainUnitHasScaledStatement Value="False"/>
+        <CompatibilityMode Value="True"/>
       </Flags>
       <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
       <Icon Value="0"/>
@@ -88,7 +89,7 @@
       <Filename Value="../../../bin/$(TargetCPU)-$(TargetOS)/demo04"/>
     </Target>
     <SearchPaths>
-      <IncludeFiles Value="$(ProjOutDir);../../../headers"/>
+      <IncludeFiles Value="$(ProjOutDir);../../../headers;../../../srcGEGL"/>
       <OtherUnitFiles Value="../../../headers;../../../extra;../../../src;../../../lib/jpeg/$(TargetCPU)-$(TargetOS);../../../lib/msvcrt/$(TargetCPU);../../../lib/ogg/$(TargetCPU)-$(TargetOS);../../../lib/theora/$(TargetCPU)-$(TargetOS);../../../lib/zlib/$(TargetCPU)-$(TargetOS);../../../lib/zip/$(TargetCPU)-$(TargetOS)"/>
       <UnitOutputDirectory Value="../tmp/$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>

Some files were not shown because too many files changed in this diff