Merged SDL2 changes from bartbes/love-experiments/SDL2 into default.

- Added love.system module, including clipboard functions.

- Added custom hardware cursors (love.mouse.newCursor, love.mouse.setCursor.)

- Revamped love.joystick:
-- added Joystick objects and moved love.joystick functions which operated on individual joysticks to methods on the Joystick objects.
-- Added love.joystick.getJoystick and love.joystick.getJoystickCount.
-- Added events for when joysticks are connected and disconnected.
-- Added 'Gamepad' methods to Joystick objects: Joystick:isGamepad, Joystick:getGamepadAxis, and Joystick:isGamepadDown. They're a common abstraction for xbox controller-like joystick across operating systems.

- Added monitor choosing support and "fullscreen desktop" mode to love.window.

- Moved unicode text input events to their own callback function (love.textinput), removed the key repeat functions from love.keyboard and made the second argument of love.keypressed a boolean saying whether the keypress was a repeat.

- liblove now works with love.window and love.graphics in OS X
This commit is contained in:
Alex Szpakowski
2013-08-25 16:51:42 -03:00
parent 035130533b
commit 113ed1cfe7
67 changed files with 4691 additions and 1665 deletions
+34 -5
View File
@@ -24,6 +24,9 @@
// LOVE
#include "window/Window.h"
// SDL
#include <SDL.h>
namespace love
{
namespace window
@@ -39,18 +42,27 @@ public:
~Window();
bool setWindow(int width = 800, int height = 600, WindowFlags *flags = 0);
void getWindow(int &width, int &height, WindowFlags &flags) const;
void getWindow(int &width, int &height, WindowFlags &flags);
bool checkWindowSize(int width, int height, bool fullscreen) const;
WindowSize *getFullscreenSizes(int &n) const;
bool setFullscreen(bool fullscreen, FullscreenType fstype);
bool setFullscreen(bool fullscreen);
bool onWindowResize(int width, int height);
int getDisplayCount() const;
bool checkWindowSize(int width, int height, bool fullscreen, int displayindex) const;
std::vector<WindowSize> getFullscreenSizes(int displayindex) const;
int getWidth() const;
int getHeight() const;
void getDesktopDimensions(int displayindex, int &width, int &height) const;
bool isCreated() const;
void setWindowTitle(const std::string &title);
std::string getWindowTitle() const;
const std::string &getWindowTitle() const;
bool setIcon(love::image::ImageData *imgd);
love::image::ImageData *getIcon();
@@ -65,12 +77,24 @@ public:
void setMouseVisible(bool visible);
bool getMouseVisible() const;
void setMouseGrab(bool grab);
bool isMouseGrabbed() const;
const void *getHandle() const;
static love::window::Window *createSingleton();
static love::window::Window *getSingleton();
const char *getName() const;
private:
bool setContext(int fsaa, bool vsync);
void setWindowGLAttributes(int fsaa) const;
// Update the window flags based on the window's actual state.
void updateWindowFlags(const WindowFlags &newflags);
std::string windowTitle;
struct _currentMode
@@ -82,10 +106,15 @@ private:
WindowFlags flags;
love::image::ImageData *icon;
} currentMode;
} curMode;
bool created;
bool mouseGrabbed;
SDL_Window *window;
SDL_GLContext context;
}; // Window
} // sdl