plugin.cpp 623 B

1234567891011121314151617181920212223242526
  1. #include <cr.h>
  2. #include "types.h"
  3. CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
  4. switch (operation) {
  5. case CR_STEP:
  6. [ctx]() {
  7. auto *proxy = static_cast<registry_proxy *>(ctx->userdata);
  8. proxy->assign({1., 1.});
  9. proxy->for_each([](auto &pos, auto &vel) {
  10. pos.x += static_cast<int>(16 * vel.dx);
  11. pos.y += static_cast<int>(16 * vel.dy);
  12. });
  13. }();
  14. break;
  15. case CR_CLOSE:
  16. case CR_LOAD:
  17. case CR_UNLOAD:
  18. // nothing to do here, this is only a test.
  19. break;
  20. }
  21. return 0;
  22. }