Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Apr 10, 2024
1 parent e7b47f6 commit 34387d4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions spine-cocos2dx/example/Classes/PhysicsExample.cpp
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion spine-cocos2dx/example/Classes/PhysicsExample.h
Expand Up @@ -45,7 +45,7 @@ class PhysicsExample : public cocos2d::LayerColor {

private:
spine::SkeletonAnimation *skeletonNode;
bool firstUpdate = true;
bool firstUpdate = true;
cocos2d::Vec2 lastMousePosition;
};

Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/src/spine/Atlas.cpp
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit 34387d4

Please sign in to comment.