mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Error for misspelled / invalid window attributes in love.window.setMode (resolves issue #736)
This commit is contained in:
@@ -37,12 +37,28 @@ namespace window
|
||||
|
||||
// Forward-declared so it can be used in the class methods. We can't define the
|
||||
// whole thing here because it uses the Window::Type enum.
|
||||
struct WindowFlags;
|
||||
struct WindowAttributes;
|
||||
|
||||
class Window : public Module
|
||||
{
|
||||
public:
|
||||
|
||||
// Types of window attributes.
|
||||
enum Attribute
|
||||
{
|
||||
ATTRIB_FULLSCREEN,
|
||||
ATTRIB_FULLSCREEN_TYPE,
|
||||
ATTRIB_VSYNC,
|
||||
ATTRIB_FSAA,
|
||||
ATTRIB_RESIZABLE,
|
||||
ATTRIB_MIN_WIDTH,
|
||||
ATTRIB_MIN_HEIGHT,
|
||||
ATTRIB_BORDERLESS,
|
||||
ATTRIB_CENTERED,
|
||||
ATTRIB_DISPLAY,
|
||||
ATTRIB_MAX_ENUM
|
||||
};
|
||||
|
||||
enum FullscreenType
|
||||
{
|
||||
FULLSCREEN_TYPE_NORMAL,
|
||||
@@ -58,8 +74,8 @@ public:
|
||||
|
||||
virtual ~Window();
|
||||
|
||||
virtual bool setWindow(int width = 800, int height = 600, WindowFlags *flags = 0) = 0;
|
||||
virtual void getWindow(int &width, int &height, WindowFlags &flags) = 0;
|
||||
virtual bool setWindow(int width = 800, int height = 600, WindowAttributes *attribs = 0) = 0;
|
||||
virtual void getWindow(int &width, int &height, WindowAttributes &attribs) = 0;
|
||||
|
||||
virtual bool setFullscreen(bool fullscreen, FullscreenType fstype) = 0;
|
||||
virtual bool setFullscreen(bool fullscreen) = 0;
|
||||
@@ -103,6 +119,9 @@ public:
|
||||
//virtual static Window *getSingleton() = 0;
|
||||
// No virtual statics, of course, but you are supposed to implement these statics.
|
||||
|
||||
static bool getConstant(const char *in, Attribute &out);
|
||||
static bool getConstant(Attribute in, const char *&out);
|
||||
|
||||
static bool getConstant(const char *in, FullscreenType &out);
|
||||
static bool getConstant(FullscreenType in, const char *&out);
|
||||
|
||||
@@ -112,14 +131,17 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
static StringMap<Attribute, ATTRIB_MAX_ENUM>::Entry attributeEntries[];
|
||||
static StringMap<Attribute, ATTRIB_MAX_ENUM> attributes;
|
||||
|
||||
static StringMap<FullscreenType, FULLSCREEN_TYPE_MAX_ENUM>::Entry fullscreenTypeEntries[];
|
||||
static StringMap<FullscreenType, FULLSCREEN_TYPE_MAX_ENUM> fullscreenTypes;
|
||||
|
||||
}; // Window
|
||||
|
||||
struct WindowFlags
|
||||
struct WindowAttributes
|
||||
{
|
||||
WindowFlags();
|
||||
WindowAttributes();
|
||||
bool fullscreen; // = false
|
||||
Window::FullscreenType fstype; // = FULLSCREEN_TYPE_NORMAL
|
||||
bool vsync; // = true
|
||||
|
||||
Reference in New Issue
Block a user