mirror of
https://github.com/sam-astro/Z-Sharp.git
synced 2026-02-04 07:02:11 +00:00
Allow sprite scaling
This commit is contained in:
parent
3c684f2153
commit
b8320da1aa
@ -448,6 +448,7 @@ boost::any ProcessLine(const vector<vector<string>>& words, int& lineNum, unorde
|
|||||||
// re-inits a variable then store it with it's value
|
// re-inits a variable then store it with it's value
|
||||||
else if (countInVector(types, trim(words.at(lineNum).at(0))) > 0)
|
else if (countInVector(types, trim(words.at(lineNum).at(0))) > 0)
|
||||||
{
|
{
|
||||||
|
//cout << words.at(lineNum).at(1) << "=" << unWrapVec(slice(words.at(lineNum), 3, -1)) << "=" << AnyAsString(EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), variableValues)) << endl;
|
||||||
variableValues[words.at(lineNum).at(1)] = EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), variableValues);
|
variableValues[words.at(lineNum).at(1)] = EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), variableValues);
|
||||||
return nullType;
|
return nullType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -392,10 +392,10 @@ public:
|
|||||||
{
|
{
|
||||||
SDL_RenderCopy(gRenderer, texture, NULL, &rect);
|
SDL_RenderCopy(gRenderer, texture, NULL, &rect);
|
||||||
// Centers
|
// Centers
|
||||||
rect.x = position.x - (rect.w / 2);
|
|
||||||
rect.y = position.y - (rect.h / 2);
|
|
||||||
rect.w = scale.x;
|
rect.w = scale.x;
|
||||||
rect.h = scale.y;
|
rect.h = scale.y;
|
||||||
|
rect.x = position.x - (rect.w / 2);
|
||||||
|
rect.y = position.y - (rect.h / 2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,6 +504,8 @@ public:
|
|||||||
scale.y /= AnyAsFloat(otherVal);
|
scale.y /= AnyAsFloat(otherVal);
|
||||||
}
|
}
|
||||||
// Centers
|
// Centers
|
||||||
|
rect.w = scale.x;
|
||||||
|
rect.h = scale.y;
|
||||||
rect.x = position.x - (rect.w / 2);
|
rect.x = position.x - (rect.w / 2);
|
||||||
rect.y = position.y - (rect.h / 2);
|
rect.y = position.y - (rect.h / 2);
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@ -161,13 +161,13 @@ vector<string> splitNoOverlap(const string& str, const char& splitBy, const char
|
|||||||
{
|
{
|
||||||
if (i == (int)str.size() - 1)
|
if (i == (int)str.size() - 1)
|
||||||
{
|
{
|
||||||
newStr.push_back(tmpStr+ str[i]);
|
newStr.push_back(trim(tmpStr + str[i]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str[i] == splitBy && openCount == 0)
|
if (str[i] == splitBy && openCount == 0)
|
||||||
{
|
{
|
||||||
newStr.push_back(tmpStr);
|
newStr.push_back(trim(tmpStr));
|
||||||
tmpStr = "";
|
tmpStr = "";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user