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:
Alex Szpakowski
2017-12-28 23:16:51 -04:00
parent 1f52abf619
commit dd59803ad3
9 changed files with 143 additions and 31 deletions
+16
View File
@@ -46,6 +46,14 @@ public:
MIPMAPS_GENERATED,
};
enum SettingType
{
SETTING_MIPMAPS,
SETTING_LINEAR,
SETTING_DPI_SCALE,
SETTING_MAX_ENUM
};
struct Settings
{
bool mipmaps = false;
@@ -94,6 +102,11 @@ public:
static int imageCount;
static bool getConstant(const char *in, SettingType &out);
static bool getConstant(SettingType in, const char *&out);
static const char *getConstant(SettingType in);
static std::vector<std::string> getConstants(SettingType);
protected:
Image(const Slices &data, const Settings &settings);
@@ -122,6 +135,9 @@ private:
void init(PixelFormat fmt, int w, int h, const Settings &settings);
static StringMap<SettingType, SETTING_MAX_ENUM>::Entry settingTypeEntries[];
static StringMap<SettingType, SETTING_MAX_ENUM> settingTypes;
}; // Image
} // graphics