This repository was archived by the owner on Nov 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapi.lua
More file actions
41 lines (37 loc) · 1.18 KB
/
api.lua
File metadata and controls
41 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
L.add_arg_conv_rule("const char*",
function (idx)
local v = { idx = idx }
local str = E("
Local<String> str${idx} = args[${idx}]->ToString();
String::AsciiValue strVal${idx}(str${idx});
const char* rarg${idx} = *strVal${idx};
", v)
return str, E("rarg${idx}", v)
end)
L.add_arg_conv_rule("int",
function (idx)
local v = { idx = idx }
local str = E("
Local<Integer> integer${idx} = args[${idx}]->ToInteger();
int rarg${idx} = integer${idx}->Value();
", v)
return str, E("rarg${idx}", v)
end)
L.add_struct({ { "uint32", "w" },
{ "uint32", "h" },
{ "uint32", "texw" },
{ "uint32", "texh" },
{ "uint8", "bpb" },
{ "uint8", "swizzle" },
{ "uint32", "mode" },
{ "uint32", "dtype" },
{ "uint8*", "data", jsType = "Buffer" },
{ "float", "rcentrex" },
{ "float", "rcentrey" },
{ "uint32", "texid" },
{ "uint8", "modified" },
{ "uint8", "dontswizzle" },
{ "int", "mask" }
})
L.add_function({ "image_p", "image_load", {"const char*", "int", "int"} })
L.add_function({ "image_p", "image_load_buf", { "const char*", "int", "int", "int" } })