-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
C++ Script APIFeatureNew feature or requestNew feature or requestOn HoldFeatures that are lower priorityFeatures that are lower prioritymodule: engineFor features that involve the `engine` module. (optional)For features that involve the `engine` module. (optional)
Description
We currently need scripts to be defined either as individual files (my_script_file.cpp) or as embedded lambdas/script expressions (SCRIPT_BEGIN, SCRIPT_END, on(...), etc.), but this isn't always the most natural way to define a script.
We should extend the macro API (found in engine:script's embedded_script.hpp file) to allow script definitions outside of the body of the current script.
This would look something like:
SCRIPT(my_custom_script)
while (true)
{
const auto& button_event = co_await until<OnButtonPressed>();
print("Button pressed: {}", button_event.button);
}
END_SCRIPT()
auto my_script_file()
{
co_await start_script<my_custom_script>();
// ...
}We could also optionally have a SCRIPT_CLASS macro to allow for extensions similar to the header-based approach.
SCRIPT_CLASS(my_custom_script)
decltype(auto) some_fn(thid auto&& self, auto&& some_arg, auto&&... etc)
{
// ...
}
END_SCRIPT_CLASS()NOTE: SCRIPT_CLASS may need to be defined above the SCRIPT(my_custom_script) section.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C++ Script APIFeatureNew feature or requestNew feature or requestOn HoldFeatures that are lower priorityFeatures that are lower prioritymodule: engineFor features that involve the `engine` module. (optional)For features that involve the `engine` module. (optional)