Prechádzať zdrojové kódy

Adding CMakeLists.txt and fixing some compiler warnings

Stephen Gowen 7 rokov pred
rodič
commit
7983a6e743

+ 9 - 0
spine-cpp/CMakeLists.txt

@@ -0,0 +1,9 @@
+include_directories(include)
+file(GLOB INCLUDES "spine-cpp/include/**/*.h")
+file(GLOB SOURCES "spine-cpp/src/**/*.cpp")
+
+set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -std=c++03 -pedantic")
+add_library(spine-cpp STATIC ${SOURCES} ${INCLUDES})
+target_include_directories(spine-cpp PUBLIC spine-cpp/include)
+install(TARGETS spine-cpp DESTINATION dist/lib)
+install(FILES ${INCLUDES} DESTINATION dist/include)

+ 6 - 2
spine-cpp/spine-cpp/include/spine/HashMap.h

@@ -89,7 +89,12 @@ namespace Spine
             Entry* _entry;
         };
         
-        HashMap(size_t capacity = 65535) : _capacity(capacity), _hashFunction(), _header(), _trailer()
+        HashMap(size_t capacity = 65535) :
+        _hashFunction(),
+        _capacity(capacity),
+        _header(),
+        _trailer(),
+        _hashSize(0)
         {
             _hashTable = new Entry[capacity];
             for (int i = 0; i < _capacity; ++i)
@@ -101,7 +106,6 @@ namespace Spine
             _header.next = &_trailer;
             _trailer.prev = &_header;
             _trailer.next = &_trailer;
-            _hashSize = 0;
         }
         
         ~HashMap()

+ 2 - 2
spine-cpp/spine-cpp/src/spine/Animation.cpp

@@ -40,9 +40,9 @@
 namespace Spine
 {
     Animation::Animation(std::string name, Vector<Timeline*>& timelines, float duration) :
-    _name(name),
     _timelines(timelines),
-    _duration(duration)
+    _duration(duration),
+    _name(name)
     {
         assert(_name.length() > 0);
     }

+ 1 - 1
spine-cpp/spine-cpp/src/spine/Event.cpp

@@ -35,8 +35,8 @@
 namespace Spine
 {
     Event::Event(float time, const EventData& data) :
-    _time(time),
     _data(data),
+    _time(time),
     _intValue(0),
     _floatValue(0),
     _stringValue()

+ 2 - 2
spine-cpp/spine-cpp/src/spine/PathConstraint.cpp

@@ -52,11 +52,11 @@ namespace Spine
     
     PathConstraint::PathConstraint(PathConstraintData& data, Skeleton& skeleton) : Constraint(),
     _data(data),
+    _target(skeleton.findSlot(data.getTarget()->getName())),
     _position(data.getPosition()),
     _spacing(data.getSpacing()),
     _rotateMix(data.getRotateMix()),
-    _translateMix(data.getTranslateMix()),
-    _target(skeleton.findSlot(data.getTarget()->getName()))
+    _translateMix(data.getTranslateMix())
     {
         _bones.reserve(_data.getBones().size());
         for (BoneData** i = _data.getBones().begin(); i != _data.getBones().end(); ++i)

+ 2 - 2
spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp

@@ -41,11 +41,11 @@ namespace Spine
 {
     TransformConstraint::TransformConstraint(TransformConstraintData& data, Skeleton& skeleton) : Constraint(),
     _data(data),
+    _target(skeleton.findBone(data.getTarget()->getName())),
     _rotateMix(data.getRotateMix()),
     _translateMix(data.getTranslateMix()),
     _scaleMix(data.getScaleMix()),
-    _shearMix(data.getShearMix()),
-    _target(skeleton.findBone(data.getTarget()->getName()))
+    _shearMix(data.getShearMix())
     {
         _bones.reserve(_data.getBones().size());
         for (BoneData** i = _data.getBones().begin(); i != _data.getBones().end(); ++i)