mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Add missing enum type generation
This commit is contained in:
@@ -126,9 +126,26 @@ class Parser {
|
||||
}
|
||||
}
|
||||
|
||||
const enums = [];
|
||||
for (const [_, enumName, enumCode] of bindingsFile.matchAll(
|
||||
/enum\s+([a-zA-Z_]+)\s+{\r?\n?([^}]*)\r?\n}/gm
|
||||
)) {
|
||||
const members = [];
|
||||
let i = 0;
|
||||
for (const enumMemberString of enumCode.split('\n')) {
|
||||
const [_, memberName] = enumMemberString.match(/"[a-zA-Z]*::([a-zA-Z]*)"/);
|
||||
members.push(` ${memberName} = ${i++},`);
|
||||
}
|
||||
enums.push(
|
||||
`enum ${enumName} {
|
||||
${members.join('\n')}
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
const interfaces = [];
|
||||
for (const [a, interfaceName, interfaceCode] of bindingsFile.matchAll(
|
||||
/interface ([a-zA-Z]+) {\r?\n?([^}]*)\r?\n}/gm
|
||||
for (const [_, interfaceName, interfaceCode] of bindingsFile.matchAll(
|
||||
/interface\s+([a-zA-Z]+)\s+{\r?\n?([^}]*)\r?\n}/gm
|
||||
)) {
|
||||
const methods = [];
|
||||
|
||||
@@ -223,6 +240,8 @@ class EmscriptenObject {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
${enums.join('\n\n')}
|
||||
|
||||
${interfaces.join('\n\n')}
|
||||
|
||||
export as namespace gd;
|
||||
|
30
GDevelop.js/types.d.ts
vendored
30
GDevelop.js/types.d.ts
vendored
@@ -18,6 +18,36 @@ class EmscriptenObject {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
enum Variable_Type {
|
||||
String = 0,
|
||||
Number = 1,
|
||||
Boolean = 2,
|
||||
Structure = 3,
|
||||
Array = 4,
|
||||
}
|
||||
|
||||
enum ExpressionCompletionDescription_CompletionKind {
|
||||
Object = 0,
|
||||
Behavior = 1,
|
||||
Expression = 2,
|
||||
Variable = 3,
|
||||
Text = 4,
|
||||
}
|
||||
|
||||
enum EventsFunction_FunctionType {
|
||||
Action = 0,
|
||||
Condition = 1,
|
||||
Expression = 2,
|
||||
ExpressionAndCondition = 3,
|
||||
ActionWithOperator = 4,
|
||||
}
|
||||
|
||||
enum ParticleEmitterObject_RendererType {
|
||||
Point = 0,
|
||||
Line = 1,
|
||||
Quad = 2,
|
||||
}
|
||||
|
||||
export class VectorString extends EmscriptenObject {
|
||||
constructor(): void;
|
||||
push_back(str: string): void;
|
||||
|
Reference in New Issue
Block a user