Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore: regenerate bindings for GridDirection / FanDirection enums

esengine383b6d5ecd5b
diff --git a/sdk/src/ecs/ptrAccessors.generated.ts b/sdk/src/ecs/ptrAccessors.generated.ts
index 676196239..c993066c6 100644
--- a/sdk/src/ecs/ptrAccessors.generated.ts
+++ b/sdk/src/ecs/ptrAccessors.generated.ts
@@ -403,7 +403,7 @@ export function fillFanLayout(
out.maxCardAngle = f32[(ptr + 8) >> 2];
out.tiltFactor = f32[(ptr + 12) >> 2];
out.cardSpacing = f32[(ptr + 16) >> 2];
- out.direction = u32[(ptr + 20) >> 2] | 0;
+ out.direction = u8[ptr + 20];
}
export function writeFanLayout(
@@ -415,7 +415,7 @@ export function writeFanLayout(
f32[(ptr + 8) >> 2] = data.maxCardAngle;
f32[(ptr + 12) >> 2] = data.tiltFactor;
f32[(ptr + 16) >> 2] = data.cardSpacing;
- u32[(ptr + 20) >> 2] = data.direction | 0;
+ u8[ptr + 20] = data.direction;
}
export function createFanLayoutData(): FanLayoutPtrData {
@@ -548,7 +548,7 @@ export function fillGridLayout(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
ptr: number, out: GridLayoutPtrData,
): void {
- out.direction = u32[ptr >> 2] | 0;
+ out.direction = u8[ptr];
out.crossAxisCount = u32[(ptr + 4) >> 2] | 0;
const itemSize_ = out.itemSize; itemSize_.x = f32[(ptr + 8) >> 2]; itemSize_.y = f32[((ptr + 8) >> 2) + 1];
const spacing_ = out.spacing; spacing_.x = f32[(ptr + 16) >> 2]; spacing_.y = f32[((ptr + 16) >> 2) + 1];
@@ -558,7 +558,7 @@ export function writeGridLayout(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
ptr: number, data: GridLayoutPtrData,
): void {
- u32[ptr >> 2] = data.direction | 0;
+ u8[ptr] = data.direction;
u32[(ptr + 4) >> 2] = data.crossAxisCount | 0;
f32[(ptr + 8) >> 2] = data.itemSize.x; f32[((ptr + 8) >> 2) + 1] = data.itemSize.y;
f32[(ptr + 16) >> 2] = data.spacing.x; f32[((ptr + 16) >> 2) + 1] = data.spacing.y;
diff --git a/sdk/src/ptrLayouts.generated.ts b/sdk/src/ptrLayouts.generated.ts
index fa477bc4a..a51c51f48 100644
--- a/sdk/src/ptrLayouts.generated.ts
+++ b/sdk/src/ptrLayouts.generated.ts
@@ -120,7 +120,7 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'maxCardAngle', type: 'f32', offset: 8 },
{ name: 'tiltFactor', type: 'f32', offset: 12 },
{ name: 'cardSpacing', type: 'f32', offset: 16 },
- { name: 'direction', type: 'i32', offset: 20 },
+ { name: 'direction', type: 'u8', offset: 20 },
],
},
FlexContainer: {
@@ -153,7 +153,7 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
GridLayout: {
ptrFn: 'getGridLayoutPtr',
fields: [
- { name: 'direction', type: 'i32', offset: 0 },
+ { name: 'direction', type: 'u8', offset: 0 },
{ name: 'crossAxisCount', type: 'i32', offset: 4 },
{ name: 'itemSize', type: 'vec2', offset: 8 },
{ name: 'spacing', type: 'vec2', offset: 16 },
diff --git a/sdk/src/wasm.generated.ts b/sdk/src/wasm.generated.ts
index efe339278..54303a307 100644
--- a/sdk/src/wasm.generated.ts
+++ b/sdk/src/wasm.generated.ts
@@ -48,6 +48,11 @@ export enum CanvasScaleMode {
Match = 4,
}
+export enum FanDirection {
+ Up = 0,
+ Down = 1,
+}
+
export enum FlexDirection {
Row = 0,
Column = 1,
@@ -93,6 +98,11 @@ export enum AlignSelf {
Stretch = 4,
}
+export enum GridDirection {
+ Vertical = 0,
+ Horizontal = 1,
+}
+
export enum LayoutDirection {
Horizontal = 0,
Vertical = 1,
diff --git a/sdk/wasm.generated.ts b/sdk/wasm.generated.ts
index efe339278..54303a307 100644
--- a/sdk/wasm.generated.ts
+++ b/sdk/wasm.generated.ts
@@ -48,6 +48,11 @@ export enum CanvasScaleMode {
Match = 4,
}
+export enum FanDirection {
+ Up = 0,
+ Down = 1,
+}
+
export enum FlexDirection {
Row = 0,
Column = 1,
@@ -93,6 +98,11 @@ export enum AlignSelf {
Stretch = 4,
}
+export enum GridDirection {
+ Vertical = 0,
+ Horizontal = 1,
+}
+
export enum LayoutDirection {
Horizontal = 0,
Vertical = 1,
diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cpp
index 4ebe28f6a..9e0b972ee 100644
--- a/src/esengine/bindings/EditorAPI.generated.cpp
+++ b/src/esengine/bindings/EditorAPI.generated.cpp
@@ -190,7 +190,7 @@ std::string editor_getComponentSchema(const std::string& name) {
{"key":"maxCardAngle","type":"float","group":"FanLayout"},
{"key":"tiltFactor","type":"float","group":"FanLayout"},
{"key":"cardSpacing","type":"float","group":"FanLayout"},
- {"key":"direction","type":"int","group":"FanLayout"}
+ {"key":"direction","type":"enum","group":"FanLayout","values":["Up","Down"]}
])JSON";
} else if (name == "FlexContainer") {
return R"JSON([
@@ -226,7 +226,7 @@ std::string editor_getComponentSchema(const std::string& name) {
])JSON";
} else if (name == "GridLayout") {
return R"JSON([
- {"key":"direction","type":"int","group":"GridLayout"},
+ {"key":"direction","type":"enum","group":"GridLayout","values":["Vertical","Horizontal"]},
{"key":"crossAxisCount","type":"int","group":"GridLayout"},
{"key":"itemSize.x","type":"float","group":"GridLayout"},
{"key":"itemSize.y","type":"float","group":"GridLayout"},
@@ -1299,7 +1299,7 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::str
} else if (comp == "FanLayout") {
if (!reg.has<esengine::ecs::FanLayout>(entity)) return false;
auto& c = reg.get<esengine::ecs::FanLayout>(entity);
- if (field == "direction") { c.direction = static_cast<i32>(value); }
+ if (field == "direction") { c.direction = static_cast<FanDirection>(value); }
else { return false; }
return true;
} else if (comp == "FlexContainer") {
@@ -1322,7 +1322,7 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::str
} else if (comp == "GridLayout") {
if (!reg.has<esengine::ecs::GridLayout>(entity)) return false;
auto& c = reg.get<esengine::ecs::GridLayout>(entity);
- if (field == "direction") { c.direction = static_cast<i32>(value); }
+ if (field == "direction") { c.direction = static_cast<GridDirection>(value); }
else if (field == "crossAxisCount") { c.crossAxisCount = static_cast<i32>(value); }
else { return false; }
return true;
diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cpp
index 5e7415d28..712735a95 100644
--- a/src/esengine/bindings/WebBindings.generated.cpp
+++ b/src/esengine/bindings/WebBindings.generated.cpp
@@ -104,6 +104,10 @@ EMSCRIPTEN_BINDINGS(esengine_enums) {
.value("Shrink", esengine::ecs::CanvasScaleMode::Shrink)
.value("Match", esengine::ecs::CanvasScaleMode::Match);
+ enum_<esengine::ecs::FanDirection>("FanDirection")
+ .value("Up", esengine::ecs::FanDirection::Up)
+ .value("Down", esengine::ecs::FanDirection::Down);
+
enum_<esengine::ecs::FlexDirection>("FlexDirection")
.value("Row", esengine::ecs::FlexDirection::Row)
.value("Column", esengine::ecs::FlexDirection::Column)
@@ -143,6 +147,10 @@ EMSCRIPTEN_BINDINGS(esengine_enums) {
.value("End", esengine::ecs::AlignSelf::End)
.value("Stretch", esengine::ecs::AlignSelf::Stretch);
+ enum_<esengine::ecs::GridDirection>("GridDirection")
+ .value("Vertical", esengine::ecs::GridDirection::Vertical)
+ .value("Horizontal", esengine::ecs::GridDirection::Horizontal);
+
enum_<esengine::ecs::LayoutDirection>("LayoutDirection")
.value("Horizontal", esengine::ecs::LayoutDirection::Horizontal)
.value("Vertical", esengine::ecs::LayoutDirection::Vertical);
@@ -291,6 +299,37 @@ CanvasJS canvasToJS(const esengine::ecs::Canvas& c) {
return js;
}
+struct FanLayoutJS {
+ f32 radius;
+ f32 maxSpreadAngle;
+ f32 maxCardAngle;
+ f32 tiltFactor;
+ f32 cardSpacing;
+ i32 direction;
+};
+
+esengine::ecs::FanLayout fanlayoutFromJS(const FanLayoutJS& js) {
+ esengine::ecs::FanLayout c;
+ c.radius = js.radius;
+ c.maxSpreadAngle = js.maxSpreadAngle;
+ c.maxCardAngle = js.maxCardAngle;
+ c.tiltFactor = js.tiltFactor;
+ c.cardSpacing = js.cardSpacing;
+ c.direction = static_cast<FanDirection>(js.direction);
+ return c;
+}
+
+FanLayoutJS fanlayoutToJS(const esengine::ecs::FanLayout& c) {
+ FanLayoutJS js;
+ js.radius = c.radius;
+ js.maxSpreadAngle = c.maxSpreadAngle;
+ js.maxCardAngle = c.maxCardAngle;
+ js.tiltFactor = c.tiltFactor;
+ js.cardSpacing = c.cardSpacing;
+ js.direction = static_cast<i32>(c.direction);
+ return js;
+}
+
struct FlexContainerJS {
i32 direction;
i32 wrap;
@@ -374,6 +413,31 @@ FlexItemJS flexitemToJS(const esengine::ecs::FlexItem& c) {
return js;
}
+struct GridLayoutJS {
+ i32 direction;
+ i32 crossAxisCount;
+ glm::vec2 itemSize;
+ glm::vec2 spacing;
+};
+
+esengine::ecs::GridLayout gridlayoutFromJS(const GridLayoutJS& js) {
+ esengine::ecs::GridLayout c;
+ c.direction = static_cast<GridDirection>(js.direction);
+ c.crossAxisCount = js.crossAxisCount;
+ c.itemSize = js.itemSize;
+ c.spacing = js.spacing;
+ return c;
+}
+
+GridLayoutJS gridlayoutToJS(const esengine::ecs::GridLayout& c) {
+ GridLayoutJS js;
+ js.direction = static_cast<i32>(c.direction);
+ js.crossAxisCount = c.crossAxisCount;
+ js.itemSize = c.itemSize;
+ js.spacing = c.spacing;
+ return js;
+}
+
struct ParentJS {
u32 entity;
};
@@ -791,13 +855,13 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("categoryBits", &esengine::ecs::SegmentCollider::categoryBits)
.field("maskBits", &esengine::ecs::SegmentCollider::maskBits);
- value_object<esengine::ecs::FanLayout>("FanLayout")
- .field("radius", &esengine::ecs::FanLayout::radius)
- .field("maxSpreadAngle", &esengine::ecs::FanLayout::maxSpreadAngle)
- .field("maxCardAngle", &esengine::ecs::FanLayout::maxCardAngle)
- .field("tiltFactor", &esengine::ecs::FanLayout::tiltFactor)
- .field("cardSpacing", &esengine::ecs::FanLayout::cardSpacing)
- .field("direction", &esengine::ecs::FanLayout::direction);
+ value_object<FanLayoutJS>("FanLayout")
+ .field("radius", &FanLayoutJS::radius)
+ .field("maxSpreadAngle", &FanLayoutJS::maxSpreadAngle)
+ .field("maxCardAngle", &FanLayoutJS::maxCardAngle)
+ .field("tiltFactor", &FanLayoutJS::tiltFactor)
+ .field("cardSpacing", &FanLayoutJS::cardSpacing)
+ .field("direction", &FanLayoutJS::direction);
value_object<FlexContainerJS>("FlexContainer")
.field("direction", &FlexContainerJS::direction)
@@ -822,11 +886,11 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("widthPercent", &FlexItemJS::widthPercent)
.field("heightPercent", &FlexItemJS::heightPercent);
- value_object<esengine::ecs::GridLayout>("GridLayout")
- .field("direction", &esengine::ecs::GridLayout::direction)
- .field("crossAxisCount", &esengine::ecs::GridLayout::crossAxisCount)
- .field("itemSize", &esengine::ecs::GridLayout::itemSize)
- .field("spacing", &esengine::ecs::GridLayout::spacing);
+ value_object<GridLayoutJS>("GridLayout")
+ .field("direction", &GridLayoutJS::direction)
+ .field("crossAxisCount", &GridLayoutJS::crossAxisCount)
+ .field("itemSize", &GridLayoutJS::itemSize)
+ .field("spacing", &GridLayoutJS::spacing);
value_object<ParentJS>("Parent")
.field("entity", &ParentJS::entity);
@@ -1151,16 +1215,15 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
.function("hasFanLayout", optional_override([](Registry& r, u32 e) {
return r.has<esengine::ecs::FanLayout>(static_cast<Entity>(e));
}))
- .function("getFanLayout", optional_override([](Registry& r, u32 e) -> esengine::ecs::FanLayout& {
+ .function("getFanLayout", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- static esengine::ecs::FanLayout s_dummy{};
- if (!r.valid(entity) || !r.has<esengine::ecs::FanLayout>(entity)) return s_dummy;
- return r.get<esengine::ecs::FanLayout>(entity);
- }), allow_raw_pointers())
- .function("addFanLayout", optional_override([](Registry& r, u32 e, const esengine::ecs::FanLayout& c) {
+ if (!r.valid(entity) || !r.has<esengine::ecs::FanLayout>(entity)) return FanLayoutJS{};
+ return fanlayoutToJS(r.get<esengine::ecs::FanLayout>(entity));
+ }))
+ .function("addFanLayout", optional_override([](Registry& r, u32 e, const FanLayoutJS& js) {
auto entity = static_cast<Entity>(e);
if (!r.valid(entity)) return;
- r.emplaceOrReplace<esengine::ecs::FanLayout>(entity, c);
+ r.emplaceOrReplace<esengine::ecs::FanLayout>(entity, fanlayoutFromJS(js));
}))
.function("removeFanLayout", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
@@ -1212,16 +1275,15 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
.function("hasGridLayout", optional_override([](Registry& r, u32 e) {
return r.has<esengine::ecs::GridLayout>(static_cast<Entity>(e));
}))
- .function("getGridLayout", optional_override([](Registry& r, u32 e) -> esengine::ecs::GridLayout& {
+ .function("getGridLayout", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- static esengine::ecs::GridLayout s_dummy{};
- if (!r.valid(entity) || !r.has<esengine::ecs::GridLayout>(entity)) return s_dummy;
- return r.get<esengine::ecs::GridLayout>(entity);
- }), allow_raw_pointers())
- .function("addGridLayout", optional_override([](Registry& r, u32 e, const esengine::ecs::GridLayout& c) {
+ if (!r.valid(entity) || !r.has<esengine::ecs::GridLayout>(entity)) return GridLayoutJS{};
+ return gridlayoutToJS(r.get<esengine::ecs::GridLayout>(entity));
+ }))
+ .function("addGridLayout", optional_override([](Registry& r, u32 e, const GridLayoutJS& js) {
auto entity = static_cast<Entity>(e);
if (!r.valid(entity)) return;
- r.emplaceOrReplace<esengine::ecs::GridLayout>(entity, c);
+ r.emplaceOrReplace<esengine::ecs::GridLayout>(entity, gridlayoutFromJS(js));
}))
.function("removeGridLayout", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);