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
+5
View File
@@ -108,6 +108,11 @@ public:
virtual ~Graphics();
/**
* Sets the current graphics display viewport dimensions.
**/
virtual void setViewportSize(int width, int height) = 0;
/**
* Sets the current graphics display viewport and initializes the renderer.
* @param width The viewport width.
+26 -13
View File
@@ -52,7 +52,7 @@ Graphics::Graphics()
, created(false)
, savedState()
{
currentWindow = love::window::sdl::Window::getSingleton();
currentWindow = love::window::sdl::Window::createSingleton();
if (currentWindow->isCreated())
setMode(currentWindow->getWidth(), currentWindow->getHeight());
@@ -113,6 +113,27 @@ void Graphics::restoreState(const DisplayState &s)
setColorMask(s.colorMask[0], s.colorMask[1], s.colorMask[2], s.colorMask[3]);
}
void Graphics::setViewportSize(int width, int height)
{
this->width = width;
this->height = height;
if (!isCreated())
return;
// Set the viewport to top-left corner
gl.setViewport(OpenGL::Viewport(0, 0, width, height));
// Reset the projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set up orthographic view (no depth)
glOrtho(0.0, width, height, 0.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
}
bool Graphics::setMode(int width, int height)
{
this->width = width;
@@ -121,6 +142,10 @@ bool Graphics::setMode(int width, int height)
// Okay, setup OpenGL.
gl.initContext();
created = true;
setViewportSize(width, height);
// Make sure antialiasing works when set elsewhere
if (GLEE_VERSION_1_3 || GLEE_ARB_multisample)
glEnable(GL_MULTISAMPLE);
@@ -147,16 +172,6 @@ bool Graphics::setMode(int width, int height)
glEnable(GL_TEXTURE_2D);
gl.setTextureUnit(0);
// Set the viewport to top-left corner
gl.setViewport(OpenGL::Viewport(0, 0, width, height));
// Reset the projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set up orthographic view (no depth)
glOrtho(0.0, width, height, 0.0, -1.0, 1.0);
// Reset modelview matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
@@ -179,8 +194,6 @@ bool Graphics::setMode(int width, int height)
glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, &matrixLimit);
matrixLimit -= 5;
created = true;
return true;
}
+1
View File
@@ -112,6 +112,7 @@ public:
void restoreState(const DisplayState &s);
virtual void setViewportSize(int width, int height);
virtual bool setMode(int width, int height);
virtual void unSetMode();