mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 17:36:05 -05:00
New image arguments format (#983)
This commit is contained in:
parent
9009b3db6a
commit
0a3de6cd4e
1 changed files with 21 additions and 3 deletions
|
@ -338,16 +338,25 @@ struct MDParser {
|
|||
else if (s_lastImage.size()) {
|
||||
bool isFrame = false;
|
||||
|
||||
std::vector<std::string> imgArguments = utils::string::split(s_lastImage, "&");
|
||||
std::vector<std::string> imgArguments = utils::string::split(s_lastImage, "?");
|
||||
s_lastImage = imgArguments.at(0);
|
||||
if (utils::string::contains(s_lastImage, "&")) { //old format
|
||||
imgArguments = utils::string::split(s_lastImage, "&");
|
||||
s_lastImage = imgArguments.at(0);
|
||||
}
|
||||
|
||||
imgArguments.erase(imgArguments.begin()); //remove the image path
|
||||
|
||||
// Split by "&" to get arguments
|
||||
if (imgArguments.size() > 0) {
|
||||
imgArguments = utils::string::split(imgArguments.at(0), "&");
|
||||
}
|
||||
|
||||
float spriteScale = 1.0f;
|
||||
|
||||
for(std::string arg : imgArguments){
|
||||
if(utils::string::startsWith(arg, "scale:")){
|
||||
std::string scaleValue = arg.substr(arg.find(":") + 1);
|
||||
if(utils::string::startsWith(arg, "scale=")){
|
||||
std::string scaleValue = arg.substr(arg.find("=") + 1);
|
||||
std::stringstream s(scaleValue);
|
||||
|
||||
float scale;
|
||||
|
@ -355,6 +364,15 @@ struct MDParser {
|
|||
spriteScale = scale;
|
||||
}
|
||||
}
|
||||
else if(utils::string::startsWith(arg, "scale:")){ //old format
|
||||
std::string scaleValue = arg.substr(arg.find(":") + 1);
|
||||
std::stringstream s(scaleValue);
|
||||
|
||||
float scale;
|
||||
if (s >> scale) {
|
||||
spriteScale = scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (utils::string::startsWith(s_lastImage, "frame:")) {
|
||||
|
|
Loading…
Reference in a new issue