[cpp] Remove spine:: namespace prefix everywhere.

This commit is contained in:
Mario Zechner 2025-07-08 21:09:34 +02:00
parent 9d384c50ed
commit 10ad175c8a
19 changed files with 71 additions and 249 deletions

View File

@ -101,7 +101,7 @@ static void initExtensions() {
}
}
spine::SpineExtension *spine::getDefaultExtension() {
SpineExtension *getDefaultExtension() {
initExtensions();
return defaultExtension;
}
@ -1228,7 +1228,7 @@ void spine_skeleton_update_cache(spine_skeleton skeleton) {
void spine_skeleton_update_world_transform(spine_skeleton skeleton, spine_physics physics) {
if (skeleton == nullptr) return;
Skeleton *_skeleton = (Skeleton *) skeleton;
_skeleton->updateWorldTransform((spine::Physics) physics);
_skeleton->updateWorldTransform((Physics) physics);
}
void spine_skeleton_update_world_transform_bone(spine_skeleton skeleton, spine_physics physics, spine_bone parent) {
@ -1236,7 +1236,7 @@ void spine_skeleton_update_world_transform_bone(spine_skeleton skeleton, spine_p
if (parent == nullptr) return;
Skeleton *_skeleton = (Skeleton *) skeleton;
Bone *_bone = (Bone *) parent;
_skeleton->updateWorldTransform((spine::Physics) physics, _bone);
_skeleton->updateWorldTransform((Physics) physics, _bone);
}
void spine_skeleton_set_to_setup_pose(spine_skeleton skeleton) {

View File

@ -593,7 +593,7 @@ namespace spine {
void computeHold(TrackEntry *entry);
void setAttachment(Skeleton &skeleton, spine::Slot &slot, const String &attachmentName, bool attachments);
void setAttachment(Skeleton &skeleton, Slot &slot, const String &attachmentName, bool attachments);
};
}

View File

@ -86,7 +86,7 @@ namespace spine {
_capacity = (int) (_size * 1.75f);
}
if (_capacity < 8) _capacity = 8;
_buffer = spine::SpineExtension::realloc<T>(_buffer, _capacity, __FILE__, __LINE__);
_buffer = SpineExtension::realloc<T>(_buffer, _capacity, __FILE__, __LINE__);
}
if (oldSize < _size) {
for (size_t i = oldSize; i < _size; i++) {
@ -115,7 +115,7 @@ namespace spine {
T valueCopy = inValue;
_capacity = (int) (_size * 1.75f);
if (_capacity < 8) _capacity = 8;
_buffer = spine::SpineExtension::realloc<T>(_buffer, _capacity, __FILE__, __LINE__);
_buffer = SpineExtension::realloc<T>(_buffer, _capacity, __FILE__, __LINE__);
construct(_buffer + _size++, valueCopy);
} else {
construct(_buffer + _size++, inValue);

View File

@ -1,57 +0,0 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifndef SPINE_DEBUG_LOG_H
#define SPINE_DEBUG_LOG_H
#include <spine/spine.h>
namespace spine {
SP_API void spDebug_printSkeletonData(SkeletonData *skeletonData);
SP_API void spDebug_printAnimation(Animation *animation);
SP_API void spDebug_printTimeline(Timeline *timeline);
SP_API void spDebug_printBoneDatas(Array<BoneData *> &boneDatas);
SP_API void spDebug_printBoneData(BoneData *boneData);
SP_API void spDebug_printSkeleton(Skeleton *skeleton);
SP_API void spDebug_printBones(Array<Bone *> &bones);
SP_API void spDebug_printBone(Bone *bone);
SP_API void spDebug_printFloats(float *values, int numFloats);
SP_API void spDebug_printFloats(Array<float> &values);
}
#endif

View File

@ -63,11 +63,11 @@ namespace spine {
friend class Slot;
public:
PosedData(const spine::String& name);
PosedData(const String& name);
virtual ~PosedData();
/// The constraint's name, which is unique across all constraints in the skeleton of the same type.
const spine::String& getName() const { return _name; };
const String& getName() const { return _name; };
/// When true, Skeleton::updateWorldTransform(Physics) only updates this constraint if the Skeleton::getSkin()
/// contains this constraint.
@ -77,11 +77,11 @@ namespace spine {
void setSkinRequired(bool skinRequired) { _skinRequired = skinRequired; };
protected:
spine::String _name;
String _name;
bool _skinRequired;
};
inline PosedData::PosedData(const spine::String& name) : _name(name), _skinRequired(false) {
inline PosedData::PosedData(const String& name) : _name(name), _skinRequired(false) {
}
inline PosedData::~PosedData() {
@ -124,7 +124,7 @@ namespace spine {
P _setup;
public:
PosedDataGeneric(const spine::String& name): PosedData(name), _setup() {
PosedDataGeneric(const String& name): PosedData(name), _setup() {
}
virtual ~PosedDataGeneric() {};

View File

@ -66,24 +66,24 @@ namespace spine {
#define RTTI_DECL_NOPARENT \
public: \
static const spine::RTTI rtti; \
virtual const spine::RTTI& getRTTI() const;
static const RTTI rtti; \
virtual const RTTI& getRTTI() const;
#define RTTI_DECL \
public: \
static const spine::RTTI rtti; \
virtual const spine::RTTI& getRTTI() const override;
static const RTTI rtti; \
virtual const RTTI& getRTTI() const override;
#define RTTI_IMPL_NOPARENT(name) \
const spine::RTTI name::rtti(#name); \
const spine::RTTI& name::getRTTI() const { return rtti; }
const RTTI name::rtti(#name); \
const RTTI& name::getRTTI() const { return rtti; }
#define RTTI_IMPL(name, parent) \
const spine::RTTI name::rtti(#name, parent::rtti); \
const spine::RTTI& name::getRTTI() const { return rtti; }
const RTTI name::rtti(#name, parent::rtti); \
const RTTI& name::getRTTI() const { return rtti; }
#define RTTI_IMPL_MULTI(name, parent, ...) \
const spine::RTTI name::rtti(#name, parent::rtti, &__VA_ARGS__::rtti); \
const spine::RTTI& name::getRTTI() const { return rtti; }
const RTTI name::rtti(#name, parent::rtti, &__VA_ARGS__::rtti); \
const RTTI& name::getRTTI() const { return rtti; }
#endif /* Spine_RTTI_h */

View File

@ -47,7 +47,7 @@ namespace spine {
RTTI_DECL
public:
explicit SequenceTimeline(size_t frameCount, int slotIndex, spine::Attachment *attachment);
explicit SequenceTimeline(size_t frameCount, int slotIndex, Attachment *attachment);
virtual ~SequenceTimeline();

View File

@ -83,7 +83,7 @@ namespace spine {
Skin *findSkin(const String &skinName);
/// @return May be NULL.
spine::EventData *findEvent(const String &eventDataName);
EventData *findEvent(const String &eventDataName);
/// @return May be NULL.
Animation *findAnimation(const String &animationName);
@ -123,7 +123,7 @@ namespace spine {
void setDefaultSkin(Skin *inValue);
/// The skeleton's events.
Array<spine::EventData *> &getEvents();
Array<EventData *> &getEvents();
/// The skeleton's animations.
Array<Animation *> &getAnimations();

View File

@ -46,7 +46,7 @@
using namespace spine;
void dummyOnAnimationEventFunc(AnimationState *state, spine::EventType type, TrackEntry *entry, Event *event = NULL) {
void dummyOnAnimationEventFunc(AnimationState *state, EventType type, TrackEntry *entry, Event *event = NULL) {
SP_UNUSED(state);
SP_UNUSED(type);
SP_UNUSED(entry);

View File

@ -31,7 +31,9 @@
#include <spine/EventData.h>
spine::Event::Event(float time, const spine::EventData &data) : _data(data),
using namespace spine;
Event::Event(float time, const EventData &data) : _data(data),
_time(time),
_intValue(data.getIntValue()),
_floatValue(data.getFloatValue()),
@ -40,51 +42,51 @@ spine::Event::Event(float time, const spine::EventData &data) : _data(data),
_balance(data.getBalance()) {
}
const spine::EventData &spine::Event::getData() {
const EventData &Event::getData() {
return _data;
}
float spine::Event::getTime() {
float Event::getTime() {
return _time;
}
int spine::Event::getInt() {
int Event::getInt() {
return _intValue;
}
void spine::Event::setInt(int inValue) {
void Event::setInt(int inValue) {
_intValue = inValue;
}
float spine::Event::getFloat() {
float Event::getFloat() {
return _floatValue;
}
void spine::Event::setFloat(float inValue) {
void Event::setFloat(float inValue) {
_floatValue = inValue;
}
const spine::String &spine::Event::getString() {
const String &Event::getString() {
return _stringValue;
}
void spine::Event::setString(const spine::String &inValue) {
void Event::setString(const String &inValue) {
_stringValue = inValue;
}
float spine::Event::getVolume() {
float Event::getVolume() {
return _volume;
}
void spine::Event::setVolume(float inValue) {
void Event::setVolume(float inValue) {
_volume = inValue;
}
float spine::Event::getBalance() {
float Event::getBalance() {
return _balance;
}
void spine::Event::setBalance(float inValue) {
void Event::setBalance(float inValue) {
_balance = inValue;
}

View File

@ -31,7 +31,9 @@
#include <assert.h>
spine::EventData::EventData(const spine::String &name) : _name(name),
using namespace spine;
EventData::EventData(const String &name) : _name(name),
_intValue(0),
_floatValue(0),
_stringValue(),
@ -42,55 +44,55 @@ spine::EventData::EventData(const spine::String &name) : _name(name),
}
/// The name of the event, which is unique within the skeleton.
const spine::String &spine::EventData::getName() const {
const String &EventData::getName() const {
return _name;
}
int spine::EventData::getIntValue() const {
int EventData::getIntValue() const {
return _intValue;
}
void spine::EventData::setIntValue(int inValue) {
void EventData::setIntValue(int inValue) {
_intValue = inValue;
}
float spine::EventData::getFloatValue() const {
float EventData::getFloatValue() const {
return _floatValue;
}
void spine::EventData::setFloatValue(float inValue) {
void EventData::setFloatValue(float inValue) {
_floatValue = inValue;
}
const spine::String &spine::EventData::getStringValue() const {
const String &EventData::getStringValue() const {
return _stringValue;
}
void spine::EventData::setStringValue(const spine::String &inValue) {
void EventData::setStringValue(const String &inValue) {
this->_stringValue = inValue;
}
const spine::String &spine::EventData::getAudioPath() const {
const String &EventData::getAudioPath() const {
return _audioPath;
}
void spine::EventData::setAudioPath(const spine::String &inValue) {
void EventData::setAudioPath(const String &inValue) {
_audioPath = inValue;
}
float spine::EventData::getVolume() const {
float EventData::getVolume() const {
return _volume;
}
void spine::EventData::setVolume(float inValue) {
void EventData::setVolume(float inValue) {
_volume = inValue;
}
float spine::EventData::getBalance() const {
float EventData::getBalance() const {
return _balance;
}
void spine::EventData::setBalance(float inValue) {
void EventData::setBalance(float inValue) {
_balance = inValue;
}

View File

@ -43,7 +43,7 @@ void SpineExtension::setInstance(SpineExtension *inValue) {
}
SpineExtension *SpineExtension::getInstance() {
if (!_instance) _instance = spine::getDefaultExtension();
if (!_instance) _instance = getDefaultExtension();
assert(_instance);
return _instance;

View File

@ -90,7 +90,7 @@ int Json::getInt(Json *value, const char *name, int defaultValue) {
return value ? value->_valueInt : defaultValue;
}
bool Json::getBoolean(spine::Json *value, const char *name, bool defaultValue) {
bool Json::getBoolean(Json *value, const char *name, bool defaultValue) {
value = getItem(value, name);
if (value) {
if (value->_valueString) return strcmp(value->_valueString, "true") == 0;
@ -127,8 +127,8 @@ Json::Json(const char *value) : _next(NULL),
}
Json::~Json() {
spine::Json *curr = NULL;
spine::Json *next = _child;
Json *curr = NULL;
Json *next = _child;
do {
curr = next;
if (curr) {

View File

@ -1,125 +0,0 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include <spine/Log.h>
#include <stdio.h>
using namespace spine;
void spine::spDebug_printSkeletonData(SkeletonData *skeletonData) {
int i, n;
spDebug_printBoneDatas(skeletonData->getBones());
for (i = 0, n = (int) skeletonData->getAnimations().size(); i < n; i++) {
spDebug_printAnimation(skeletonData->getAnimations()[i]);
}
}
void _spDebug_printTimelineBase(Timeline *timeline) {
printf(" Timeline %s:\n", timeline->getRTTI().getClassName());
printf(" frame count: %zu\n", timeline->getFrameCount());
printf(" frame entries: %zu\n", timeline->getFrameEntries());
printf(" frames: ");
spDebug_printFloats(timeline->getFrames());
printf("\n");
}
void _spDebug_printCurveTimeline(CurveTimeline *timeline) {
_spDebug_printTimelineBase(timeline);
printf(" curves: ");
spDebug_printFloats(timeline->getCurves());
printf("\n");
}
void spine::spDebug_printTimeline(Timeline *timeline) {
if (timeline->getRTTI().instanceOf(CurveTimeline::rtti))
_spDebug_printCurveTimeline(static_cast<CurveTimeline *>(timeline));
else
_spDebug_printTimelineBase(timeline);
}
void spine::spDebug_printAnimation(Animation *animation) {
int i, n;
printf("Animation %s: %zu timelines\n", animation->getName().buffer(), animation->getTimelines().size());
for (i = 0, n = (int) animation->getTimelines().size(); i < n; i++) {
Timeline *timeline = animation->getTimelines()[i];
spDebug_printTimeline(timeline);
}
}
void spine::spDebug_printBoneDatas(Array<BoneData *> &boneDatas) {
int i, n;
for (i = 0, n = (int) boneDatas.size(); i < n; i++) {
spDebug_printBoneData(boneDatas[i]);
}
}
void spine::spDebug_printBoneData(BoneData *boneData) {
BoneLocal &setupPose = boneData->getSetupPose();
printf("Bone data %s: %f, %f, %f, %f, %f, %f %f\n", boneData->getName().buffer(), setupPose.getRotation(),
setupPose.getScaleX(), setupPose.getScaleY(), setupPose.getX(), setupPose.getY(), setupPose.getShearX(),
setupPose.getShearY());
}
void spine::spDebug_printSkeleton(Skeleton *skeleton) {
spDebug_printBones(skeleton->getBones());
}
void spine::spDebug_printBones(Array<Bone *> &bones) {
int i, n;
for (i = 0, n = (int) bones.size(); i < n; i++) {
spDebug_printBone(bones[i]);
}
}
void spine::spDebug_printBone(Bone *bone) {
BonePose &pose = bone->getAppliedPose();
printf("Bone %s: %f, %f, %f, %f, %f, %f, %f\n", bone->getData().getName().buffer(), pose.getRotation(), pose.getScaleX(),
pose.getScaleY(), pose.getX(), pose.getY(), pose.getShearX(), pose.getShearY());
}
void spine::spDebug_printFloats(float *values, int numFloats) {
int i;
printf("(%i) [", numFloats);
for (i = 0; i < numFloats; i++) {
printf("%f, ", values[i]);
}
printf("]");
}
void spine::spDebug_printFloats(Array<float> &values) {
int i, n;
printf("(%zu) [", values.size());
for (i = 0, n = (int) values.size(); i < n; i++) {
printf("%f, ", values[i]);
}
printf("]");
}

View File

@ -210,7 +210,7 @@ void MeshAttachment::setHeight(float inValue) {
_height = inValue;
}
spine::Color &MeshAttachment::getColor() {
Color &MeshAttachment::getColor() {
return _color;
}

View File

@ -252,7 +252,7 @@ Array<float> &RegionAttachment::getUVs() {
return _uvs;
}
spine::Color &RegionAttachment::getColor() {
Color &RegionAttachment::getColor() {
return _color;
}

View File

@ -1309,7 +1309,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
float time = input.readFloat();
int modeAndIndex = input.readInt();
float delay = input.readFloat();
timeline->setFrame(frame, time, (spine::SequenceMode)(modeAndIndex & 0xf), modeAndIndex >> 4, delay);
timeline->setFrame(frame, time, (SequenceMode)(modeAndIndex & 0xf), modeAndIndex >> 4, delay);
}
timelines.add(timeline);
break;

View File

@ -68,7 +68,7 @@ void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) {
BoundingBoxAttachment *boundingBox = static_cast<BoundingBoxAttachment *>(attachment);
_boundingBoxes.add(boundingBox);
spine::Polygon *polygonP = _polygonPool.obtain();
Polygon *polygonP = _polygonPool.obtain();
_polygons.add(polygonP);
Polygon &polygon = *polygonP;
@ -122,7 +122,7 @@ bool SkeletonBounds::aabbIntersectsSkeleton(SkeletonBounds &bounds) {
return _minX < bounds._maxX && _maxX > bounds._minX && _minY < bounds._maxY && _maxY > bounds._minY;
}
bool SkeletonBounds::containsPoint(spine::Polygon *polygon, float x, float y) {
bool SkeletonBounds::containsPoint(Polygon *polygon, float x, float y) {
Array<float> &vertices = polygon->_vertices;
int nn = polygon->_count;
@ -154,7 +154,7 @@ BoundingBoxAttachment *SkeletonBounds::intersectsSegment(float x1, float y1, flo
return NULL;
}
bool SkeletonBounds::intersectsSegment(spine::Polygon *polygon, float x1, float y1, float x2, float y2) {
bool SkeletonBounds::intersectsSegment(Polygon *polygon, float x1, float y1, float x2, float y2) {
Array<float> &vertices = polygon->_vertices;
size_t nn = polygon->_count;
@ -180,7 +180,7 @@ bool SkeletonBounds::intersectsSegment(spine::Polygon *polygon, float x1, float
return false;
}
spine::Polygon *SkeletonBounds::getPolygon(BoundingBoxAttachment *attachment) {
Polygon *SkeletonBounds::getPolygon(BoundingBoxAttachment *attachment) {
int index = _boundingBoxes.indexOf(attachment);
return index == -1 ? NULL : _polygons[index];
}
@ -190,7 +190,7 @@ BoundingBoxAttachment *SkeletonBounds::getBoundingBox(Polygon *polygon) {
return index == -1 ? NULL : _boundingBoxes[index];
}
Array<spine::Polygon *> &SkeletonBounds::getPolygons() {
Array<Polygon *> &SkeletonBounds::getPolygons() {
return _polygons;
}
@ -229,7 +229,7 @@ void SkeletonBounds::aabbCompute() {
float maxY = FLT_MIN;
for (size_t i = 0, n = _polygons.size(); i < n; ++i) {
spine::Polygon *polygon = _polygons[i];
Polygon *polygon = _polygons[i];
Array<float> &vertices = polygon->_vertices;
for (int ii = 0, nn = polygon->_count; ii < nn; ii += 2) {
float x = vertices[ii];

View File

@ -90,7 +90,7 @@ Skin *SkeletonData::findSkin(const String &skinName) {
return ArrayUtils::findWithName(_skins, skinName);
}
spine::EventData *SkeletonData::findEvent(const String &eventDataName) {
EventData *SkeletonData::findEvent(const String &eventDataName) {
return ArrayUtils::findWithName(_events, eventDataName);
}
@ -142,7 +142,7 @@ void SkeletonData::setDefaultSkin(Skin *inValue) {
_defaultSkin = inValue;
}
Array<spine::EventData *> &SkeletonData::getEvents() {
Array<EventData *> &SkeletonData::getEvents() {
return _events;
}