Skip to content

Commit df6456a

Browse files
committed
feat: component update/remove, entity create/destroy
1 parent 2d35bdb commit df6456a

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed

Source/Ecsact/Public/EcsactUnreal/EcsactRunnerSubsystem.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ auto UEcsactRunnerSubsystem::RunnerStop_Implementation(
99
class UEcsactRunner* Runner
1010
) -> void {
1111
}
12+
13+
auto UEcsactRunnerSubsystem::EntityCreated_Implementation( //
14+
int32 Entity
15+
) -> void {
16+
}
17+
18+
auto UEcsactRunnerSubsystem::EntityDestroyed_Implementation( //
19+
int32 Entity
20+
) -> void {
21+
}

Source/Ecsact/Public/EcsactUnreal/EcsactRunnerSubsystem.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,18 @@ class ECSACT_API UEcsactRunnerSubsystem : public UObject {
2020
virtual auto RunnerStop_Implementation( //
2121
class UEcsactRunner* Runner
2222
) -> void;
23+
24+
UFUNCTION(BlueprintNativeEvent, Category = "Ecsact Runner")
25+
void EntityCreated(int32 Entity);
26+
27+
UFUNCTION(BlueprintNativeEvent, Category = "Ecsact Runner")
28+
void EntityDestroyed(int32 Entity);
29+
30+
virtual auto EntityCreated_Implementation( //
31+
int32 Entity
32+
) -> void;
33+
34+
virtual auto EntityDestroyed_Implementation( //
35+
int32 Entity
36+
) -> void;
2337
};

Source/EcsactUnrealCodegenPlugin/EcsactUnrealCodegenPlugin.cpp

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,8 @@ static auto generate_header(ecsact::codegen_plugin_context ctx) -> void {
279279
auto comp_pascal_name = ecsact_decl_name_to_pascal(comp_name);
280280
auto comp_ustruct_name = ecsact_ustruct_name(comp_id);
281281
ctx.write(std::format(
282-
"UFUNCTION(BlueprintNativeEvent, Category = \"Ecsact Runner\", meta "
283-
"= "
284-
"(DisplayName = \"Init {}\"))\n",
282+
"UFUNCTION(BlueprintNativeEvent, Category = \"Ecsact Runner\", "
283+
"meta = (DisplayName = \"Init {}\"))\n",
285284
comp_full_name
286285
));
287286
ctx.write(std::format(
@@ -294,6 +293,38 @@ static auto generate_header(ecsact::codegen_plugin_context ctx) -> void {
294293
comp_pascal_name,
295294
comp_ustruct_name
296295
));
296+
297+
ctx.write(std::format(
298+
"UFUNCTION(BlueprintNativeEvent, Category = \"Ecsact Runner\", "
299+
"meta = (DisplayName = \"Update {}\"))\n",
300+
comp_full_name
301+
));
302+
ctx.write(std::format(
303+
"void Update{0}(int32 Entity, {1} {0});\n",
304+
comp_pascal_name,
305+
comp_ustruct_name
306+
));
307+
ctx.write(std::format(
308+
"virtual void Update{0}_Implementation(int32 Entity, {1} {0});\n",
309+
comp_pascal_name,
310+
comp_ustruct_name
311+
));
312+
313+
ctx.write(std::format(
314+
"UFUNCTION(BlueprintNativeEvent, Category = \"Ecsact Runner\", "
315+
"meta = (DisplayName = \"Remove {}\"))\n",
316+
comp_full_name
317+
));
318+
ctx.write(std::format(
319+
"void Remove{0}(int32 Entity, {1} {0});\n",
320+
comp_pascal_name,
321+
comp_ustruct_name
322+
));
323+
ctx.write(std::format(
324+
"virtual void Remove{0}_Implementation(int32 Entity, {1} {0});\n",
325+
comp_pascal_name,
326+
comp_ustruct_name
327+
));
297328
}
298329
}
299330
);
@@ -326,6 +357,36 @@ static auto generate_source(ecsact::codegen_plugin_context ctx) -> void {
326357
}
327358
);
328359
ctx.writef("\n\n");
360+
361+
block(
362+
ctx,
363+
std::format(
364+
"void U{0}EcsactRunnerSubsystem::Update{1}_Implementation"
365+
"(int32 Entity, {2} {1})",
366+
package_pascal_name,
367+
comp_pascal_name,
368+
comp_ustruct_name
369+
),
370+
[&] {
371+
372+
}
373+
);
374+
ctx.writef("\n\n");
375+
376+
block(
377+
ctx,
378+
std::format(
379+
"void U{0}EcsactRunnerSubsystem::Remove{1}_Implementation"
380+
"(int32 Entity, {2} {1})",
381+
package_pascal_name,
382+
comp_pascal_name,
383+
comp_ustruct_name
384+
),
385+
[&] {
386+
387+
}
388+
);
389+
ctx.writef("\n\n");
329390
}
330391
}
331392

0 commit comments

Comments
 (0)