mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 04:31:26 +02:00
Update LÖVE to changeset 7cb21c8bdd64 (pre 0.10.0)
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
#if defined(LOVE_WINDOWS)
|
||||
#include <windows.h>
|
||||
#elif defined(LOVE_MACOSX)
|
||||
#include "common/OSX.h"
|
||||
#include "common/macosx.h"
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
@@ -132,12 +132,14 @@ void Window::setGLContextAttributes(const ContextAttribs &attribs)
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, contextflags);
|
||||
}
|
||||
|
||||
bool Window::checkGLVersion(const ContextAttribs &attribs)
|
||||
bool Window::checkGLVersion(const ContextAttribs &attribs, std::string &outversion)
|
||||
{
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned int GLenum;
|
||||
typedef const GLubyte *(APIENTRY *glGetStringPtr)(GLenum name);
|
||||
const GLenum GL_VERSION_ENUM = 0x1F02;
|
||||
const GLenum GL_VENDOR_ENUM = 0x1F00;
|
||||
const GLenum GL_RENDERER_ENUM = 0x1F01;
|
||||
const GLenum GL_VERSION_ENUM = 0x1F02;
|
||||
|
||||
// We don't have OpenGL headers or an automatic OpenGL function loader in
|
||||
// this module, so we have to get the glGetString function pointer ourselves.
|
||||
@@ -149,6 +151,16 @@ bool Window::checkGLVersion(const ContextAttribs &attribs)
|
||||
if (!glversion)
|
||||
return false;
|
||||
|
||||
outversion = glversion;
|
||||
|
||||
const char *glrenderer = (const char *) glGetStringFunc(GL_RENDERER_ENUM);
|
||||
if (glrenderer)
|
||||
outversion += " - " + std::string(glrenderer);
|
||||
|
||||
const char *glvendor = (const char *) glGetStringFunc(GL_VENDOR_ENUM);
|
||||
if (glvendor)
|
||||
outversion += " (" + std::string(glvendor) + ")";
|
||||
|
||||
int glmajor = 0;
|
||||
int glminor = 0;
|
||||
|
||||
@@ -229,6 +241,7 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
|
||||
}
|
||||
|
||||
std::string windowerror;
|
||||
std::string glversion;
|
||||
|
||||
// Try each context profile in order.
|
||||
for (ContextAttribs attribs : attribslist)
|
||||
@@ -320,7 +333,7 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
|
||||
}
|
||||
|
||||
// Make sure the context's version is at least what we requested.
|
||||
if (context && !checkGLVersion(attribs))
|
||||
if (context && !checkGLVersion(attribs, glversion))
|
||||
{
|
||||
SDL_GL_DeleteContext(context);
|
||||
context = nullptr;
|
||||
@@ -354,6 +367,9 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
|
||||
std::string title = "Unable to initialize OpenGL";
|
||||
std::string message = "This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.";
|
||||
|
||||
if (!glversion.empty())
|
||||
message += " \n\nDetected OpenGL version: " + glversion;
|
||||
|
||||
std::cerr << title << std::endl << message << std::endl;
|
||||
|
||||
// Display a message box with the error, but only once.
|
||||
@@ -1031,7 +1047,7 @@ void Window::requestAttention(bool continuous)
|
||||
|
||||
#elif defined(LOVE_MACOSX)
|
||||
|
||||
love::osx::requestAttention(continuous);
|
||||
love::macosx::requestAttention(continuous);
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ private:
|
||||
|
||||
void setGLFramebufferAttributes(int msaa, bool sRGB);
|
||||
void setGLContextAttributes(const ContextAttribs &attribs);
|
||||
bool checkGLVersion(const ContextAttribs &attribs);
|
||||
bool checkGLVersion(const ContextAttribs &attribs, std::string &outversion);
|
||||
bool createWindowAndContext(int x, int y, int w, int h, Uint32 windowflags, int msaa);
|
||||
|
||||
// Update the saved window settings based on the window's actual state.
|
||||
|
||||
Reference in New Issue
Block a user