[fpc-pascal] Next language feature for pas2js...
Ryan Joseph
ryan at thealchemistguild.com
Tue May 1 10:23:25 CEST 2018
> On May 1, 2018, at 3:17 PM, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
>
> JS only knows double for numbers.
>
> At compile time you can use almost all the normal types: byte,
> word, longint, etc.
> pas2js has an alias single, but because internally it is a double this
> gives warnings.
what do we do for records then? We often need to pass arrays of specific types for functions such as glBufferData.
type
TVec2f = record
x, y: GLfloat;
end;
type
TVec2b = record
x, y: GLubyte;
end;
var
verts: array[0..2] of TVec2f;
begin
glBufferData(GL_ARRAY_BUFFER, sizeof(TVec2f) * 3, @verts, GL_STATIC_DRAW); // pass an array of TVec2 but how does JS know this?
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list