Error for misspelled / invalid window attributes in love.window.setMode (resolves issue #736)

This commit is contained in:
Alex Szpakowski
2013-10-20 13:17:57 -03:00
parent 249dad3cae
commit d9da19d665
8 changed files with 155 additions and 90 deletions
+27 -1
View File
@@ -38,7 +38,7 @@ void Window::swapBuffers()
{
}
WindowFlags::WindowFlags()
WindowAttributes::WindowAttributes()
: fullscreen(false)
, fstype(Window::FULLSCREEN_TYPE_NORMAL)
, vsync(true)
@@ -62,6 +62,32 @@ bool Window::getConstant(Window::FullscreenType in, const char *&out)
return fullscreenTypes.find(in, out);
}
bool Window::getConstant(const char *in, Window::Attribute &out)
{
return attributes.find(in, out);
}
bool Window::getConstant(Window::Attribute in, const char *&out)
{
return attributes.find(in, out);
}
StringMap<Window::Attribute, Window::ATTRIB_MAX_ENUM>::Entry Window::attributeEntries[] =
{
{"fullscreen", ATTRIB_FULLSCREEN},
{"fullscreentype", ATTRIB_FULLSCREEN_TYPE},
{"vsync", ATTRIB_VSYNC},
{"fsaa", ATTRIB_FSAA},
{"resizable", ATTRIB_RESIZABLE},
{"minwidth", ATTRIB_MIN_WIDTH},
{"minheight", ATTRIB_MIN_HEIGHT},
{"borderless", ATTRIB_BORDERLESS},
{"centered", ATTRIB_CENTERED},
{"display", ATTRIB_DISPLAY}
};
StringMap<Window::Attribute, Window::ATTRIB_MAX_ENUM> Window::attributes(Window::attributeEntries, sizeof(Window::attributeEntries));
StringMap<Window::FullscreenType, Window::FULLSCREEN_TYPE_MAX_ENUM>::Entry Window::fullscreenTypeEntries[] =
{
{"normal", Window::FULLSCREEN_TYPE_NORMAL},