mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
[cpp] 4.3 porting WIP
This commit is contained in:
parent
878403d271
commit
2e369a8130
@ -31,95 +31,67 @@
|
||||
#define Spine_SlotData_h
|
||||
|
||||
#include <spine/BlendMode.h>
|
||||
#include <spine/SpineObject.h>
|
||||
#include <spine/PosedData.h>
|
||||
#include <spine/SpineString.h>
|
||||
#include <spine/Color.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class BoneData;
|
||||
class SlotPose;
|
||||
|
||||
/// Stores the setup pose for a Slot.
|
||||
class SP_API SlotData : public PosedData<SlotPose> {
|
||||
RTTI_DECL
|
||||
|
||||
class SP_API SlotData : public SpineObject {
|
||||
friend class SkeletonBinary;
|
||||
|
||||
friend class SkeletonJson;
|
||||
|
||||
friend class AttachmentTimeline;
|
||||
|
||||
friend class RGBATimeline;
|
||||
|
||||
friend class RGBTimeline;
|
||||
|
||||
friend class AlphaTimeline;
|
||||
|
||||
friend class RGBA2Timeline;
|
||||
|
||||
friend class RGB2Timeline;
|
||||
|
||||
friend class DeformTimeline;
|
||||
|
||||
friend class DrawOrderTimeline;
|
||||
|
||||
friend class EventTimeline;
|
||||
|
||||
friend class IkConstraintTimeline;
|
||||
|
||||
friend class PathConstraintMixTimeline;
|
||||
|
||||
friend class PathConstraintPositionTimeline;
|
||||
|
||||
friend class PathConstraintSpacingTimeline;
|
||||
|
||||
friend class ScaleTimeline;
|
||||
|
||||
friend class ShearTimeline;
|
||||
|
||||
friend class TransformConstraintTimeline;
|
||||
|
||||
friend class TranslateTimeline;
|
||||
|
||||
friend class TwoColorTimeline;
|
||||
|
||||
public:
|
||||
SlotData(int index, const String &name, BoneData &boneData);
|
||||
SlotData(int index, const String& name, BoneData& boneData);
|
||||
|
||||
/// The index of the slot in Skeleton::getSlots().
|
||||
int getIndex();
|
||||
|
||||
const String &getName();
|
||||
/// The bone this slot belongs to.
|
||||
BoneData& getBoneData();
|
||||
|
||||
BoneData &getBoneData();
|
||||
void setAttachmentName(const String& attachmentName);
|
||||
|
||||
Color &getColor();
|
||||
|
||||
Color &getDarkColor();
|
||||
|
||||
bool hasDarkColor();
|
||||
|
||||
void setHasDarkColor(bool inValue);
|
||||
|
||||
/// May be empty.
|
||||
const String &getAttachmentName();
|
||||
|
||||
void setAttachmentName(const String &inValue);
|
||||
/// The name of the attachment that is visible for this slot in the setup pose, or empty if no attachment is visible.
|
||||
const String& getAttachmentName();
|
||||
|
||||
/// The blend mode for drawing the slot's attachment.
|
||||
BlendMode getBlendMode();
|
||||
void setBlendMode(BlendMode blendMode);
|
||||
|
||||
void setBlendMode(BlendMode inValue);
|
||||
|
||||
bool isVisible();
|
||||
|
||||
void setVisible(bool inValue);
|
||||
/// False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering.
|
||||
bool isVisible();
|
||||
void setVisible(bool visible);
|
||||
|
||||
private:
|
||||
const int _index;
|
||||
String _name;
|
||||
BoneData &_boneData;
|
||||
Color _color;
|
||||
Color _darkColor;
|
||||
|
||||
bool _hasDarkColor;
|
||||
BoneData& _boneData;
|
||||
String _attachmentName;
|
||||
BlendMode _blendMode;
|
||||
bool _visible;
|
||||
bool _visible;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -28,72 +28,53 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/SlotData.h>
|
||||
#include <spine/SlotPose.h>
|
||||
#include <spine/BoneData.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
SlotData::SlotData(int index, const String &name, BoneData &boneData) : _index(index),
|
||||
_name(name),
|
||||
_boneData(boneData),
|
||||
_color(1, 1, 1, 1),
|
||||
_darkColor(0, 0, 0, 0),
|
||||
_hasDarkColor(false),
|
||||
_attachmentName(),
|
||||
_blendMode(BlendMode_Normal),
|
||||
_visible(true) {
|
||||
assert(_index >= 0);
|
||||
assert(_name.length() > 0);
|
||||
RTTI_IMPL_NOPARENT(SlotData)
|
||||
|
||||
SlotData::SlotData(int index, const String& name, BoneData& boneData) :
|
||||
PosedData<SlotPose>(name, new (__FILE__, __LINE__) SlotPose()),
|
||||
_index(index),
|
||||
_boneData(boneData),
|
||||
_attachmentName(),
|
||||
_blendMode(BlendMode_Normal),
|
||||
_visible(true) {
|
||||
assert(index >= 0);
|
||||
}
|
||||
|
||||
int SlotData::getIndex() {
|
||||
return _index;
|
||||
}
|
||||
|
||||
const String &SlotData::getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
BoneData &SlotData::getBoneData() {
|
||||
BoneData& SlotData::getBoneData() {
|
||||
return _boneData;
|
||||
}
|
||||
|
||||
Color &SlotData::getColor() {
|
||||
return _color;
|
||||
void SlotData::setAttachmentName(const String& attachmentName) {
|
||||
_attachmentName = attachmentName;
|
||||
}
|
||||
|
||||
Color &SlotData::getDarkColor() {
|
||||
return _darkColor;
|
||||
}
|
||||
|
||||
bool SlotData::hasDarkColor() {
|
||||
return _hasDarkColor;
|
||||
}
|
||||
|
||||
void SlotData::setHasDarkColor(bool inValue) {
|
||||
_hasDarkColor = inValue;
|
||||
}
|
||||
|
||||
const String &SlotData::getAttachmentName() {
|
||||
const String& SlotData::getAttachmentName() {
|
||||
return _attachmentName;
|
||||
}
|
||||
|
||||
void SlotData::setAttachmentName(const String &inValue) {
|
||||
_attachmentName = inValue;
|
||||
}
|
||||
|
||||
BlendMode SlotData::getBlendMode() {
|
||||
return _blendMode;
|
||||
}
|
||||
|
||||
void SlotData::setBlendMode(BlendMode inValue) {
|
||||
_blendMode = inValue;
|
||||
void SlotData::setBlendMode(BlendMode blendMode) {
|
||||
_blendMode = blendMode;
|
||||
}
|
||||
|
||||
bool SlotData::isVisible() {
|
||||
return _visible;
|
||||
}
|
||||
|
||||
void SlotData::setVisible(bool inValue) {
|
||||
this->_visible = inValue;
|
||||
}
|
||||
void SlotData::setVisible(bool visible) {
|
||||
_visible = visible;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user