MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / AttachController

Method AttachController

GTE/Graphics/ControlledObject.cpp:12–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace gte;
11
12void ControlledObject::AttachController(std::shared_ptr<Controller> const& controller)
13{
14 if (controller)
15 {
16 // Test whether the controller is already in the list.
17 for (auto const& element : mControllers)
18 {
19 if (element == controller)
20 {
21 // The controller is in the list, so nothing to do.
22 return;
23 }
24 }
25
26 // Bind the controller to the object using a regular pointer to avoid
27 // a reference-count cycle.
28 controller->SetObject(this);
29
30 // The controller is not in the current list, so add it.
31 mControllers.push_back(controller);
32 }
33}
34
35void ControlledObject::DetachController(std::shared_ptr<Controller> const& controller)
36{

Callers 6

CreateSceneMethod · 0.80
BipedManagerMethod · 0.80
DoAnimationMethod · 0.80
CreateSceneMethod · 0.80
CreateSceneMethod · 0.80
CreateSceneMethod · 0.80

Calls 1

SetObjectMethod · 0.45

Tested by

no test coverage detected