Recent

Author Topic: Pascal eXtended Library (aka Asphyre) released!  (Read 72701 times)

ykot

  • Full Member
  • ***
  • Posts: 141
Re: Pascal eXtended Library (aka Asphyre) released!
« Reply #120 on: March 09, 2018, 05:51:04 pm »
HI , My name is ramiro , I use Raspberry pi 3 , and I probe the library ,  the gpio output is ok , but the GPIO input not , anybody help me please , I use the example blynky and add Gpio Input
It would be best if you could create a separate thread for this question as it is unrelated to the post. Regarding your specific problem - without seeing physical connection, how you feed input to RPi, and how you are reading input in the source code, it's difficult to tell (e.g. are you setting the appropriate pin for input? are you using correct pin number?)

AlexTP

  • Hero Member
  • *****
  • Posts: 2384
    • UVviewsoft
Re: Pascal eXtended Library (aka Asphyre) released!
« Reply #121 on: March 10, 2018, 12:10:45 pm »
Site afterwarp is not reponding, so please make documentation copy in Lazarus wiki?

ykot

  • Full Member
  • ***
  • Posts: 141
Re: Pascal eXtended Library (aka Asphyre) released!
« Reply #122 on: March 10, 2018, 03:33:42 pm »
Please note that Asphyre / PXL official web site is http://asphyre.net

Afterwarp web sites will be used by another framework with the same name that is ought to be released soon.

AliZairov

  • New Member
  • *
  • Posts: 18
Re: Pascal eXtended Library (aka Asphyre) released!
« Reply #123 on: November 28, 2020, 06:27:54 pm »
Hi. Sorry, sample project not work.

OS: Linux (Mint 20)
IDE: CT 7.2
FPC: 3.3.1
Device: Android 8.1 (LG Q6 arm32) & Android 5.0 (Emulator x86)

app.pas
Code: Pascal  [Select][+][-]
  1. library app;
  2.  
  3. {$mode delphi}
  4.  
  5. uses
  6.   jni, Android.AppGlue, PXL.Logs, PXL.Devices.Android,
  7.   main;
  8.  
  9. exports
  10.   ANativeActivity_onCreate;
  11.  
  12. begin
  13.   {$IFDEF ANDROID_DEBUG}
  14.     LogText('Library load');
  15.   {$ENDIF}
  16.  
  17.   HookApplicationCreate  := ApplicationCreate;
  18.   HookApplicationDestroy := ApplicationDestroy;
  19.   HookApplicationPaint   := ApplicationPaint;
  20.   HookApplicationProcess := ApplicationProcess;
  21. end.
  22.  

