Browse Source

Platform: we don't need to include windows.h here.

Did the same thing a while ago in Corrade/PluginManager/AbstractManager.h
so reusing it here.
pull/370/head
Vladimír Vondruš 7 years ago
parent
commit
9638e77996
  1. 8
      src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp
  2. 9
      src/Magnum/Platform/Implementation/OpenGLFunctionLoader.h

8
src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp

@ -41,6 +41,10 @@
#pragma warning(disable: 4055)
#pragma warning(disable: 4054)
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
/* GLX-specific includes */
#elif defined(CORRADE_TARGET_UNIX) && defined(MAGNUM_PLATFORM_USE_GLX)
@ -93,9 +97,9 @@ auto OpenGLFunctionLoader::load(const char* const name) -> FunctionPointer {
const PROC address = wglGetProcAddress(reinterpret_cast<LPCSTR>(name));
const auto integerAddress = reinterpret_cast<std::ptrdiff_t>(address);
if(address && integerAddress != 1 && integerAddress != 2 &&
integerAddress != 3 && integerAddress != -1) return address;
integerAddress != 3 && integerAddress != -1) return reinterpret_cast<FunctionPointer>(address);
return GetProcAddress(library, reinterpret_cast<LPCSTR>(name));
return reinterpret_cast<FunctionPointer>(GetProcAddress(library, reinterpret_cast<LPCSTR>(name)));
}
/* GLX-specific implementation */

9
src/Magnum/Platform/Implementation/OpenGLFunctionLoader.h

@ -28,19 +28,16 @@
#include "Magnum/Magnum.h"
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_PLATFORM_USE_EGL)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
/* I didn't find a better way to circumvent the need for including windows.h */
struct HINSTANCE__;
typedef struct HINSTANCE__* HMODULE;
#endif
namespace Magnum { namespace Platform { namespace Implementation {
class OpenGLFunctionLoader {
public:
#if !defined(CORRADE_TARGET_WINDOWS) || defined(MAGNUM_PLATFORM_USE_EGL)
using FunctionPointer = void(*)();
#else
using FunctionPointer = PROC;
#endif
explicit OpenGLFunctionLoader();
~OpenGLFunctionLoader();

Loading…
Cancel
Save