mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Formatting
This commit is contained in:
parent
e7b47f64f3
commit
34387d48d4
@ -53,21 +53,21 @@ bool PhysicsExample::init() {
|
||||
|
||||
// Next we setup a listener that receives and stores
|
||||
// the current mouse location and updates the skeleton position
|
||||
// accordingly.
|
||||
// accordingly.
|
||||
EventListenerMouse *mouseListener = EventListenerMouse::create();
|
||||
mouseListener->onMouseMove = [this](cocos2d::Event *event) -> void {
|
||||
// convert the mosue location to the skeleton's coordinate space
|
||||
// and store it.
|
||||
EventMouse *mouseEvent = dynamic_cast<EventMouse *>(event);
|
||||
Vec2 mousePosition = skeletonNode->convertToNodeSpace(mouseEvent->getLocationInView());
|
||||
if (firstUpdate) {
|
||||
firstUpdate = false;
|
||||
lastMousePosition = mousePosition;
|
||||
return;
|
||||
}
|
||||
Vec2 delta = mousePosition - lastMousePosition;
|
||||
skeletonNode->getSkeleton()->physicsTranslate(-delta.x, -delta.y);
|
||||
lastMousePosition = mousePosition;
|
||||
if (firstUpdate) {
|
||||
firstUpdate = false;
|
||||
lastMousePosition = mousePosition;
|
||||
return;
|
||||
}
|
||||
Vec2 delta = mousePosition - lastMousePosition;
|
||||
skeletonNode->getSkeleton()->physicsTranslate(-delta.x, -delta.y);
|
||||
lastMousePosition = mousePosition;
|
||||
};
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(mouseListener, this);
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
|
||||
private:
|
||||
spine::SkeletonAnimation *skeletonNode;
|
||||
bool firstUpdate = true;
|
||||
bool firstUpdate = true;
|
||||
cocos2d::Vec2 lastMousePosition;
|
||||
};
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ struct AtlasInput {
|
||||
line.end = index;
|
||||
if (index != end) index++;
|
||||
line = line.trim();
|
||||
line.length = (int)(end - start);
|
||||
line.length = (int) (end - start);
|
||||
return &line;
|
||||
}
|
||||
|
||||
|
||||
@ -1164,7 +1164,7 @@ Animation *SkeletonJson::readAnimation(Json *root, SkeletonData *skeletonData) {
|
||||
timelines.add(readTimeline(timelineMap->_child, timeline, 0, 1));
|
||||
} else if (strcmp(timelineMap->_name, "inherit") == 0) {
|
||||
InheritTimeline *timeline = new (__FILE__, __LINE__) InheritTimeline(frames, boneIndex);
|
||||
keyMap = timelineMap->_child;
|
||||
keyMap = timelineMap->_child;
|
||||
for (frame = 0;; frame++) {
|
||||
float time = Json::getFloat(keyMap, "time", 0);
|
||||
const char *value = Json::getString(keyMap, "value", "normal");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user