[fpc-pascal] pas2js Webgl unit committed

Michael Van Canneyt michael at freepascal.org
Wed May 9 12:46:50 CEST 2018



On Wed, 9 May 2018, Ryan Joseph wrote:

>
>
>> On May 9, 2018, at 1:46 PM, Ryan Joseph <ryan at thealchemistguild.com> wrote:
>> 
>> Ok got it working now finally. Now I need to learn how to do anything at all besides writeln. :)
>
> Finally got a context open and working. Next things:
>
> 1) what’s the best way to handle long strings? in JS they’ll loading text from divs but i’d rather do that from a file since long strings in Pascal aren’t great. How does that work?

What do you mean by this ? "long strings in pascal aren't great".

What do you want to achieve ?

>
> 2) what’s the deal with arrays? 
> I saw there is array of xxx syntax for dynamic arrays. Can we use static arrays also and do they work with new Float32Array(xxx)? I guess all JS arrays are the same and I can pass them like

You can use static arrays.

>
> 3) how does the syntax “new Float32Array()” translate to Pascal? There’s no generic class allocator syntax in Pascal so what do we use?

var
   a : TJSFloat32Array;

begin
   a:=TJSFloat32Array(TJSFloat32Array.From(something))
end;

I will see about introducing some things to make this easier.

>
> 4) in functions from webgl that return strings the type is “JSValue”. How do those work with “string” in Pascal now? Maybe just typecast to string?

Yes. Note that if they return JSValue, it means that the return type can
also be different from string.

Michael.


More information about the fpc-pascal mailing list