载入中...
搜索中...
未找到
Joint2DBindings.cpp
浏览该文件的文档.
36 return Result<Joint2DSettings>::success({type, anchorA, anchorB, axis, groundA, groundB, length, ratio,
43 if (value.getType() != ssq::Type::INSTANCE || value.getTypeTag() != eve::script::detail::squirrelTypeHash<T*>())
53 vm, Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "Live joint inputs required")));
71 return ResultRef<Joint2D>::failure(Diagnostic::error(DiagnosticCode::StaleHandle, "Joint is absent or destroyed"));
109 return target ? script::projectResult(vm, target.value().get().setMotor(enabled, speed, maximumForce))
114 return target ? script::projectResult(vm, target.value().get().setLimits(enabled, lower, upper))
117 joint.addFunc("destroy", [vm](T* self) { return script::projectResult(vm, remove(checkedReceiver(vm, self))); });
122 auto v = [](JointPoint2D p) { return Value(Value::Object{{"x", Value(p.x)}, {"y", Value(p.y)}}); };
149 auto joint = table.addClass<Joint2D>("Joint2D", std::function<Joint2D*()>([] { return nullptr; }), true);
197 return own(vm, Result<std::unique_ptr<ScriptJointObserver>>::success(std::make_unique<ScriptJointObserver>(
200 table.addFunc("createJoint2D", [vm = table.getHandle()](ssq::Object worldObject, ssq::Object aObject,
211 table.addFunc("createGearJoint2D", [vm = table.getHandle()](ssq::Object worldObject, ssq::Object aObject,
Typed composition link from a gameplay entity to a physics body.
The single Squirrel projection for common Result, Status and Value.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
Owning planar joint wrapper observing World-owned backend state. @ownership Caller/VM owns factory wr...
Definition Joint2D.h:58
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
Joint2DKind
Closed set of planar mechanical constraints. Gear couples two existing joints.
Definition Joint2D.h:16
@ Distance
@ Revolute
@ Prismatic
void exposeJoint2DBindings(ssq::Table &table)
Register owning Joint2D Result factories; borrows table during this call on the VM owner thread only.
Definition Joint2DBindings.cpp:133
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:524
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:540
eve::Result< ssq::Object > makeOwnedSquirrelInstance(HSQUIRRELVM vm, Owned< T > object)
Creates a Squirrel instance that owns a C++ wrapper through a release hook.
Definition SquirrelOwnership.h:240
@ InvalidArgument
@ StaleHandle
Owning world-space point/direction in SI (meters), not pixel coordinates.
Definition Joint2D.h:19