main.pas
Code: Pascal  [Select][+][-]
  1. unit main;
  2.  
  3. {$mode delphi}
  4.  
  5. interface
  6.  
  7. uses
  8.   SysUtils, PXL.TypeDef, PXL.Types, PXL.Devices, PXL.Canvas, PXL.Images, PXL.Fonts,
  9.   PXL.Providers, PXL.Devices.Android, PXL.ImageFormats, PXL.ImageFormats.FCL;
  10.  
  11. var
  12.   FImageFormatHandler: TCustomImageFormatHandler = nil;
  13.  
  14.   EngineCanvas: TCustomCanvas = nil;
  15.   EngineImages: TAtlasImages = nil;
  16.   EngineFonts: TBitmapFonts = nil;
  17.  
  18.   DisplaySize: TPoint2i = (X: 0; Y: 0);
  19.   EngineTicks: Integer = 0;
  20.  
  21.   ImageLenna: Integer = -1;
  22.   FontTahoma: Integer = -1;
  23.  
  24.   procedure ApplicationCreate;
  25.   procedure ApplicationDestroy;
  26.  
  27.   procedure CreateResources;
  28.   procedure DestroyResources;
  29.  
  30.   procedure DeviceChange;
  31.   procedure PaintScreen;
  32.  
  33.   procedure ApplicationPaint;
  34.   procedure ApplicationProcess;
  35.  
  36. implementation
  37.  
  38. procedure ApplicationCreate;
  39. begin
  40.   Application.PresentationAttributes := [TPresentationAttribute.KeepScreenOn, TPresentationAttribute.FullScreen];
  41. end;
  42.  
  43. procedure ApplicationDestroy;
  44. begin
  45. end;
  46.  
  47. procedure CreateResources;
  48. begin
  49.   FImageFormatHandler := TFCLImageFormatHandler.Create(Application.ImageFormatManager);
  50.  
  51.   EngineCanvas := (Application.Provider as TGraphicsDeviceProvider).CreateCanvas(Application);
  52.   if not EngineCanvas.Initialize then
  53.     raise Exception.Create('Failed to initialize PXL Canvas.');
  54.  
  55.   EngineImages := TAtlasImages.Create(Application);
  56.  
  57.   ImageLenna := EngineImages.AddFromAsset('lenna.png');
  58.   if ImageLenna = -1 then
  59.     raise Exception.Create('Could not load Lenna image.');
  60.  
  61.   EngineFonts := TBitmapFonts.Create(Application);
  62.   EngineFonts.Canvas := EngineCanvas;
  63.  
  64.   FontTahoma := EngineFonts.AddFromBinaryAsset('Tahoma9b.font');
  65.   if FontTahoma = -1 then
  66.     raise Exception.Create('Could not load Tahoma font.');
  67. end;
  68.  
  69. procedure DestroyResources;
  70. begin
  71.   EngineFonts.Free;
  72.   EngineImages.Free;
  73.   EngineCanvas.Free;
  74.   FImageFormatHandler.Free;
  75. end;
  76.  
  77. procedure DeviceChange;
  78. begin
  79.   DisplaySize := Application.ContentRect.Size;
  80. end;
  81.  
  82. procedure PaintScreen;
  83. var
  84.   J, I: Integer;
  85.   Omega, Kappa: VectorFloat;
  86. begin
  87.   // Draw gray background.
  88.   for J := 0 to DisplaySize.Y div 40 do
  89.     for I := 0 to DisplaySize.X div 40 do
  90.       EngineCanvas.FillQuad(
  91.         Quad(I * 40, J * 40, 40, 40),
  92.         ColorRect($FF585858, $FF505050, $FF484848, $FF404040));
  93.  
  94.   for I := 0 to DisplaySize.X div 40 do
  95.     EngineCanvas.Line(
  96.       Point2f(I * 40.0, 0.0),
  97.       Point2f(I * 40.0, DisplaySize.Y),
  98.       $FF555555);
  99.  
  100.   for J := 0 to DisplaySize.Y div 40 do
  101.     EngineCanvas.Line(
  102.       Point2f(0.0, J * 40.0),
  103.       Point2f(DisplaySize.X, J * 40.0),
  104.       $FF555555);
  105.  
  106.   // Draw an animated hole.
  107.   EngineCanvas.QuadHole(
  108.     Point2f(0.0, 0.0),
  109.     DisplaySize,
  110.     Point2f(
  111.       DisplaySize.X * 0.5 + Cos(EngineTicks * 0.0073) * DisplaySize.X * 0.25,
  112.       DisplaySize.Y * 0.5 + Sin(EngineTicks * 0.00312) * DisplaySize.Y * 0.25),
  113.     Point2f(80.0, 100.0),
  114.     $20FFFFFF, $80955BFF, 16);
  115.  
  116.   // Draw the image of famous Lenna.
  117.   EngineCanvas.UseImage(EngineImages[ImageLenna]);
  118.   EngineCanvas.TexQuad(TQuad.Rotated(
  119.     TPoint2f(DisplaySize) * 0.5,
  120.     Point2f(300.0, 300.0),
  121.     EngineTicks * 0.01),
  122.     IntColorAlpha(128));
  123.  
  124.   // Draw an animated Arc.
  125.   Omega := EngineTicks * 0.0274;
  126.   Kappa := 1.25 * Pi + Sin(EngineTicks * 0.01854) * 0.5 * Pi;
  127.  
  128.   EngineCanvas.FillArc(
  129.     Point2f(DisplaySize.X * 0.1, DisplaySize.Y * 0.9),
  130.     Point2f(75.0, 50.0),
  131.     Omega, Omega + Kappa, 32,
  132.     ColorRect($FFFF0000, $FF00FF00, $FF0000FF, $FFFFFFFF));
  133.  
  134.   // Draw an animated Ribbon.
  135.   Omega := EngineTicks * 0.02231;
  136.   Kappa := 1.25 * Pi + Sin(EngineTicks * 0.024751) * 0.5 * Pi;
  137.  
  138.   EngineCanvas.FillRibbon(
  139.     Point2f(DisplaySize.X * 0.9, DisplaySize.Y * 0.85),
  140.     Point2f(25.0, 20.0),
  141.     Point2f(70.0, 80.0),
  142.     Omega, Omega + Kappa, 32,
  143.     ColorRect($FFFF0000, $FF00FF00, $FF0000FF, $FFFFFFFF));
  144.  
  145.   EngineFonts[FontTahoma].DrawText(
  146.     Point2f(4.0, 4.0),
  147.     'FPS: ' + IntToStr(Application.Timer.FrameRate),
  148.     ColorPair($FFFFE887, $FFFF0000));
  149.  
  150.   EngineFonts[FontTahoma].DrawText(
  151.     Point2f(4.0, 24.0),
  152.     'Technology: ' + GetFullDeviceTechString(Application),
  153.     ColorPair($FFE8FFAA, $FF12C312));
  154. end;
  155.  
  156. procedure ApplicationPaint;
  157. begin
  158.   Application.Clear([TClearType.Color], 0);
  159.  
  160.   if EngineCanvas.BeginScene then
  161.   try
  162.     PaintScreen;
  163.   finally
  164.     EngineCanvas.EndScene;
  165.   end;
  166. end;
  167.  
  168. procedure ApplicationProcess;
  169. begin
  170.   Inc(EngineTicks);
  171. end;
  172.  
  173. end.
  174.  

Code: Pascal  [Select][+][-]
  1. 11-28 21:00:56.800 2925-2925/com.pascal V/PXL: AppGlue: ANativeActivity_onCreate
  2. 11-28 21:00:56.801 2925-2925/com.pascal V/PXL: AppGlue: android_app_create
  3. 11-28 21:00:56.801 2925-2941/com.pascal V/PXL: AppGlue: android_app_entry
  4. 11-28 21:00:56.802 2925-2941/com.pascal A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 2941 (com.pascal)
  5. 11-28 21:00:56.803 2925-2925/com.pascal V/PXL: AppGlue: onStart
  6. 11-28 21:00:56.803 2925-2925/com.pascal V/PXL: AppGlue: android_app_set_activity_state
  7.  

« Last Edit: November 28, 2020, 06:30:00 pm by AliZairov »

AliZairov

  • New Member
  • *
  • Posts: 18
Re: Pascal eXtended Library (aka Asphyre) released!
« Reply #124 on: December 16, 2020, 09:36:03 am »
Hi. The cause of the problem is not finding images.

Code: Pascal  [Select][+][-]
  1. EngineImages := TAtlasImages.Create(Application);
  2.  
  3.   ImageLenna := EngineImages.AddFromAsset('lenna.png');
  4.   if ImageLenna = -1 then
  5.     raise Exception.Create('Could not load Lenna image.');
  6.  

It worked when I closed the code.

 

TinyPortal © 2005-2018