From 93ac73179f6eb738f7dfa8f52c06753509e1930a Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sat, 6 Aug 2016 19:50:07 +0200 Subject: [PATCH] Support vs15 --- BBGE/Base.h | 4 ++-- BBGE/Core.cpp | 38 ++------------------------------------ BBGE/Core.h | 2 -- BBGE/OSFunctions.cpp | 39 ++++++++++++++++++++++++++++++++++++++- BBGE/OSFunctions.h | 2 ++ BBGE/Vector.cpp | 1 + CMakeLists.txt | 2 +- 7 files changed, 46 insertions(+), 42 deletions(-) diff --git a/BBGE/Base.h b/BBGE/Base.h index b901bfc..000dd7d 100644 --- a/BBGE/Base.h +++ b/BBGE/Base.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef BBGE_BUILD_WINDOWS #define WIN32_NOMINMAX - #ifdef _MSC_VER + #if defined(_MSC_VER) && _MSC_VER <= 1600 #define strtof (float)strtod #define snprintf _snprintf #endif @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef _MSC_VER #pragma warning(disable:4786) -#pragma warning(disable:4005) +//#pragma warning(disable:4005) #pragma warning(disable:4305) #pragma warning(disable:4018) // signed/unsigned mismatch diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index 37b8ca4..8c06308 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -65,37 +65,10 @@ Core *core = 0; static std::ofstream _logOut; -#ifdef BBGE_BUILD_WINDOWS - HICON icon_windows = 0; -#endif - #ifndef KMOD_GUI #define KMOD_GUI KMOD_META #endif -void Core::initIcon() -{ -#ifdef BBGE_BUILD_WINDOWS - HINSTANCE handle = ::GetModuleHandle(NULL); - - - - icon_windows = ::LoadIcon(handle, "icon"); - - SDL_SysWMinfo wminfo; - SDL_VERSION(&wminfo.version) - if (SDL_GetWindowWMInfo(gScreen, &wminfo) != 1) - { - - - } - - HWND hwnd = wminfo.info.win.window; - - ::SetClassLong(hwnd, GCL_HICON, (LONG) icon_windows); -#endif -} - void Core::resetCamera() { cameraPos = Vector(0,0); @@ -783,7 +756,7 @@ bool Core::initGraphicsLibrary(int width, int height, bool fullscreen, int vsync setWindowCaption(appName, appName); - initIcon(); + initIcon(gScreen); // Create window setSDLGLAttributes(); @@ -988,14 +961,7 @@ void Core::shutdownGraphicsLibrary(bool killVideo) lib_graphics = false; -#ifdef BBGE_BUILD_WINDOWS - if (icon_windows) - { - ::DestroyIcon(icon_windows); - icon_windows = 0; - } -#endif - + destroyIcon(); } void Core::quit() diff --git a/BBGE/Core.h b/BBGE/Core.h index 905e00b..a0b2b57 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -478,8 +478,6 @@ protected: int virtualOffX, virtualOffY; - void initIcon(); - float old_dt; float current_dt; diff --git a/BBGE/OSFunctions.cpp b/BBGE/OSFunctions.cpp index 6487697..83fbc9a 100644 --- a/BBGE/OSFunctions.cpp +++ b/BBGE/OSFunctions.cpp @@ -5,7 +5,7 @@ #include "ttvfs_stdio.h" #ifdef BBGE_BUILD_WINDOWS -# define WIN32_LEAN_AND_MEAN +//# define WIN32_LEAN_AND_MEAN # define WIN32_NOMINMAX # include # undef min @@ -49,6 +49,43 @@ static std::string _CFToStdString(CFStringRef cs) #endif #include "SDL.h" +#include "SDL_syswm.h" + +#ifdef BBGE_BUILD_WINDOWS +static HICON icon_windows = 0; +#endif + +void initIcon(void *screen) +{ +#ifdef BBGE_BUILD_WINDOWS + HINSTANCE handle = ::GetModuleHandle(NULL); + if(!icon_windows) + icon_windows = ::LoadIcon(handle, "icon"); + SDL_SysWMinfo wminfo; + SDL_VERSION(&wminfo.version) + +#ifdef BBGE_BUILD_SDL2 + SDL_GetWindowWMInfo((SDL_Window*)screen, &wminfo); +#else + SDL_GetWindowWMInfo((SDL_Surface*)screen, &wminfo); +#endif + + HWND hwnd = wminfo.info.win.window; + ::SetClassLongPtr(hwnd, -14, (LONG) icon_windows); // -14 is GCL_HICON (32bit) or GCLP_HICON (64bit) +#endif +} + +void destroyIcon() +{ +#ifdef BBGE_BUILD_WINDOWS + if (icon_windows) + { + ::DestroyIcon(icon_windows); + icon_windows = 0; + } +#endif +} + void openURL(const std::string &url) diff --git a/BBGE/OSFunctions.h b/BBGE/OSFunctions.h index 73dacb5..577c30a 100644 --- a/BBGE/OSFunctions.h +++ b/BBGE/OSFunctions.h @@ -3,6 +3,8 @@ #include +void initIcon(void *screen); +void destroyIcon(); void messageBox(const std::string &title, const std::string& msg); void forEachFile(const std::string& inpath, std::string type, void callback(const std::string &filename, intptr_t param), intptr_t param); std::string adjustFilenameCase(const char *_buf); diff --git a/BBGE/Vector.cpp b/BBGE/Vector.cpp index 0d3aee2..ad5fe72 100644 --- a/BBGE/Vector.cpp +++ b/BBGE/Vector.cpp @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "MathFunctions.h" #include "Base.h" #include +#include /*************************************************************************/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 4714d9f..fd9dc45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -393,7 +393,6 @@ SET(AQUARIA_SRCS ${SRCDIR}/AquariaMenuItem.cpp ${SRCDIR}/AquariaProgressBar.cpp ${SRCDIR}/AquariaSaveSlot.cpp - ${SRCDIR}/AutoMap.cpp ${SRCDIR}/Avatar.cpp ${SRCDIR}/Beam.cpp ${SRCDIR}/BitBlotLogo.cpp @@ -482,6 +481,7 @@ SET(BBGE_SRCS ${BBGEDIR}/Event.cpp ${BBGEDIR}/FrameBuffer.cpp ${BBGEDIR}/Gradient.cpp + ${BBGEDIR}/GLLoad.cpp ${BBGEDIR}/Joystick.cpp ${BBGEDIR}/LensFlare.cpp ${BBGEDIR}/Localization.cpp