[Pas2js] pas2js Webgl unit committed

Michael Van Canneyt michael at freepascal.org
Thu May 10 14:23:30 CEST 2018



On Thu, 10 May 2018, Ryan Joseph wrote:

>
>
>> On May 10, 2018, at 4:52 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> Update SVN. I added all the calls. So now you can do
>>
>>  a : TJSFloat32Array;
>> 
>> begin
>>  a:=TJSFloat32Array.New(3);
>> end;
>> 
>> With any of the documented constructors. The from/_of class functions also work.
>
> Thanks, working now, that’s great. 
>
> This syntax is still not working though. What’s wrong?

Works here if I add

{$modeswitch externalclass} 
>
> type
> TJSFloat32Point = class external name 'Float32Array' (TJSFloat32Array)
> public
>   x: Float32; external name '[0]';
>   y: Float32; external name '[1]';
> end;


uses browserconsole, js, web;

type
{$modeswitch externalclass}

  TJSFloat32Point = class external name 'Float32Array' (TJSFloat32Array)
  public
    x: Float32; external name '[0]';
    y: Float32; external name '[1]';
  end;

var
   b  : TJSFloat32Point;

begin
   b:=TJSFloat32Point.New(2);
   b.x:=1.0;
   b.y:=2.0;
   Writeln(b.x,' and :',b.y);
end.

Writes
1 and :2

Michael.


More information about the Pas2js mailing list