[fpc-pascal] Next language feature for pas2js...
Ryan Joseph
ryan at thealchemistguild.com
Tue May 1 07:11:37 CEST 2018
> On May 1, 2018, at 11:27 AM, Michalis Kamburelis <michalis.kambi at gmail.com> wrote:
>
> I suspect that we will have a unit like WebGL in pas2js that exposes
> the necessary JS functions for Pascal applications.
Sure but how does the porting process look? I’m reading the wiki and it looks like it wraps JavaScript classes by doing stuff like:
TJSFunction = class external name 'Function'(TJSObject)
where “Function” is the JavaScript class name.
Looking at https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API I see WebGLRenderingContext has the entire OpenGL API (I think). Does that mean we just do something like:
const
GLfloat = MAP_TO_SOMETHING; // do we have external consts?
type
TWebGLRenderingContext = class external name 'WebGLRenderingContext' (TJSObject)
procedure clearColor (red, green, blue, alpha: GLfloat); external name 'clearColor';
end;
var
context:
begin
context := GetCurrentContext; // document.getElementById(‘canvas’).getContext()
context.clearColor(0, 0, 0, 0);
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list