Fix compilation with MSVC
This commit is contained in:
parent
f182c84c93
commit
b68415be42
@ -199,7 +199,7 @@ if(BUILD_CLIENT)
|
|||||||
endif()
|
endif()
|
||||||
if(WINDOW_WIN32)
|
if(WINDOW_WIN32)
|
||||||
list(APPEND CLIENT_SOURCES
|
list(APPEND CLIENT_SOURCES
|
||||||
src/game/window/win32_window.cpp
|
src/game/window/win32/win32_window.cpp
|
||||||
)
|
)
|
||||||
if(RENDERER_GL OR RENDERER_LEGACY_GL)
|
if(RENDERER_GL OR RENDERER_LEGACY_GL)
|
||||||
list(APPEND CLIENT_SOURCES
|
list(APPEND CLIENT_SOURCES
|
||||||
|
@ -28,6 +28,7 @@ SOFTWARE.
|
|||||||
#if defined(__unix__) || defined(__HAIKU__)
|
#if defined(__unix__) || defined(__HAIKU__)
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
|
#define NOMINMAX
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,6 +28,12 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "common/logger.hpp"
|
#include "common/logger.hpp"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
// Visual Studio doesn't define ssize_t by default
|
||||||
|
#include <basetsd.h>
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace polygun::network;
|
using namespace polygun::network;
|
||||||
|
|
||||||
static const time_t NETWORK_MANAGER_PACKET_RETRY_INTERVAL = 4;
|
static const time_t NETWORK_MANAGER_PACKET_RETRY_INTERVAL = 4;
|
||||||
|
@ -39,6 +39,12 @@ using namespace polygun::network;
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
// Visual Studio doesn't define ssize_t by default
|
||||||
|
#include <basetsd.h>
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__unix__) || defined(__HAIKU__)
|
#if defined(__unix__) || defined(__HAIKU__)
|
||||||
#define INVALID_SOCK 1
|
#define INVALID_SOCK 1
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
|
@ -36,6 +36,12 @@ SOFTWARE.
|
|||||||
#include "game/gui/style.hpp"
|
#include "game/gui/style.hpp"
|
||||||
#include "game/renderer/texture.hpp"
|
#include "game/renderer/texture.hpp"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
// Visual Studio doesn't define ssize_t by default
|
||||||
|
#include <basetsd.h>
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace polygun::gui;
|
using namespace polygun::gui;
|
||||||
|
|
||||||
Chat::Chat(engine::Engine* engine, Constraint* x, Constraint* y, Constraint* width, Constraint* height, const std::string& id) :
|
Chat::Chat(engine::Engine* engine, Constraint* x, Constraint* y, Constraint* width, Constraint* height, const std::string& id) :
|
||||||
|
@ -33,6 +33,12 @@ SOFTWARE.
|
|||||||
#include "game/gui/layout.hpp"
|
#include "game/gui/layout.hpp"
|
||||||
#include "game/window/event.hpp"
|
#include "game/window/event.hpp"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
// Visual Studio doesn't define ssize_t by default
|
||||||
|
#include <basetsd.h>
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace polygun::gui;
|
using namespace polygun::gui;
|
||||||
|
|
||||||
GUIMaster::GUIMaster(engine::Engine* engine) :
|
GUIMaster::GUIMaster(engine::Engine* engine) :
|
||||||
|
@ -32,6 +32,14 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "common/math/vector.hpp"
|
#include "common/math/vector.hpp"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
/*
|
||||||
|
WinApi defines MessageBox macro which collides with PolyGun MessageBox class, so
|
||||||
|
undefine it here.
|
||||||
|
*/
|
||||||
|
#undef MessageBox
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace polygun::renderer {
|
namespace polygun::renderer {
|
||||||
class Texture;
|
class Texture;
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,13 @@ SOFTWARE.
|
|||||||
#include "game/renderer/gl/gl_context.hpp"
|
#include "game/renderer/gl/gl_context.hpp"
|
||||||
|
|
||||||
#if defined(RENDERER_GL)
|
#if defined(RENDERER_GL)
|
||||||
#include <GL/gl.h>
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#include "game/window/win32/winapi.hpp"
|
||||||
#include <windows.h>
|
|
||||||
#include "game/renderer/gl/msvc_glext.hpp"
|
#include "game/renderer/gl/msvc_glext.hpp"
|
||||||
#else
|
#else
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <GL/gl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace polygun::renderer;
|
using namespace polygun::renderer;
|
||||||
|
@ -17,13 +17,6 @@ extern "C" {
|
|||||||
** Modified by mrkubax10 <mrkubax10@onet.pl> for usage in PolyGun
|
** Modified by mrkubax10 <mrkubax10@onet.pl> for usage in PolyGun
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN 1
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef APIENTRY
|
#ifndef APIENTRY
|
||||||
#define APIENTRY
|
#define APIENTRY
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,7 +33,7 @@ SOFTWARE.
|
|||||||
#else
|
#else
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include "game/window/win32/winapi.hpp"
|
||||||
#include "game/renderer/gl/msvc_glext.hpp"
|
#include "game/renderer/gl/msvc_glext.hpp"
|
||||||
#endif
|
#endif
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
@ -25,7 +25,7 @@ SOFTWARE.
|
|||||||
#include "game/renderer/gl/win32_gl_context.hpp"
|
#include "game/renderer/gl/win32_gl_context.hpp"
|
||||||
|
|
||||||
#include "common/logger.hpp"
|
#include "common/logger.hpp"
|
||||||
#include "game/window/win32_window.hpp"
|
#include "game/window/win32/win32_window.hpp"
|
||||||
#include "game/renderer/gl/opengl.hpp"
|
#include "game/renderer/gl/opengl.hpp"
|
||||||
|
|
||||||
using namespace polygun::renderer;
|
using namespace polygun::renderer;
|
||||||
|
@ -27,12 +27,10 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "game/renderer/gl/gl_context.hpp"
|
#include "game/renderer/gl/gl_context.hpp"
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#define UNICODE
|
|
||||||
#include <windows.h>
|
|
||||||
#undef UNICODE
|
|
||||||
//#include <GL/gl.h>
|
//#include <GL/gl.h>
|
||||||
|
|
||||||
|
#include "game/window/win32/winapi.hpp"
|
||||||
|
|
||||||
namespace polygun::window {
|
namespace polygun::window {
|
||||||
class Win32Window;
|
class Win32Window;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "game/window/win32_window.hpp"
|
#include "game/window/win32/win32_window.hpp"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <locale>
|
#include <locale>
|
@ -25,14 +25,12 @@ SOFTWARE.
|
|||||||
#include "game/window/window.hpp"
|
#include "game/window/window.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#define UNICODE
|
|
||||||
#include <windows.h>
|
|
||||||
#undef UNICODE
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "game/window/win32/winapi.hpp"
|
||||||
|
|
||||||
#if defined(RENDERER_GL) || defined(RENDERER_LEGACY_GL)
|
#if defined(RENDERER_GL) || defined(RENDERER_LEGACY_GL)
|
||||||
#include "game/renderer/gl/win32_gl_context.hpp"
|
#include "game/renderer/gl/win32_gl_context.hpp"
|
||||||
#endif
|
#endif
|
33
src/game/window/win32/winapi.hpp
Normal file
33
src/game/window/win32/winapi.hpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
PolyGun
|
||||||
|
|
||||||
|
Copyright (c) 2024 mrkubax10 <mrkubax10@onet.pl>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define UNICODE
|
||||||
|
#define NOMINMAX
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#undef NOMINMAX
|
||||||
|
#undef UNICODE
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
@ -26,7 +26,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include <config.hpp>
|
#include <config.hpp>
|
||||||
#if defined(WINDOW_WIN32)
|
#if defined(WINDOW_WIN32)
|
||||||
#include "game/window/win32_window.hpp"
|
#include "game/window/win32/win32_window.hpp"
|
||||||
#endif
|
#endif
|
||||||
#if defined(WINDOW_X11)
|
#if defined(WINDOW_X11)
|
||||||
#include "game/window/x11/x11_window.hpp"
|
#include "game/window/x11/x11_window.hpp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user