mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Error when invalid setting names are used in the tables passed to love.graphics.newCanvas and newImage. See issue #1312.
This commit is contained in:
@@ -340,5 +340,36 @@ Image::MipmapsType Image::Slices::validate() const
|
||||
return MIPMAPS_NONE;
|
||||
}
|
||||
|
||||
bool Image::getConstant(const char *in, SettingType &out)
|
||||
{
|
||||
return settingTypes.find(in, out);
|
||||
}
|
||||
|
||||
bool Image::getConstant(SettingType in, const char *&out)
|
||||
{
|
||||
return settingTypes.find(in, out);
|
||||
}
|
||||
|
||||
const char *Image::getConstant(SettingType in)
|
||||
{
|
||||
const char *name = nullptr;
|
||||
getConstant(in, name);
|
||||
return name;
|
||||
}
|
||||
|
||||
std::vector<std::string> Image::getConstants(SettingType)
|
||||
{
|
||||
return settingTypes.getNames();
|
||||
}
|
||||
|
||||
StringMap<Image::SettingType, Image::SETTING_MAX_ENUM>::Entry Image::settingTypeEntries[] =
|
||||
{
|
||||
{ "mipmaps", SETTING_MIPMAPS },
|
||||
{ "linear", SETTING_LINEAR },
|
||||
{ "dpiscale", SETTING_DPI_SCALE },
|
||||
};
|
||||
|
||||
StringMap<Image::SettingType, Image::SETTING_MAX_ENUM> Image::settingTypes(Image::settingTypeEntries, sizeof(Image::settingTypeEntries));
|
||||
|
||||
} // graphics
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user