- Updated SDL dependency to SDL2
- fixed compilation issues with cmake and visual studio 2015
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules)
|
||||
|
||||
|
||||
@@ -27,10 +27,13 @@ macro(FindOrBuildSDL2)
|
||||
if(ANDROID)
|
||||
set(ENV{SDL2DIR} "$ENV{ANDROID_SDL2_ROOT};$ENV{ANDROID_SDL2_ROOT}/libs/${ANDROID_NDK_ABI_NAME}/")
|
||||
elseif(WIN32)
|
||||
set(ENV{SDL2DIR} $ENV{WIN_SDL2_ROOT})
|
||||
endif()
|
||||
|
||||
# set(ENV{SDL2DIR} $ENV{WIN_SDL2_ROOT})
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/SDL2)
|
||||
set(SDL2_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/SDL2/include ${CMAKE_BINARY_DIR}/thirdparty/SDL2)
|
||||
set(SDL2_LIBRARY SDL2)
|
||||
else()
|
||||
find_package(SDL2)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildUNZIP)
|
||||
@@ -84,10 +87,11 @@ macro(FindOrBuildBoost)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(FindOrBuildZLIB)
|
||||
if(BUILD_ZLIB)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
|
||||
set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/zlib)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib)
|
||||
set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
|
||||
set(ZLIB_LIBRARY zlib)
|
||||
else()
|
||||
if(WIN32)
|
||||
@@ -103,12 +107,7 @@ macro(FindOrBuildGIF)
|
||||
if(BUILD_GIF)
|
||||
message(WARNING "ZLIB sources are currently not included within the wagic tree")
|
||||
else()
|
||||
if(WIN32)
|
||||
set(ENV{GIF_DIR} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win)
|
||||
find_package(GIF)
|
||||
else()
|
||||
find_package(GIF)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ set(JGE_psp_src
|
||||
src/vram.cpp)
|
||||
|
||||
set(JGE_INCLUDE_DIRS include include/hge)
|
||||
set(EXTRA_INCLUDE_DIR ../projects/mtg/extra)
|
||||
|
||||
#turn moc on
|
||||
if(backend_qt_console OR backend_qt_widget)
|
||||
@@ -80,7 +81,7 @@ if(backend_qt_console)
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
|
||||
${UNZIP_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default ${Qt5Core_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS})
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_console_src} ${JGE_linux_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Multimedia_LIBRARIES} ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${GIF_LIBRARIES}
|
||||
set(JGE_LINK_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Multimedia_LIBRARIES} ${ZIPFS_LIBRARY} ${UNZIP_LIRARY}
|
||||
${JPEG_LIBRARIES} ${PNG_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "qt builds of jge platforms other than linux are not supported")
|
||||
@@ -93,7 +94,7 @@ if(backend_qt_widget)
|
||||
${UNZIP_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default ${Qt5Core_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} )
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_linux_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Multimedia_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${ZIPFS_LIBRARY} ${UNZIP_LIRARY}
|
||||
${GIF_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES})
|
||||
${JPEG_LIBRARIES} ${PNG_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "qt builds of jge platforms other than linux are not supported")
|
||||
endif()
|
||||
@@ -102,23 +103,22 @@ endif()
|
||||
if(backend_sdl)
|
||||
if(UNIX AND NOT ANDROID)
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
|
||||
${SDL2_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS})
|
||||
${SDL2_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_linux_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${GIF_LIBRARIES} ${JPEG_LIBRARY}
|
||||
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY}
|
||||
${PNG_LIBRARIES})
|
||||
elseif(ANDROID)
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${BOOST_INCLUDE_DIRS} ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
|
||||
${SDL2_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR}
|
||||
${OPENSL_INCLUDE_DIR})
|
||||
${OPENSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_android_src} ${JGE_graphics_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY} ${PNG_LIBRARIES}
|
||||
${OPENSL_LIBRARIES})
|
||||
elseif(WIN32)
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${SDL2_INCLUDE_DIR}
|
||||
${UNZIP_INCLUDE_DIR} ${GIF_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${EXTRA_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${SDL2_INCLUDE_DIR}
|
||||
${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_linux_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${GIF_LIBRARIES} ${JPEG_LIBRARY}
|
||||
${PNG_LIBRARIES})
|
||||
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY} ${PNG_LIBRARIES})
|
||||
set(JGE_LINK_DIRECTORIES ${Boost_LIBRARY_DIR} ${SDL2_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -41,7 +41,7 @@ class DownloadRequest
|
||||
private slots:
|
||||
#endif
|
||||
void fileDownloaded();
|
||||
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
||||
void downloadProgress(int64_t bytesReceived, int64_t bytesTotal);
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
signals:
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef u32 LocalKeySym;
|
||||
|
||||
#elif defined(SDL_CONFIG)
|
||||
#include <SDL.h>
|
||||
typedef SDLKey LocalKeySym;
|
||||
typedef SDL_Keycode LocalKeySym;
|
||||
#define LOCAL_KEY_NONE SDLK_UNKNOWN
|
||||
|
||||
#elif defined(WIN32)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if (!defined IOS) && (!defined ANDROID) && (!defined QT_CONFIG)
|
||||
#if (!defined IOS) && (!defined ANDROID) && (!defined QT_CONFIG) && (!defined SDL_CONFIG)
|
||||
#include <gif_lib.h>
|
||||
#endif //IOS ANDROID
|
||||
|
||||
@@ -567,7 +567,7 @@ private:
|
||||
#if (!defined IOS) && (!defined QT_CONFIG)
|
||||
void LoadJPG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
int LoadPNG(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
#if (!defined ANDROID) && (!defined QT_CONFIG)
|
||||
#if (!defined ANDROID) && (!defined QT_CONFIG) && (!defined SDL_CONFIG)
|
||||
void LoadGIF(TextureInfo &textureInfo, const char *filename, int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
int image_readgif(void * handle, TextureInfo &textureInfo, DWORD * bgcolor, InputFunc readFunc,int mode = 0, int TextureFormat = TEXTURE_FORMAT);
|
||||
#endif // (ANDROID) How can we get gif support for android ?
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WITH_FMOD
|
||||
#include "../Dependencies/include/fmod.h"
|
||||
#include "fmod.h"
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -26,8 +26,12 @@
|
||||
#include "JAudio.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <stdint.h>
|
||||
//#define __STDC_LIMIT_MACROS
|
||||
#include <cstdint>
|
||||
//#include <stdint.h>
|
||||
//the MSC version might only define _MSC_STDINT_H_
|
||||
//and that might cause redefinition of standard types
|
||||
//#define _STDINT_H_
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef THREADING_H
|
||||
#define THREADING_H
|
||||
|
||||
#if !defined(PSP) && !defined(QT_CONFIG) && !(__cplusplus > 199711L)
|
||||
#if !defined(PSP) && !defined(QT_CONFIG) && !(__cplusplus > 199711L) && !(_MSC_VER >= 1700)
|
||||
#include <boost/date_time.hpp>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -537,7 +537,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#elif (__cplusplus > 199711L)
|
||||
#elif (__cplusplus > 199711L) || (_MSC_VER >= 1700)
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
@@ -48,14 +48,15 @@ void DownloadRequest::startGet()
|
||||
JFileSystem::GetInstance()->Remove(getTempLocalPath());
|
||||
JFileSystem::GetInstance()->openForWrite(mFile, getTempLocalPath());
|
||||
#ifdef QT_CONFIG
|
||||
connect(mNetworkReply, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
SLOT(downloadProgress(qint64, qint64)));
|
||||
connect(mNetworkReply, SIGNAL(downloadProgress(int64_t, int64_t)),
|
||||
SLOT(downloadProgress(int64_t, int64_t)));
|
||||
connect(mNetworkReply, SIGNAL(finished()), SLOT(fileDownloaded()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void DownloadRequest::fileDownloaded()
|
||||
{
|
||||
#ifdef QT_CONFIG
|
||||
do {
|
||||
QByteArray eTagByteArray = mNetworkReply->rawHeader("ETag");
|
||||
if(!eTagByteArray.isEmpty()) {
|
||||
@@ -106,10 +107,13 @@ void DownloadRequest::fileDownloaded()
|
||||
mNetworkReply->deleteLater();
|
||||
|
||||
emit statusChanged((int)mDownloadStatus);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void DownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||
void DownloadRequest::downloadProgress(int64_t bytesReceived, int64_t bytesTotal)
|
||||
{
|
||||
#ifdef QT_CONFIG
|
||||
QByteArray byteArray = mNetworkReply->readAll();
|
||||
mFile.write(byteArray.constData(), byteArray.size());
|
||||
mCurrentSize = bytesReceived;
|
||||
@@ -118,6 +122,7 @@ void DownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||
if(bytesTotal)
|
||||
percent = (bytesReceived/bytesTotal)*100;
|
||||
emit percentChanged(percent);
|
||||
#endif
|
||||
}
|
||||
|
||||
Downloader* Downloader::mInstance = 0;
|
||||
|
||||
@@ -16,9 +16,7 @@ User folder is the only one that is really needed to guarantee both read and wri
|
||||
The content that users should not be touching.
|
||||
*/
|
||||
|
||||
#ifndef PSP
|
||||
#include "PrecompiledHeader.h"
|
||||
#endif //PSP
|
||||
#include "dirent.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable : 4786)
|
||||
@@ -32,7 +30,6 @@ The content that users should not be touching.
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JLogger.h"
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
#include <QDir>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#if defined (WIN32) // WIN32 specific code
|
||||
#include "../../Dependencies/include/fmod.h"
|
||||
#include "fmod.h"
|
||||
|
||||
u8 JGE::GetAnalogX()
|
||||
{
|
||||
@@ -54,7 +54,7 @@ u8 JGE::GetAnalogY()
|
||||
#elif defined (LINUX) // Unix specific code
|
||||
#include <sys/time.h>
|
||||
#ifdef WITH_FMOD
|
||||
#include "../Dependencies/include/fmod.h"
|
||||
#include "fmod.h"
|
||||
#endif //WITH_FMOD
|
||||
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ set(MTG_android_sdl_src
|
||||
set(MTG_INCLUDE_DIRS include include/qt)
|
||||
set(JGE_INCLUDE_DIRS ../../JGE/include ../../JGE/include/hge)
|
||||
set(JGE_LIBRARY jge)
|
||||
set(EXTRA_INCLUDE_DIR extra)
|
||||
|
||||
#turn moc on
|
||||
if(backend_qt_console OR backend_qt_widget)
|
||||
@@ -187,9 +188,9 @@ if(backend_sdl)
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES}
|
||||
${HGE_LIBRARY})
|
||||
elseif(WIN32)
|
||||
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
|
||||
include_directories(${EXTRA_INCLUDE_DIR} ${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR}
|
||||
${ZLIB_INCLUDE_DIR})
|
||||
${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
|
||||
add_executable(wagic ${MTG_generic_src} ${MTG_sdl_src} src/TestSuiteAI.cpp src/AIPlayerBakaB.cpp)
|
||||
link_directories(${Boost_LIBRARY_DIR} ${SDL2_LIBRARY_DIR})
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES}
|
||||
|
||||
@@ -60,13 +60,12 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
typedef struct dirent {
|
||||
/* name of current directory entry (a multi-byte character string) */
|
||||
char d_name[MAX_PATH + 1];
|
||||
|
||||
/* file attributes */
|
||||
WIN32_FIND_DATAA data;
|
||||
WIN32_FIND_DATAW data;
|
||||
} dirent;
|
||||
|
||||
|
||||
@@ -81,7 +80,7 @@ typedef struct DIR {
|
||||
HANDLE search_handle;
|
||||
|
||||
/* search pattern (3 = zero terminator + pattern "\\*") */
|
||||
char patt[MAX_PATH + 3];
|
||||
wchar_t patt[MAX_PATH + 3];
|
||||
} DIR;
|
||||
|
||||
|
||||
@@ -91,12 +90,7 @@ static int closedir (DIR *dirp);
|
||||
|
||||
|
||||
/* use the new safe string functions introduced in Visual Studio 2005 */
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE)
|
||||
#else
|
||||
# define STRNCPY(dest,src,size) strncpy((dest),(src),(size))
|
||||
#endif
|
||||
|
||||
# define STRNCPY(dest,src,size) wcsncpy_s((dest),(size),(src),_TRUNCATE)
|
||||
|
||||
/*
|
||||
* Open directory stream DIRNAME for read and return a pointer to the
|
||||
@@ -114,22 +108,28 @@ opendir(
|
||||
/* construct new DIR structure */
|
||||
dirp = (DIR*) malloc (sizeof (struct DIR));
|
||||
if (dirp != NULL) {
|
||||
char *p;
|
||||
wchar_t *p;
|
||||
|
||||
/* take directory name... */
|
||||
STRNCPY (dirp->patt, dirname, sizeof(dirp->patt));
|
||||
dirp->patt[MAX_PATH] = '\0';
|
||||
MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS, dirname, -1,dirp->patt, strlen(dirname)+1 );
|
||||
dirp->patt[MAX_PATH] = L'\0';
|
||||
|
||||
/* ... and append search pattern to it */
|
||||
p = strchr (dirp->patt, '\0');
|
||||
if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') {
|
||||
*p++ = '\\';
|
||||
p = wcschr (dirp->patt, L'\0');
|
||||
if (dirp->patt < p && *(p-1) != L'\\' && *(p-1) != L':') {
|
||||
*p++ = L'\\';
|
||||
}
|
||||
*p++ = '*';
|
||||
*p = '\0';
|
||||
*p++ = L'*';
|
||||
*p = L'\0';
|
||||
|
||||
/* open stream and retrieve first file */
|
||||
dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
|
||||
dirp->search_handle = FindFirstFileExW( dirp->patt,
|
||||
FindExInfoStandard,
|
||||
&dirp->current.data,
|
||||
FindExSearchNameMatch,
|
||||
NULL,
|
||||
0 );;
|
||||
|
||||
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||
/* invalid search pattern? */
|
||||
free (dirp);
|
||||
@@ -168,7 +168,7 @@ readdir(
|
||||
dirp->cached = 0;
|
||||
} else {
|
||||
/* read next directory entry from disk */
|
||||
if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||
if (FindNextFileW (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||
/* the very last file has been processed or an error occured */
|
||||
FindClose (dirp->search_handle);
|
||||
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||
@@ -177,7 +177,7 @@ readdir(
|
||||
}
|
||||
|
||||
/* copy as a multibyte character string */
|
||||
STRNCPY (dirp->current.d_name, dirp->current.data.cFileName, sizeof(dirp->current.d_name));
|
||||
WideCharToMultiByte(CP_ACP, 0, dirp->current.data.cFileName, -1, dirp->current.d_name, wcslen(dirp->current.data.cFileName)+1, NULL, NULL);
|
||||
dirp->current.d_name[MAX_PATH] = '\0';
|
||||
|
||||
return &dirp->current;
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
#include "GameOptions.h"
|
||||
|
||||
#if !defined(WP8) && !defined(QT_CONFIG)
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#endif
|
||||
//#if !defined(WP8) && !defined(QT_CONFIG)
|
||||
//#include <boost/shared_ptr.hpp>
|
||||
//#include <boost/scoped_ptr.hpp>
|
||||
//#endif
|
||||
|
||||
#if defined (WP8) || defined (IOS) || defined (ANDROID) || defined (QT_CONFIG) || defined (SDL_CONFIG)
|
||||
#define TOUCH_ENABLED
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef WRESOURCE_FWD_H
|
||||
#define WRESOURCE_FWD_H
|
||||
|
||||
#if (__cplusplus > 199711L)
|
||||
#if (__cplusplus > 199711L) || (_MSC_VER >= 1700)
|
||||
#include <memory>
|
||||
typedef std::shared_ptr<JQuad> JQuadPtr;
|
||||
#elif defined(QT_CONFIG)
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
#include "Counters.h"
|
||||
#include "AllAbilities.h"
|
||||
|
||||
#if !defined(QT_CONFIG)
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
typedef boost::scoped_ptr<ManaCost> ManaCostPtr;
|
||||
#else
|
||||
#if (__cplusplus > 199711L) || (_MSC_VER >= 1700)
|
||||
//#include <unique_ptr>
|
||||
typedef std::unique_ptr<ManaCost> ManaCostPtr;
|
||||
#elif defined(QT_CONFIG)
|
||||
#include <QScopedPointer>
|
||||
class ManaCostPtr : public QScopedPointer<ManaCost>
|
||||
{
|
||||
@@ -21,6 +21,9 @@ public:
|
||||
ManaCost* get() const {return data();};
|
||||
|
||||
};
|
||||
#else
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
typedef boost::scoped_ptr<ManaCost> ManaCostPtr;
|
||||
#endif
|
||||
|
||||
SUPPORT_OBJECT_ANALYTICS(ExtraCost)
|
||||
|
||||
@@ -1516,7 +1516,7 @@ ostream& operator<<(ostream& out, const GameObserver& g)
|
||||
out << g.mSeed;
|
||||
out << endl;
|
||||
out << "rvalues:";
|
||||
out << g.randomGenerator.saveUsedRandValues(out);
|
||||
g.randomGenerator.saveUsedRandValues(out);
|
||||
out << endl;
|
||||
out << g.startupGameSerialized;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class SdlApp
|
||||
public: /* For easy interfacing with JGE static functions */
|
||||
bool Running;
|
||||
SDL_Window* window;
|
||||
SDL_Surface* Surf_Display;
|
||||
SDL_GLContext gl_context;
|
||||
SDL_Rect viewPort;
|
||||
Uint32 lastMouseUpTime;
|
||||
Uint32 lastFingerDownTime;
|
||||
@@ -114,7 +114,7 @@ public: /* For easy interfacing with JGE static functions */
|
||||
int mMouseDownY;
|
||||
|
||||
public:
|
||||
SdlApp() : Surf_Display(NULL), window(NULL), lastMouseUpTime(0), lastFingerDownTime(0), Running(true), mMouseDownX(0), mMouseDownY(0)
|
||||
SdlApp() : Running(true), window(NULL), gl_context(NULL), lastMouseUpTime(0), lastFingerDownTime(0), mMouseDownX(0), mMouseDownY(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
OnCleanup();
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
public:
|
||||
bool OnInit();
|
||||
@@ -276,7 +276,7 @@ public:
|
||||
|
||||
void OnCleanup()
|
||||
{
|
||||
SDL_FreeSurface(Surf_Display);
|
||||
SDL_GL_DeleteContext(gl_context);
|
||||
SDL_Quit();
|
||||
}
|
||||
};
|
||||
@@ -403,7 +403,11 @@ bool InitGame(void)
|
||||
|
||||
void DestroyGame(void)
|
||||
{
|
||||
if (g_engine != NULL)
|
||||
{
|
||||
g_engine->SetApp(NULL);
|
||||
}
|
||||
|
||||
if (g_app)
|
||||
{
|
||||
g_app->Destroy();
|
||||
@@ -443,7 +447,7 @@ void SdlApp::OnUpdate()
|
||||
if(g_engine)
|
||||
g_engine->Render();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
|
||||
void SdlApp::OnKeyPressed(const SDL_KeyboardEvent& event)
|
||||
@@ -637,8 +641,9 @@ bool SdlApp::OnInit()
|
||||
return false;
|
||||
}
|
||||
|
||||
const SDL_VideoInfo *pVideoInfo = SDL_GetVideoInfo();
|
||||
DebugTrace("Video Display : h " << pVideoInfo->current_h << ", w " << pVideoInfo->current_w);
|
||||
SDL_DisplayMode currentDisplayMode;
|
||||
SDL_GetCurrentDisplayMode(0, ¤tDisplayMode);
|
||||
DebugTrace("Video Display : h " << currentDisplayMode.h << ", w " << currentDisplayMode.w);
|
||||
|
||||
#if (defined ANDROID) || (defined IOS)
|
||||
window_w = pVideoInfo->current_w;
|
||||
@@ -662,22 +667,37 @@ bool SdlApp::OnInit()
|
||||
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 8);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 2);
|
||||
|
||||
int buffers, samples;
|
||||
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &buffers);
|
||||
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &samples);
|
||||
if (buffers == 0 || samples == 0)
|
||||
{ //no multisampling available
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
|
||||
if((Surf_Display = SDL_SetVideoMode(window_w, window_h, 32,
|
||||
#ifdef ANDROID
|
||||
SDL_OPENGL | SDL_FULLSCREEN | SDL_WINDOW_BORDERLESS)) == NULL)
|
||||
{
|
||||
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS;
|
||||
#else
|
||||
SDL_OPENGL | SDL_RESIZABLE )) == NULL)
|
||||
{
|
||||
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
|
||||
#endif
|
||||
window = SDL_CreateWindow(
|
||||
g_launcher->GetName(),
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
window_w, windowed_h, flags);
|
||||
if (window == NULL)
|
||||
{
|
||||
DebugTrace(SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
SDL_WM_SetCaption(g_launcher->GetName(), "");
|
||||
|
||||
gl_context = SDL_GL_CreateContext(window);
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background (yes that's the way fuckers)
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0)
|
||||
|
||||
@@ -851,7 +851,7 @@ void TestSuiteGame::initGame()
|
||||
p->life = initState.players[i]->life;
|
||||
p->poisonCount = initState.players[i]->poisonCount;
|
||||
stringstream stream;
|
||||
stream << initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
|
||||
initState.players[i]->getRandomGenerator()->saveLoadedRandValues(stream);
|
||||
p->getRandomGenerator()->loadRandValues(stream.str());
|
||||
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
|
||||
MTGGameZone * loadedPlayerZones[] = { initState.players[i]->game->graveyard,
|
||||
|
||||
Reference in New Issue
Block a user