mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Merge pull request #9 from victorsavu3/master
Allow animations to be transformed and various memory problems
This commit is contained in:
commit
179e47f41d
@ -8,6 +8,10 @@ namespace spine {
|
|||||||
|
|
||||||
class AtlasPage: public BaseAtlasPage {
|
class AtlasPage: public BaseAtlasPage {
|
||||||
public:
|
public:
|
||||||
|
~AtlasPage(){
|
||||||
|
delete texture;
|
||||||
|
}
|
||||||
|
|
||||||
sf::Texture *texture;
|
sf::Texture *texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,8 @@ void Skeleton::draw (RenderTarget& target, RenderStates states) const {
|
|||||||
const_cast<Skeleton*>(this)->vertexArray.clear();
|
const_cast<Skeleton*>(this)->vertexArray.clear();
|
||||||
for (int i = 0, n = slots.size(); i < n; i++)
|
for (int i = 0, n = slots.size(); i < n; i++)
|
||||||
if (slots[i]->attachment) slots[i]->attachment->draw(slots[i]);
|
if (slots[i]->attachment) slots[i]->attachment->draw(slots[i]);
|
||||||
target.draw(vertexArray, texture);
|
states.texture = texture;
|
||||||
|
target.draw(vertexArray, states);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace spine */
|
} /* namespace spine */
|
||||||
|
|||||||
@ -105,7 +105,7 @@ void BaseAtlas::load (const char *current, const char *end) {
|
|||||||
|
|
||||||
string value;
|
string value;
|
||||||
string tuple[4];
|
string tuple[4];
|
||||||
BaseAtlasPage *page;
|
BaseAtlasPage *page = NULL;
|
||||||
while (current != end) {
|
while (current != end) {
|
||||||
readLine(current, end, value);
|
readLine(current, end, value);
|
||||||
trim(value);
|
trim(value);
|
||||||
|
|||||||
@ -21,8 +21,9 @@ namespace spine {
|
|||||||
static float toColor (const string &value, int index) {
|
static float toColor (const string &value, int index) {
|
||||||
if (value.size() != 8) throw runtime_error("Error parsing color, length must be 8: " + value);
|
if (value.size() != 8) throw runtime_error("Error parsing color, length must be 8: " + value);
|
||||||
char *p;
|
char *p;
|
||||||
int color = strtoul(value.substr(index * 2, 2).c_str(), &p, 16);
|
string tmp = value.substr(index * 2, 2);
|
||||||
if (*p != 0) throw runtime_error("Error parsing color: " + value + ", invalid hex value: " + value.substr(index * 2, 2));
|
int color = strtoul(tmp.c_str(), &p, 16);
|
||||||
|
if (*p != 0) throw runtime_error("Error parsing color: " + value + ", invalid hex value: " + tmp);
|
||||||
return color / (float)255;
|
return color / (float)255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user