Added WRL frontend for Win8 and WP8
Merged Qt, SDL and WRL frontend on the same corewrapper Moved OpenGL code out of SDL and Qt frontends to OpenGl backend (JGfx.cpp) Updated file system and network code to be compatible with WRL
This commit is contained in:
+21
-21
@@ -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,23 +108,29 @@ 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);
|
||||
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||
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);
|
||||
return NULL;
|
||||
@@ -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;
|
||||
|
||||
@@ -15,16 +15,19 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef WP8
|
||||
#include <wrl.h>
|
||||
#include <wrl/client.h>
|
||||
#else
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#include "JGE.h"
|
||||
#include "JFileSystem.h"
|
||||
#include "JLogger.h"
|
||||
|
||||
#include "GameOptions.h"
|
||||
|
||||
#ifndef WP8
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#if defined (WP8) || defined (IOS) || defined (ANDROID) || defined (QT_CONFIG) || defined (SDL_CONFIG)
|
||||
#define TOUCH_ENABLED
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "Player.h"
|
||||
#include "Counters.h"
|
||||
#include "AllAbilities.h"
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <memory>
|
||||
|
||||
SUPPORT_OBJECT_ANALYTICS(ExtraCost)
|
||||
|
||||
@@ -171,7 +171,7 @@ LifeorManaCost::LifeorManaCost(TargetChooser *_tc, string manaType)
|
||||
string buildType ="{";
|
||||
buildType.append(manaType);
|
||||
buildType.append("}");
|
||||
boost::scoped_ptr<ManaCost> cost(ManaCost::parseManaCost(buildType));
|
||||
std::unique_ptr<ManaCost> cost(ManaCost::parseManaCost(buildType));
|
||||
manaCost.copy(cost.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ using std::map;
|
||||
static map<const LocalKeySym, KeyRep> fattable;
|
||||
static map<const JButton, KeyRep> slimtable;
|
||||
|
||||
#if defined(LINUX) || defined (IOS) || defined (ANDROID) || defined (SDL_CONFIG) || defined (QT_CONFIG)
|
||||
#if defined(LINUX) || defined (IOS) || defined (ANDROID) || defined (SDL_CONFIG) || defined (QT_CONFIG) || defined (WP8)
|
||||
const KeyRep& translateKey(LocalKeySym key)
|
||||
{
|
||||
{
|
||||
@@ -23,7 +23,7 @@ const KeyRep& translateKey(LocalKeySym key)
|
||||
|
||||
char* str = NULL;
|
||||
|
||||
#if !defined(QT_CONFIG) && !defined(IOS) && !defined (SDL_CONFIG)
|
||||
#if !defined(QT_CONFIG) && !defined(IOS) && !defined (SDL_CONFIG) && !defined(WP8)
|
||||
str = XKeysymToString(key);
|
||||
#elif defined (SDL_CONFIG)
|
||||
str = (char*)SDL_GetKeyName(key);
|
||||
@@ -31,7 +31,7 @@ const KeyRep& translateKey(LocalKeySym key)
|
||||
if (!str)
|
||||
{
|
||||
str = NEW char[11];
|
||||
sprintf(str, "%lu", (long unsigned int)key); //TODO: Wagic is not supposed to know that a key actually is an unsingned long, so this part should probably be platform specific (move to JGE ?)
|
||||
snprintf(str, 11, "%lu", (long unsigned int)key); //TODO: Wagic is not supposed to know that a key actually is an unsingned long, so this part should probably be platform specific (move to JGE ?)
|
||||
}
|
||||
const KeyRep k = make_pair(str, static_cast<JQuad*>(NULL));
|
||||
fattable[key] = k;
|
||||
@@ -184,9 +184,9 @@ const KeyRep& translateKey(JButton key) {
|
||||
}
|
||||
else
|
||||
{
|
||||
char* str = NEW char[11];
|
||||
sprintf(str, "%d", key);
|
||||
slimtable[key] = make_pair(str, static_cast<JQuad*> (static_cast<JQuad*> (NULL)));
|
||||
char* str = NEW char[11];
|
||||
snprintf(str, 11, "%d", key);
|
||||
slimtable[key] = make_pair(str, static_cast<JQuad*> (static_cast<JQuad*> (NULL)));
|
||||
}
|
||||
res = slimtable.find(key);
|
||||
}
|
||||
|
||||
@@ -306,6 +306,7 @@ HEADERS += \
|
||||
|
||||
# JGE, could probably be moved outside
|
||||
SOURCES += \
|
||||
../../JGE/src/corewrapper.cpp\
|
||||
../../JGE/src/Encoding.cpp\
|
||||
../../JGE/src/JAnimator.cpp\
|
||||
../../JGE/src/JApp.cpp\
|
||||
@@ -323,9 +324,9 @@ SOURCES += \
|
||||
../../JGE/src/JParticleSystem.cpp\
|
||||
../../JGE/src/JResourceManager.cpp\
|
||||
../../JGE/src/JSpline.cpp\
|
||||
../../JGE/src/JNetwork.cpp\
|
||||
../../JGE/src/pc/JSocket.cpp\
|
||||
../../JGE/src/pc/JSfx.cpp\
|
||||
../../JGE/src/JNetwork.cpp\
|
||||
../../JGE/src/JSprite.cpp\
|
||||
../../JGE/src/Vector2D.cpp\
|
||||
../../JGE/src/tinyxml/tinystr.cpp\
|
||||
@@ -345,14 +346,14 @@ SOURCES += \
|
||||
CONFIG(graphics, graphics|console){
|
||||
SOURCES += \
|
||||
../../JGE/src/qt/filedownloader.cpp\
|
||||
../../JGE/src/qt/corewrapper.cpp\
|
||||
../../JGE/src/qt/qtcorewrapper.cpp\
|
||||
../../JGE/src/Qtmain.cpp\
|
||||
../../JGE/src/JMD2Model.cpp\
|
||||
../../JGE/src/pc/JGfx.cpp
|
||||
|
||||
HEADERS += \
|
||||
../../JGE/include/qt/filedownloader.h\
|
||||
../../JGE/include/qt/corewrapper.h
|
||||
../../JGE/include/qt/qtcorewrapper.h
|
||||
}
|
||||
else:CONFIG(console, graphics|console){
|
||||
SOURCES += \
|
||||
@@ -363,6 +364,7 @@ else:CONFIG(console, graphics|console){
|
||||
|
||||
HEADERS += \
|
||||
../../JGE/include/Threading.h\
|
||||
../../JGE/include/corewrapper.h\
|
||||
../../JGE/include/decoder_prx.h\
|
||||
../../JGE/include/DebugRoutines.h\
|
||||
../../JGE/include/Encoding.h\
|
||||
|
||||
Reference in New Issue
Block a user