mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
OpenGL 2.1 is now required to use love.graphics (resolves issue #779.)
Removed love.graphics.isSupported("canvas", "shader", "npot", "subtractive", and "mipmap"), since those features are all guaranteed by the minimum system requirements.
--HG--
branch : minor
This commit is contained in:
@@ -74,6 +74,16 @@ bool Window::getConstant(Window::Setting in, const char *&out)
|
||||
return settings.find(in, out);
|
||||
}
|
||||
|
||||
bool Window::getConstant(const char *in, MessageBoxType &out)
|
||||
{
|
||||
return messageBoxTypes.find(in, out);
|
||||
}
|
||||
|
||||
bool Window::getConstant(MessageBoxType in, const char *&out)
|
||||
{
|
||||
return messageBoxTypes.find(in, out);
|
||||
}
|
||||
|
||||
StringMap<Window::Setting, Window::SETTING_MAX_ENUM>::Entry Window::settingEntries[] =
|
||||
{
|
||||
{"fullscreen", SETTING_FULLSCREEN},
|
||||
@@ -100,5 +110,14 @@ StringMap<Window::FullscreenType, Window::FULLSCREEN_TYPE_MAX_ENUM>::Entry Windo
|
||||
|
||||
StringMap<Window::FullscreenType, Window::FULLSCREEN_TYPE_MAX_ENUM> Window::fullscreenTypes(Window::fullscreenTypeEntries, sizeof(Window::fullscreenTypeEntries));
|
||||
|
||||
StringMap<MessageBoxType, MESSAGEBOX_MAX_ENUM>::Entry Window::messageBoxTypeEntries[] =
|
||||
{
|
||||
{"error", MESSAGEBOX_ERROR},
|
||||
{"warning", MESSAGEBOX_WARNING},
|
||||
{"info", MESSAGEBOX_INFO},
|
||||
};
|
||||
|
||||
StringMap<MessageBoxType, MESSAGEBOX_MAX_ENUM> Window::messageBoxTypes(Window::messageBoxTypeEntries, sizeof(Window::messageBoxTypeEntries));
|
||||
|
||||
} // window
|
||||
} // love
|
||||
|
||||
@@ -39,6 +39,14 @@ namespace window
|
||||
// whole thing here because it uses the Window::Type enum.
|
||||
struct WindowSettings;
|
||||
|
||||
enum MessageBoxType
|
||||
{
|
||||
MESSAGEBOX_ERROR,
|
||||
MESSAGEBOX_WARNING,
|
||||
MESSAGEBOX_INFO,
|
||||
MESSAGEBOX_MAX_ENUM
|
||||
};
|
||||
|
||||
class Window : public Module
|
||||
{
|
||||
public:
|
||||
@@ -119,6 +127,8 @@ public:
|
||||
|
||||
virtual const void *getHandle() const = 0;
|
||||
|
||||
virtual void showMessageBox(MessageBoxType type, const char *title, const char *message) = 0;
|
||||
|
||||
//virtual static Window *createSingleton() = 0;
|
||||
//virtual static Window *getSingleton() = 0;
|
||||
// No virtual statics, of course, but you are supposed to implement these statics.
|
||||
@@ -129,6 +139,9 @@ public:
|
||||
static bool getConstant(const char *in, FullscreenType &out);
|
||||
static bool getConstant(FullscreenType in, const char *&out);
|
||||
|
||||
static bool getConstant(const char *in, MessageBoxType &out);
|
||||
static bool getConstant(MessageBoxType in, const char *&out);
|
||||
|
||||
protected:
|
||||
|
||||
static Window *singleton;
|
||||
@@ -141,6 +154,9 @@ private:
|
||||
static StringMap<FullscreenType, FULLSCREEN_TYPE_MAX_ENUM>::Entry fullscreenTypeEntries[];
|
||||
static StringMap<FullscreenType, FULLSCREEN_TYPE_MAX_ENUM> fullscreenTypes;
|
||||
|
||||
static StringMap<MessageBoxType, MESSAGEBOX_MAX_ENUM>::Entry messageBoxTypeEntries[];
|
||||
static StringMap<MessageBoxType, MESSAGEBOX_MAX_ENUM> messageBoxTypes;
|
||||
|
||||
}; // Window
|
||||
|
||||
struct WindowSettings
|
||||
|
||||
@@ -654,6 +654,27 @@ const void *Window::getHandle() const
|
||||
return window;
|
||||
}
|
||||
|
||||
void Window::showMessageBox(MessageBoxType type, const char *title, const char *message)
|
||||
{
|
||||
SDL_MessageBoxFlags sdlflags;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MESSAGEBOX_ERROR:
|
||||
sdlflags = SDL_MESSAGEBOX_ERROR;
|
||||
break;
|
||||
case MESSAGEBOX_WARNING:
|
||||
sdlflags = SDL_MESSAGEBOX_WARNING;
|
||||
break;
|
||||
case MESSAGEBOX_INFO:
|
||||
default:
|
||||
sdlflags = SDL_MESSAGEBOX_INFORMATION;
|
||||
break;
|
||||
}
|
||||
|
||||
SDL_ShowSimpleMessageBox(sdlflags, title, message, window);
|
||||
}
|
||||
|
||||
love::window::Window *Window::createSingleton()
|
||||
{
|
||||
if (!singleton)
|
||||
|
||||
@@ -83,6 +83,8 @@ public:
|
||||
|
||||
const void *getHandle() const;
|
||||
|
||||
void showMessageBox(MessageBoxType type, const char *title, const char *message);
|
||||
|
||||
static love::window::Window *createSingleton();
|
||||
static love::window::Window *getSingleton();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user