MCPcopy Create free account
hub / github.com/axmolengine/axmol / init

Method init

tests/cpp-tests/Source/SpineTest/SpineTest.cpp:109–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109bool SpineTestLayer::init()
110{
111 if (!TestCase::init())
112 return false;
113
114 EventListenerTouchOneByOne* listener = EventListenerTouchOneByOne::create();
115 listener->onTouchBegan = [this](Touch* touch, ax::Event* event) -> bool {
116 if (!skeletonNode)
117 return true;
118 _touchIndex = (_touchIndex + 1) % 3;
119 if (_touchIndex == 0)
120 {
121 skeletonNode->setDebugBonesEnabled(false);
122 skeletonNode->setTimeScale(1.0f);
123 }
124 else if (_touchIndex == 1)
125 {
126 skeletonNode->setDebugBonesEnabled(true);
127 skeletonNode->setTimeScale(1.0f);
128 }
129 else if (_touchIndex == 2)
130 {
131 skeletonNode->setDebugBonesEnabled(true);
132 skeletonNode->setTimeScale(0.3f);
133
134 // refer issue: https://github.com/axmolengine/axmol/issues/482
135 // Get Spine node PS and update uniforms
136 auto skeleton1PS = skeletonNode->getProgramState();
137
138 if (skeleton1PS)
139 {
140 Vec2 resolution{100.f, 100.f};
141 float blurRadius = 50.0f;
142 float sampleNum = 7.0f;
143
144 // This doesn't work on Spine node, works on sprite node
145 SET_UNIFORM(skeleton1PS, "resolution", resolution);
146 SET_UNIFORM(skeleton1PS, "blurRadius", blurRadius);
147 SET_UNIFORM(skeleton1PS, "sampleNum", sampleNum);
148 }
149
150 }
151 return true;
152 };
153 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
154
155 SCALE_SKELETON_NODE(skeletonNode);
156
157 return true;
158}
159
160// BatchingExample
161bool BatchingExample::init()

Callers

nothing calls this directly

Calls 15

createFunction · 0.85
scheduleUpdateFunction · 0.85
getInstanceFunction · 0.85
setDebugBonesEnabledMethod · 0.80
setAnimationStateDataMethod · 0.80
convertToNodeSpaceMethod · 0.80
worldToLocalMethod · 0.80
getSkeletonMethod · 0.80
findSkinMethod · 0.80
loadProgramMethod · 0.80

Tested by

no test coverage detected