Compare commits
184 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af0c423359 | |||
| 45253e0008 | |||
| e32e5c2a47 | |||
| 3a4f9f06cb | |||
| a563030440 | |||
| 80d43896ff | |||
| 1c5949411f | |||
| 699b151939 | |||
| e6af1a08b9 | |||
| 7eac02f8d4 | |||
| 58e70e2500 | |||
| 56ca2021dc | |||
| e4e431dcee | |||
| abfff205ee | |||
| 6416e4e0d9 | |||
| 86f4730db7 | |||
| 33a5479512 | |||
| 891859f4ca | |||
| d5bfb8201b | |||
| f49ef92f90 | |||
| 02d004b5bf | |||
| 55f8a8a1d0 | |||
| 068a69c80b | |||
| 375e66489f | |||
| cbbd034862 | |||
| f7fe948da5 | |||
| 478ce0863b | |||
| 329011460f | |||
| 48ec51a923 | |||
| 9936962c56 | |||
| 15111d1b20 | |||
| 07e6d90c98 | |||
| 85231cda01 | |||
| 8549b7b1b4 | |||
| 9f58ef9916 | |||
| c734ee9fd1 | |||
| 77d87902d9 | |||
| b5c8656ac9 | |||
| 28f6b73da6 | |||
| 521b505543 | |||
| c5a3310103 | |||
| 0c053c713a | |||
| bc06f93aae | |||
| 8e919aeeb1 | |||
| 6bd09e42e0 | |||
| 1f670b9919 | |||
| c805a58fb0 | |||
| 34517004df | |||
| b0506bcd96 | |||
| 7a3a6c04a6 | |||
| 54e4b08e1f | |||
| 67c22c5186 | |||
| 87aba86fa8 | |||
| 28ea300f42 | |||
| 858c26b46a | |||
| 70a6c7149c | |||
| b4a34216c8 | |||
| 2b342ca33b | |||
| 97e6df7f59 | |||
| a2bb67a828 | |||
| d14e28d7b3 | |||
| 0a0ee3cc98 | |||
| 99e6a254e1 | |||
| 68714ebad8 | |||
| 48ef4144bc | |||
| 78a4da4945 | |||
| af0861877a | |||
| a23b96ba75 | |||
| 47704f7591 | |||
| 755f90f38b | |||
| 8a56406c19 | |||
| 887ea94a4d | |||
| 499b3ddf3e | |||
| 83e55b1074 | |||
| 1f87ed77e4 | |||
| 93b7d210dc | |||
| 10d9d84f84 | |||
| fc9a4d5431 | |||
| 4b3a2531a6 | |||
| ed4871548e | |||
| 1284b8da8b | |||
| 95455603a1 | |||
| 813c54a166 | |||
| fa2a2d51a5 | |||
| 4b68b636ce | |||
| 0a01b0af69 | |||
| e4e809f3fe | |||
| 1667b79fa8 | |||
| 31272ff0fe | |||
| 9335063d68 | |||
| 39dfaf3acb | |||
| 3e7ecd51fd | |||
| c9ee4a304e | |||
| 2f1bf7bdbe | |||
| 41890f6bb4 | |||
| 24cd7cab58 | |||
| 473d9387d4 | |||
| f5495adce1 | |||
| d802ec4b59 | |||
| 8f69e2a204 | |||
| c3fc579907 | |||
| cc06370bcd | |||
| ed15ec2469 | |||
| 3f7d5ff041 | |||
| d5bcf40cbb | |||
| 49c196814f | |||
| c4282ce936 | |||
| cd1c09127f | |||
| 9afebe0851 | |||
| 9a7382ea06 | |||
| 7a7e723009 | |||
| 9d772284cc | |||
| a981761deb | |||
| fc13ffa242 | |||
| 878b2cd639 | |||
| 995922d2d7 | |||
| 0d100aa9be | |||
| d4fabed317 | |||
| 9eff781103 | |||
| 0353da3d27 | |||
| 3cbdc6e9fe | |||
| ce71afd704 | |||
| 603d491bed | |||
| 20a792f135 | |||
| 87f5e7f3a6 | |||
| e272925f3d | |||
| 19091ade7b | |||
| e62c065e2c | |||
| 2312381b82 | |||
| 639942d444 | |||
| 55a5b9d0ba | |||
| a33517e5d0 | |||
| c981586bcf | |||
| b473238f02 | |||
| 1d9b92080f | |||
| 7f89d4d39f | |||
| 4f00ec2277 | |||
| 26db10a083 | |||
| 3ec2ceb725 | |||
| 667ac39e06 | |||
| 993d62a8c8 | |||
| 09a70d4573 | |||
| 3afa730751 | |||
| 3245ddbfe7 | |||
| def55943ed | |||
| 4accc9c018 | |||
| 579d612397 | |||
| daabce1d2f | |||
| 5885829585 | |||
| 3e7b9e68d5 | |||
| 4a52139457 | |||
| 79ea403273 | |||
| 397d7fa6c8 | |||
| ac787a6f51 | |||
| 0418e77d34 | |||
| a2c6a3669b | |||
| b8d22240a8 | |||
| b458d570a1 | |||
| 5022df0d14 | |||
| 220b48b144 | |||
| 8aeed46181 | |||
| 38b34eae2f | |||
| 648b21f972 | |||
| 09717a966b | |||
| eef46fe743 | |||
| 5f91566fa7 | |||
| c83a476ebe | |||
| 954bba274c | |||
| d370a5c13d | |||
| 181189bee0 | |||
| c678f5e85a | |||
| 0fabf83c62 | |||
| b7e8d19290 | |||
| d0db71602a | |||
| 112efddb4e | |||
| 4cea81e564 | |||
| 3a40a34566 | |||
| a4ff87a7d5 | |||
| 797077c47b | |||
| 075d950249 | |||
| 22d14b2a4f | |||
| 4272e2e2b2 | |||
| 34279cfacf | |||
| 85f4a4c36a |
@@ -0,0 +1,6 @@
|
||||
[submodule "thirdparty/zlib"]
|
||||
path = thirdparty/zlib
|
||||
url = https://github.com/madler/zlib
|
||||
[submodule "thirdparty/SDL2"]
|
||||
path = thirdparty/SDL2
|
||||
url = https://github.com/spurious/SDL-mirror.git
|
||||
+146
-23
@@ -1,30 +1,153 @@
|
||||
language: objective-c
|
||||
language: cpp
|
||||
branches:
|
||||
except:
|
||||
- latest-master
|
||||
- latest-cmake
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env: BUILD_TYPE=PSP
|
||||
sudo: required
|
||||
- os: linux
|
||||
env: BUILD_TYPE=SDL
|
||||
sudo: required
|
||||
- os: linux
|
||||
env: BUILD_TYPE=Qt
|
||||
sudo: required
|
||||
- os: osx
|
||||
env: BUILD_TYPE=Qt
|
||||
- os: osx
|
||||
env: BUILD_TYPE=iOS
|
||||
- os: linux
|
||||
language: android
|
||||
env: BUILD_TYPE=ANDROID
|
||||
sudo: required
|
||||
- os: osx
|
||||
env: BUILD_TYPE=Emscripten
|
||||
|
||||
android:
|
||||
components:
|
||||
- platform-tools
|
||||
- build-tools-23.0.1
|
||||
- android-10
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- opt/pspsdk
|
||||
- android-ndk-r9
|
||||
|
||||
before_install:
|
||||
- brew update
|
||||
- brew install qt5
|
||||
- sudo pip install pyjavaproperties
|
||||
- sudo pip install github3.py
|
||||
- brew install dpkg ldid
|
||||
#- curl -s -f -L https://raw.github.com/r-plus/dotfiles/master/install_theos.sh | bash
|
||||
- mkdir theos
|
||||
- cd theos
|
||||
- git clone --recursive https://github.com/theos/theos.git
|
||||
- export THEOS="$TRAVIS_BUILD_DIR/theos"
|
||||
- cd ..
|
||||
- pwd
|
||||
- ls
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty universe" &&
|
||||
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty main" &&
|
||||
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test &&
|
||||
sudo apt-get -qq update &&
|
||||
sudo apt-get -qq install g++-4.8 &&
|
||||
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
brew update &&
|
||||
brew install dpkg &&
|
||||
pwd &&
|
||||
ls;
|
||||
fi
|
||||
- if [ "$BUILD_TYPE" == "iOS" ]; then
|
||||
curl -s -f -L https://raw.github.com/r-plus/dotfiles/master/install_theos.sh | bash &&
|
||||
pwd &&
|
||||
ls;
|
||||
fi
|
||||
# Building for PSP here
|
||||
- if [ "$BUILD_TYPE" == "PSP" ]; then
|
||||
export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk" &&
|
||||
export PSPSDK="$PSPDEV/psp/sdk" &&
|
||||
export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin" &&
|
||||
wget -O sdk.lzma https://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpspw_0.11.2-amd64.tar.lzma/download;
|
||||
fi
|
||||
# Building for Android here
|
||||
- if [ "$BUILD_TYPE" == "ANDROID" ]; then
|
||||
export ANDROID="/usr/local/android-sdk-linux/tools/android" &&
|
||||
export PATH=$PATH:"/usr/local/android-sdk-linux/tools" &&
|
||||
wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv &&
|
||||
wget https://bitbucket.org/ewing/sdl_androidcmake/get/4e9e88c03f04.zip -nv;
|
||||
fi
|
||||
# Building for Qt here
|
||||
- if [ "$BUILD_TYPE" == "Qt" ] && [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
brew install qt5 &&
|
||||
export QMAKE="qmake -qt=qt5";
|
||||
fi
|
||||
- if [ "$BUILD_TYPE" == "Qt" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||
sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev qttools5-dev qtmultimedia5-dev pulseaudio libpulse-dev &&
|
||||
export QMAKE="qmake -qt=qt5";
|
||||
fi
|
||||
# Building for SDL here
|
||||
- if [ "$BUILD_TYPE" == "SDL" ]; then
|
||||
export SDL2DIR="$TRAVIS_BUILD_DIR/thirdparty/SDL2";
|
||||
fi
|
||||
# Building for Emscripten here
|
||||
- if [ "$BUILD_TYPE" == "Emscripten" ] && [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
brew install emscripten && export LLVM=/usr/local/opt/emscripten/libexec/llvm/bin && emcc;
|
||||
fi
|
||||
|
||||
install:
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||
if [[ -z "$(ls -A ${DEPS_DIR}/cmake/bin)" ]]; then
|
||||
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
|
||||
mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake
|
||||
fi
|
||||
export PATH="${DEPS_DIR}/cmake/bin:${PATH}"
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
|
||||
fi
|
||||
- if [ "$BUILD_TYPE" == "PSP" ]; then
|
||||
tar -x --xz -f sdk.lzma;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$BUILD_TYPE" == "ANDROID" ]; then
|
||||
jdk_switcher use openjdk7 %%
|
||||
tar --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2 &&
|
||||
export ANDROID_NDK=`pwd`/android-ndk-r9 &&
|
||||
unzip 4e9e88c03f04.zip &&
|
||||
rm -rf thirdparty/SDL2/* &&
|
||||
mv ewing-sdl_androidcmake-4e9e88c03f04/* thirdparty/SDL2/ &&
|
||||
sudo pip install cpp-coveralls &&
|
||||
sudo apt-get install --force-yes -qq libtinyxml-dev libjpeg-dev libpng-dev libgif-dev libz-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev ant;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$BUILD_TYPE" != "ANDROID" ]; then
|
||||
jdk_switcher use openjdk7 &&
|
||||
sudo pip install cpp-coveralls &&
|
||||
sudo apt-get install --force-yes -qq libtinyxml-dev libjpeg-dev libpng-dev libgif-dev libz-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev ant;
|
||||
fi
|
||||
- sudo pip install pyjavaproperties
|
||||
- sudo pip install github3.py
|
||||
|
||||
env:
|
||||
global:
|
||||
secure: "EBzr1+qjQsOhn0s+tcFmXR1jP9B0xiOSXuXbRXWZ1OEHNvp8+A5/pS84LYVFlaZqmxr5dApxvPtwhgLIUbQ3EPXm8LpC3KgSD4dS+9/QMbxhe5TK4oczgFRGcDTMJQZsCzhOh7hp3tbcbJg5Gp+VT7aFjFQSHDGwhzSJXsXwh/8="
|
||||
# - JAVA_HOME=/usr/lib/jvm/java-7-oracle # Force set JVM version to comply with Travis Ant version (1.8.2)
|
||||
- secure: "EBzr1+qjQsOhn0s+tcFmXR1jP9B0xiOSXuXbRXWZ1OEHNvp8+A5/pS84LYVFlaZqmxr5dApxvPtwhgLIUbQ3EPXm8LpC3KgSD4dS+9/QMbxhe5TK4oczgFRGcDTMJQZsCzhOh7hp3tbcbJg5Gp+VT7aFjFQSHDGwhzSJXsXwh/8="
|
||||
- secure: "X5dTQfofqAutnXxmu11Ep2MQ5QYnMN8m0AITRtwymhEF2UclcOudI1+skPtuhAGbWQnSO+lhunV3cvMfw2/Ml3k/VDz6VdFSKFrzAu7ja1VLJfcxr7chi0s8q30pVBb66tGydjIBac3B+RQyqgmZQW1frbRrhC/kPFQ6wPWOJdQ="
|
||||
- secure: "T97NUPnxCpVZ/c5HH0zfo0FO3DPSRMSmze58ubW5EUTZOjAMtEt+OFdsrNZvUTCugUj2M1agtonZbAbczpaAL+lgZcHDgXgWMkfO0pMnsWX1yyCNqMuE/iTMpJr/xsLQeyWlftWjJLsseQU45abZsd1XVmda/G+ZhrDLF1y55SA="
|
||||
|
||||
script:
|
||||
- /usr/local/opt/qt5/bin/qmake projects/mtg/wagic-qt.pro CONFIG+=graphics
|
||||
- make -j 4 dmg
|
||||
- cd projects/mtg/iOS
|
||||
- make -j 4 package
|
||||
- cd ../../..
|
||||
script: "tools/travis-script.sh"
|
||||
|
||||
after_success:
|
||||
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l wagic.dmg -r Wagic-macosx.dmg -b $TRAVIS_BRANCH
|
||||
- python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l projects/mtg/iOS/net.wagic_0.19.2-1_iphoneos-arm.deb -r Wagic-iOS.deb -b $TRAVIS_BRANCH
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$BUILD_TYPE" == "Qt" ]; then
|
||||
coveralls -b . -e JGE/src -e JGE/include -i projects/mtg/include -i projects/mtg/src --gcov-options '\-lp';
|
||||
fi
|
||||
- if [ "$BUILD_TYPE" == "ANDROID" ]; then
|
||||
python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l core.zip -r Wagic-core.zip -b $TRAVIS_BRANCH &&
|
||||
python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l build_android/package/bin/Wagic_*.apk -r Wagic-android.apk -b $TRAVIS_BRANCH;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$BUILD_TYPE" == "PSP" ]; then
|
||||
python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l build_psp/psprelease.zip -r Wagic-psp.zip -b $TRAVIS_BRANCH;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$BUILD_TYPE" == "iOS" ]; then
|
||||
python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l net.wagic_0.19.2-1_iphoneos-arm.deb -r Wagic-iOS.deb -b $TRAVIS_BRANCH;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$BUILD_TYPE" == "Qt" ]; then
|
||||
python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l build_qt_widget/wagic.dmg -r Wagic-macosx.dmg -b $TRAVIS_BRANCH;
|
||||
fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$BUILD_TYPE" == "Emscripten" ]; then
|
||||
./tools/deploy-emscripten.sh;
|
||||
fi
|
||||
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
if(CMAKE_MAJOR_VERSION STRGREATER 3)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules)
|
||||
|
||||
#this block will fix install prefixes to install everything in a subdirectory
|
||||
#of cmake_binary_dir if we are on windows/android to make packaging more easy
|
||||
if(NOT CMAKE_TOOLCHAIN_FILE)
|
||||
if(WIN32)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Install directory")
|
||||
else()
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Install directory")
|
||||
endif()
|
||||
else() #we are cross-compiling (psp/android)
|
||||
#Android: set output folder for platform/android to pick up
|
||||
set(LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "library output root")
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Install directory")
|
||||
endif()
|
||||
|
||||
#set available build types (debug/release)
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
|
||||
if(DEFINED CMAKE_BUILD_TYPE)
|
||||
set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
|
||||
endif()
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Application output directory")
|
||||
|
||||
|
||||
project(wagic CXX C)
|
||||
#todo: somehow determine wagics version
|
||||
set(WAGIC_VERSION "0.19")
|
||||
|
||||
#add standard paths to search for libraries. borrowed from opencv
|
||||
if(UNIX AND NOT ANDROID)
|
||||
if(X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if(EXISTS /lib64)
|
||||
list(APPEND CMAKE_LIBRARY_PATH /lib64)
|
||||
else()
|
||||
list(APPEND CMAKE_LIBRARY_PATH /lib)
|
||||
endif()
|
||||
if(EXISTS /usr/lib64)
|
||||
list(APPEND CMAKE_LIBRARY_PATH /usr/lib64)
|
||||
else()
|
||||
list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
|
||||
endif()
|
||||
elseif(X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
if(EXISTS /lib32)
|
||||
list(APPEND CMAKE_LIBRARY_PATH /lib32)
|
||||
else()
|
||||
list(APPEND CMAKE_LIBRARY_PATH /lib)
|
||||
endif()
|
||||
if(EXISTS /usr/lib32)
|
||||
list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
|
||||
else()
|
||||
list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID OR PSP OR IOS)
|
||||
#to allow finding of pathes/headers/libs within the source tree
|
||||
#even if only search for target platform libs
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_FIND_ROOT_PATH})
|
||||
endif()
|
||||
|
||||
#also borrowed from opencv
|
||||
if(MINGW)
|
||||
if(EXISTS /mingw)
|
||||
list(APPEND CMAKE_INCLUDE_PATH /mingw)
|
||||
endif()
|
||||
if(EXISTS /mingw32)
|
||||
list(APPEND CMAKE_INCLUDE_PATH /mingw32)
|
||||
endif()
|
||||
if(EXISTS /mingw64)
|
||||
list(APPEND CMAKE_INCLUDE_PATH /mingw64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(utils)
|
||||
|
||||
#select the target backend
|
||||
if(PSP)
|
||||
WAGIC_OPTION(backend_psp "build for psp" ON)
|
||||
endif()
|
||||
if(WIN32 OR ANDROID OR UNIX)
|
||||
WAGIC_OPTION(backend_sdl "build for sdl" (WIN32 OR ANDROID OR EMSCRIPTEN))
|
||||
endif()
|
||||
if(NOT backend_sdl AND UNIX AND NOT ANDROID AND NOT IOS)
|
||||
WAGIC_OPTION(backend_qt_console "build qt-console version with testsuit" ON)
|
||||
WAGIC_OPTION(backend_qt_widget "build qt-widget version" OFF)
|
||||
endif()
|
||||
|
||||
#third party build options
|
||||
WAGIC_OPTION(BUILD_ZLIB "build zlib from source" WIN32 OR APPLE)
|
||||
WAGIC_OPTION(BUILD_JPEG "build jpeg from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN))
|
||||
WAGIC_OPTION(BUILD_PNG "build png from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN))
|
||||
WAGIC_OPTION(BUILD_UNZIP "build unzip from source" ON)
|
||||
WAGIC_OPTION(BUILD_TINYXML "build tinyxml from source" (WIN32 OR APPLE OR PSP OR ANDROID OR EMSCRIPTEN OR IOS))
|
||||
WAGIC_OPTION(BUILD_ZIPFS "build zipfs from source" ON)
|
||||
WAGIC_OPTION(BUILD_SDL2 "build SDL2 from source" (backend_sdl AND (UNIX OR WIN32 OR ANDROID) AND (NOT EMSCRIPTEN AND NOT IOS)))
|
||||
|
||||
#project options
|
||||
if(ANDROID)
|
||||
WAGIC_OPTION(BUILD_ANDROID_PACKAGE "put the compiled code in an android package" ON)
|
||||
endif()
|
||||
|
||||
|
||||
if(ANDROID)
|
||||
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
|
||||
set(3P_LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
|
||||
set(WAGIC_LIB_INSTALL_PATH sdk/native/libs/${ANDROID_NDK_ABI_NAME})
|
||||
set(WAGIC_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME})
|
||||
set(WAGIC_CONFIG_INSTALL_PATH sdk/native/jni)
|
||||
set(WAGIC_INCLUDE_INSTALL_PATH sdk/native/jni/include)
|
||||
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/package/bin")
|
||||
else()
|
||||
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
|
||||
set(3P_LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
|
||||
set(WAGIC_LIB_INSTALL_PATH lib${LIB_SUFFIX})
|
||||
set(WAGIC_3P_LIB_INSTALL_PATH share/wagic/3rdparty/${WAGIC_LIB_INSTALL_PATH})
|
||||
set(WAGIC_INCLUDE_INSTALL_PATH "include")
|
||||
set(WAGIC_CONFIG_INSTALL_PATH share/wagic)
|
||||
endif()
|
||||
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${WAGIC_LIB_INSTALL_PATH}")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
#if no build type is specified, we assume debug
|
||||
if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja" AND "${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
|
||||
include(FindOrBuild)
|
||||
|
||||
#set platform dependend configurations
|
||||
if(PSP)
|
||||
FindOrBuildPSPSDK()
|
||||
include(platforms/psp/configure.cmake)
|
||||
elseif(EMSCRIPTEN)
|
||||
include(platforms/emscripten/configure.cmake)
|
||||
elseif(WIN32)
|
||||
include(platforms/win/configure.cmake)
|
||||
elseif(APPLE)
|
||||
include(platforms/macosx/configure.cmake)
|
||||
elseif(UNIX AND NOT ANDROID)
|
||||
include(platforms/unix/configure.cmake)
|
||||
elseif(ANDROID)
|
||||
include(platforms/android/configure.cmake)
|
||||
endif()
|
||||
|
||||
#set backend dependend configurations
|
||||
if(backend_qt_console OR backend_qt_widget)
|
||||
add_definitions(-DQT_CONFIG)
|
||||
if(backend_qt_console)
|
||||
add_definitions(-DTESTSUITE -D_DEBUG)
|
||||
add_definitions(-DCONSOLE_CONFIG -DCAPTURE_STDERR)
|
||||
endif()
|
||||
elseif(backend_sdl)
|
||||
add_definitions(-DSDL_CONFIG)
|
||||
endif()
|
||||
|
||||
# find or build 3rd party libraries
|
||||
FindOrBuildZLIB()
|
||||
FindOrBuildOpenGL()
|
||||
FindOrBuildTinyXML()
|
||||
FindOrBuildZipFS()
|
||||
FindOrBuildUNZIP()
|
||||
FindOrBuildPNG()
|
||||
FindOrBuildJPEG()
|
||||
FindOrBuildBoost()
|
||||
if(PSP)
|
||||
FindOrBuildGIF()
|
||||
endif()
|
||||
if(ANDROID)
|
||||
FindOrBuildOpenSL()
|
||||
endif()
|
||||
if(backend_sdl)
|
||||
FindOrBuildSDL2()
|
||||
endif()
|
||||
if(backend_psp)
|
||||
FindOrBuildFreetype()
|
||||
FindOrBuildHgeTools()
|
||||
FindOrBuildMikMod()
|
||||
endif()
|
||||
if(backend_qt_console OR backend_qt_widget)
|
||||
FindOrBuildQt()
|
||||
endif()
|
||||
if(ANDROID)
|
||||
include(DetectAndroidSDK)
|
||||
endif()
|
||||
|
||||
if(BUILD_ANDROID_PACKAGE)
|
||||
find_package(Ant REQUIRED)
|
||||
endif()
|
||||
|
||||
#add jge and mtg projects
|
||||
add_subdirectory(JGE)
|
||||
add_subdirectory(projects/mtg)
|
||||
|
||||
if(BUILD_ANDROID_PACKAGE)
|
||||
add_subdirectory(platforms/android/package)
|
||||
endif()
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
list_add_prefix(JGE_SOURCES " JGE/")
|
||||
list_add_prefix(MTG_generic_src " projects/mtg/")
|
||||
list_add_prefix(JGE_INCLUDE_DIRS " -IJGE/")
|
||||
list_add_prefix(MTG_INCLUDE_DIRS " -Iprojects/mtg/")
|
||||
list_add_prefix(TINYXML_SRC " thirdparty/tinyxml/")
|
||||
list_add_prefix(UNZIP_SRC " thirdparty/unzip/")
|
||||
list_add_prefix(ZIPFS_SRC " thirdparty/zipFS/")
|
||||
|
||||
file(WRITE makefile.ios
|
||||
"ARCHS= armv7 armv7s \n"
|
||||
"include ${THEOS_PATH}/makefiles/common.mk\n"
|
||||
"TARGET= iphone:clang:latest:8.0 \n"
|
||||
"APPLICATION_NAME = " ${PROJECT_NAME} "\n"
|
||||
${PROJECT_NAME} "_FILES =" ${ZIPFS_SRC} ${UNZIP_SRC} ${TINYXML_SRC} ${JGE_SOURCES} ${MTG_generic_src} " thirdparty/Boost/lib/pthread/once.cpp thirdparty/Boost/lib/pthread/thread.cpp\n"
|
||||
${PROJECT_NAME} "_LDFLAGS = -lz\n"
|
||||
${PROJECT_NAME} "_FRAMEWORKS = UIKit CoreGraphics OpenGLES Foundation CFNetwork MobileCoreServices AVFoundation OpenAL AudioToolbox QuartzCore SystemConfiguration\n"
|
||||
"include ${THEOS_PATH}/makefiles/application.mk\n"
|
||||
"ADDITIONAL_CFLAGS = " ${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} " -I" ${ZIPFS_INCLUDE_DIR} " -I" ${UNZIP_INCLUDE_DIR} " -I" ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} " -I" ${ZLIB_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} " "
|
||||
"-DIOS -D__arm__ -DTIXML_USE_STL -DVERSION=\"$(GIT_VERSION)\" "
|
||||
"-Wno-parentheses-equality -Wno-delete-non-virtual-dtor "
|
||||
"-Wno-tautological-undefined-compare -Wno-undefined-bool-conversion "
|
||||
"-Wno-visibility -Wno-deprecated-declarations -Wno-non-literal-null-conversion "
|
||||
"-Wno-format -Wno-distributed-object-modifiers -Wno-missing-braces -Wno-uninitialized "
|
||||
"-Wno-unused-const-variable -Wno-unused-function -Wno-unknown-warning-option -Wno-unused-local-typedef "
|
||||
"-x objective-c++ \n"
|
||||
|
||||
"_THEOS_TARGET_ONLY_OBJCFLAGS :=\"\"\n"
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,373 @@
|
||||
if(EXISTS "${ANDROID_EXECUTABLE}")
|
||||
set(ANDROID_SDK_DETECT_QUIET TRUE)
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
|
||||
file(TO_CMAKE_PATH "$ENV{HOME}" HOME_ENV_PATH)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(ANDROID_SDK_OS windows)
|
||||
elseif(CMAKE_HOST_APPLE)
|
||||
set(ANDROID_SDK_OS macosx)
|
||||
else()
|
||||
set(ANDROID_SDK_OS linux)
|
||||
endif()
|
||||
|
||||
#find android SDK: search in ANDROID_SDK first
|
||||
find_host_program(ANDROID_EXECUTABLE
|
||||
NAMES android.bat android
|
||||
PATH_SUFFIXES tools
|
||||
PATHS
|
||||
ENV ANDROID_SDK
|
||||
DOC "Android SDK location"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# Now search default paths
|
||||
find_host_program(ANDROID_EXECUTABLE
|
||||
NAMES android.bat android
|
||||
PATH_SUFFIXES android-sdk-${ANDROID_SDK_OS}/tools
|
||||
android-sdk-${ANDROID_SDK_OS}_x86/tools
|
||||
android-sdk-${ANDROID_SDK_OS}_86/tools
|
||||
android-sdk/tools
|
||||
PATHS /opt
|
||||
"${HOME_ENV_PATH}/NVPACK"
|
||||
"$ENV{SystemDrive}/NVPACK"
|
||||
"${ProgramFiles_ENV_PATH}/Android"
|
||||
DOC "Android SDK location"
|
||||
)
|
||||
|
||||
if(ANDROID_EXECUTABLE)
|
||||
if(NOT ANDROID_SDK_DETECT_QUIET)
|
||||
message(STATUS "Found android tool: ${ANDROID_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
get_filename_component(ANDROID_SDK_TOOLS_PATH "${ANDROID_EXECUTABLE}" PATH)
|
||||
|
||||
#read source.properties
|
||||
if(EXISTS "${ANDROID_SDK_TOOLS_PATH}/source.properties")
|
||||
file(STRINGS "${ANDROID_SDK_TOOLS_PATH}/source.properties" ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES REGEX "^[ ]*[^#].*$")
|
||||
foreach(line ${ANDROID_SDK_TOOLS_SOURCE_PROPERTIES_LINES})
|
||||
string(REPLACE "\\:" ":" line ${line})
|
||||
string(REPLACE "=" ";" line ${line})
|
||||
list(GET line 0 line_name)
|
||||
list(GET line 1 line_value)
|
||||
string(REPLACE "." "_" line_name ${line_name})
|
||||
SET(ANDROID_TOOLS_${line_name} "${line_value}" CACHE INTERNAL "from ${ANDROID_SDK_TOOLS_PATH}/source.properties")
|
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_${line_name})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
#fix missing revision (SDK tools before r9 don't set revision number correctly)
|
||||
if(NOT ANDROID_TOOLS_Pkg_Revision)
|
||||
SET(ANDROID_TOOLS_Pkg_Revision "Unknown" CACHE INTERNAL "")
|
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Revision)
|
||||
endif()
|
||||
|
||||
#fix missing description
|
||||
if(NOT ANDROID_TOOLS_Pkg_Desc)
|
||||
SET(ANDROID_TOOLS_Pkg_Desc "Android SDK Tools, revision ${ANDROID_TOOLS_Pkg_Revision}." CACHE INTERNAL "")
|
||||
MARK_AS_ADVANCED(ANDROID_TOOLS_Pkg_Desc)
|
||||
endif()
|
||||
|
||||
#warn about outdated SDK
|
||||
if(NOT ANDROID_TOOLS_Pkg_Revision GREATER 13)
|
||||
SET(ANDROID_TOOLS_Pkg_Desc "${ANDROID_TOOLS_Pkg_Desc} It is recommended to update your SDK tools to revision 14 or newer." CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
if(ANDROID_TOOLS_Pkg_Revision GREATER 13)
|
||||
SET(ANDROID_PROJECT_PROPERTIES_FILE project.properties)
|
||||
SET(ANDROID_ANT_PROPERTIES_FILE ant.properties)
|
||||
else()
|
||||
SET(ANDROID_PROJECT_PROPERTIES_FILE default.properties)
|
||||
SET(ANDROID_ANT_PROPERTIES_FILE build.properties)
|
||||
endif()
|
||||
|
||||
set(ANDROID_MANIFEST_FILE AndroidManifest.xml)
|
||||
set(ANDROID_LIB_PROJECT_FILES build.xml local.properties proguard-project.txt ${ANDROID_PROJECT_PROPERTIES_FILE})
|
||||
set(ANDROID_PROJECT_FILES ${ANDROID_LIB_PROJECT_FILES})
|
||||
|
||||
#get installed targets
|
||||
if(ANDROID_TOOLS_Pkg_Revision GREATER 11)
|
||||
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target -c
|
||||
RESULT_VARIABLE ANDROID_PROCESS
|
||||
OUTPUT_VARIABLE ANDROID_SDK_TARGETS
|
||||
ERROR_VARIABLE ANDROID_PROCESS_ERRORS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCHALL "[^\n]+" ANDROID_SDK_TARGETS "${ANDROID_SDK_TARGETS}")
|
||||
else()
|
||||
#old SDKs (r11 and older) don't provide compact list
|
||||
execute_process(COMMAND ${ANDROID_EXECUTABLE} list target
|
||||
RESULT_VARIABLE ANDROID_PROCESS
|
||||
OUTPUT_VARIABLE ANDROID_SDK_TARGETS_FULL
|
||||
ERROR_VARIABLE ANDROID_PROCESS_ERRORS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCHALL "(^|\n)id: [0-9]+ or \"([^\n]+[0-9+])\"(\n|$)" ANDROID_SDK_TARGETS_FULL "${ANDROID_SDK_TARGETS_FULL}")
|
||||
|
||||
SET(ANDROID_SDK_TARGETS "")
|
||||
if(ANDROID_PROCESS EQUAL 0)
|
||||
foreach(line ${ANDROID_SDK_TARGETS_FULL})
|
||||
string(REGEX REPLACE "(^|\n)id: [0-9]+ or \"([^\n]+[0-9+])\"(\n|$)" "\\2" line "${line}")
|
||||
list(APPEND ANDROID_SDK_TARGETS "${line}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID_PROCESS EQUAL 0)
|
||||
message(ERROR "Failed to get list of installed Android targets.")
|
||||
set(ANDROID_EXECUTABLE "ANDROID_EXECUTABLE-NOTFOUND")
|
||||
endif()
|
||||
|
||||
# clear ANDROID_SDK_TARGET if no target is provided by user
|
||||
if(NOT ANDROID_SDK_TARGET)
|
||||
set(ANDROID_SDK_TARGET "" CACHE STRING "Android SDK target for the Wagic Java API and samples")
|
||||
endif()
|
||||
if(ANDROID_SDK_TARGETS)
|
||||
set_property( CACHE ANDROID_SDK_TARGET PROPERTY STRINGS ${ANDROID_SDK_TARGETS} )
|
||||
endif()
|
||||
endif(ANDROID_EXECUTABLE)
|
||||
|
||||
# finds minimal installed SDK target compatible with provided names or API levels
|
||||
# usage:
|
||||
# get_compatible_android_api_level(VARIABLE [level1] [level2] ...)
|
||||
macro(android_get_compatible_target VAR)
|
||||
set(${VAR} "${VAR}-NOTFOUND")
|
||||
if(ANDROID_SDK_TARGETS)
|
||||
list(GET ANDROID_SDK_TARGETS 0 __lvl)
|
||||
string(REGEX MATCH "[0-9]+$" __lvl "${__lvl}")
|
||||
|
||||
#find minimal level mathing to all provided levels
|
||||
foreach(lvl ${ARGN})
|
||||
string(REGEX MATCH "[0-9]+$" __level "${lvl}")
|
||||
if(__level GREATER __lvl)
|
||||
set(__lvl ${__level})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#search for compatible levels
|
||||
foreach(lvl ${ANDROID_SDK_TARGETS})
|
||||
string(REGEX MATCH "[0-9]+$" __level "${lvl}")
|
||||
if(__level EQUAL __lvl)
|
||||
#look for exact match
|
||||
foreach(usrlvl ${ARGN})
|
||||
if("${usrlvl}" STREQUAL "${lvl}")
|
||||
set(${VAR} "${lvl}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if("${${VAR}}" STREQUAL "${lvl}")
|
||||
break() #exact match was found
|
||||
elseif(NOT ${VAR})
|
||||
set(${VAR} "${lvl}")
|
||||
endif()
|
||||
elseif(__level GREATER __lvl)
|
||||
if(NOT ${VAR})
|
||||
set(${VAR} "${lvl}")
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(__lvl)
|
||||
unset(__level)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
unset(__android_project_chain CACHE)
|
||||
|
||||
# add_android_project(target_name ${path} NATIVE_DEPS opencv_core LIBRARY_DEPS ${Wagic_BINARY_DIR} SDK_TARGET 11)
|
||||
macro(add_android_project target path)
|
||||
# parse arguments
|
||||
set(android_proj_arglist NATIVE_DEPS LIBRARY_DEPS SDK_TARGET IGNORE_JAVA IGNORE_MANIFEST)
|
||||
set(__varname "android_proj_")
|
||||
foreach(v ${android_proj_arglist})
|
||||
set(${__varname}${v} "")
|
||||
endforeach()
|
||||
foreach(arg ${ARGN})
|
||||
set(__var "${__varname}")
|
||||
foreach(v ${android_proj_arglist})
|
||||
if("${v}" STREQUAL "${arg}")
|
||||
set(__varname "android_proj_${v}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(__var STREQUAL __varname)
|
||||
list(APPEND ${__var} "${arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# get compatible SDK target
|
||||
android_get_compatible_target(android_proj_sdk_target ${ANDROID_NATIVE_API_LEVEL} ${android_proj_SDK_TARGET})
|
||||
|
||||
if(NOT android_proj_sdk_target)
|
||||
message(WARNING "Can not find any SDK target compatible with: ${ANDROID_NATIVE_API_LEVEL} ${android_proj_SDK_TARGET}
|
||||
The project ${target} will not be build")
|
||||
endif()
|
||||
|
||||
# check native dependencies
|
||||
if(android_proj_IGNORE_JAVA)
|
||||
ocv_check_dependencies(${android_proj_NATIVE_DEPS})
|
||||
else()
|
||||
ocv_check_dependencies(${android_proj_NATIVE_DEPS} opencv_java)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${path}/jni/Android.mk" )
|
||||
# find if native_app_glue is used
|
||||
file(STRINGS "${path}/jni/Android.mk" NATIVE_APP_GLUE REGEX ".*(call import-module,android/native_app_glue)" )
|
||||
if(NATIVE_APP_GLUE)
|
||||
if(ANDROID_NATIVE_API_LEVEL LESS 9 OR NOT EXISTS "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
set(OCV_DEPENDENCIES_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OCV_DEPENDENCIES_FOUND AND android_proj_sdk_target AND ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND ANDROID_TOOLS_Pkg_Revision GREATER 13 AND EXISTS "${path}/${ANDROID_MANIFEST_FILE}")
|
||||
|
||||
project(${target})
|
||||
set(android_proj_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
|
||||
|
||||
# get project sources
|
||||
file(GLOB_RECURSE android_proj_files RELATIVE "${path}" "${path}/res/*" "${path}/src/*")
|
||||
|
||||
if(NOT android_proj_IGNORE_MANIFEST)
|
||||
list(APPEND android_proj_files ${ANDROID_MANIFEST_FILE})
|
||||
endif()
|
||||
|
||||
# copy sources out from the build tree
|
||||
set(android_proj_file_deps "")
|
||||
foreach(f ${android_proj_files})
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/${f}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${path}/${f}" "${android_proj_bin_dir}/${f}"
|
||||
MAIN_DEPENDENCY "${path}/${f}"
|
||||
COMMENT "Copying ${f}")
|
||||
list(APPEND android_proj_file_deps "${path}/${f}" "${android_proj_bin_dir}/${f}")
|
||||
endforeach()
|
||||
|
||||
set(android_proj_lib_deps_commands "")
|
||||
set(android_proj_target_files ${ANDROID_PROJECT_FILES})
|
||||
ocv_list_add_prefix(android_proj_target_files "${android_proj_bin_dir}/")
|
||||
|
||||
# process Android library dependencies
|
||||
foreach(dep ${android_proj_LIBRARY_DEPS})
|
||||
file(RELATIVE_PATH __dep "${android_proj_bin_dir}" "${dep}")
|
||||
list(APPEND android_proj_lib_deps_commands
|
||||
COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${android_proj_bin_dir}" --library "${__dep}")
|
||||
endforeach()
|
||||
|
||||
# fix Android project
|
||||
add_custom_command(
|
||||
OUTPUT ${android_proj_target_files}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${android_proj_target_files}
|
||||
COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${android_proj_bin_dir}" --target "${android_proj_sdk_target}" --name "${target}"
|
||||
${android_proj_lib_deps_commands}
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
DEPENDS "${path}/${ANDROID_MANIFEST_FILE}"
|
||||
COMMENT "Updating Android project at ${path}. SDK target: ${android_proj_sdk_target}"
|
||||
)
|
||||
|
||||
list(APPEND android_proj_file_deps ${android_proj_target_files})
|
||||
|
||||
# build native part
|
||||
file(GLOB_RECURSE android_proj_jni_files "${path}/jni/*.c" "${path}/jni/*.h" "${path}/jni/*.cpp" "${path}/jni/*.hpp")
|
||||
ocv_list_filterout(android_proj_jni_files "\\\\.svn")
|
||||
|
||||
if(android_proj_jni_files AND EXISTS ${path}/jni/Android.mk AND NOT DEFINED JNI_LIB_NAME)
|
||||
# find local module name in Android.mk file to build native lib
|
||||
file(STRINGS "${path}/jni/Android.mk" JNI_LIB_NAME REGEX "LOCAL_MODULE[ ]*:=[ ]*.*" )
|
||||
string(REGEX REPLACE "LOCAL_MODULE[ ]*:=[ ]*([a-zA-Z_][a-zA-Z_0-9]*)[ ]*" "\\1" JNI_LIB_NAME "${JNI_LIB_NAME}")
|
||||
|
||||
if(JNI_LIB_NAME)
|
||||
ocv_include_modules_recurse(${android_proj_NATIVE_DEPS})
|
||||
ocv_include_directories("${path}/jni")
|
||||
|
||||
if(NATIVE_APP_GLUE)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes)
|
||||
set(android_proj_NATIVE_DEPS ${android_proj_NATIVE_DEPS} android)
|
||||
endif()
|
||||
|
||||
add_library(${JNI_LIB_NAME} MODULE ${android_proj_jni_files})
|
||||
target_link_libraries(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
|
||||
|
||||
set_target_properties(${JNI_LIB_NAME} PROPERTIES
|
||||
OUTPUT_NAME "${JNI_LIB_NAME}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}"
|
||||
)
|
||||
|
||||
get_target_property(android_proj_jni_location "${JNI_LIB_NAME}" LOCATION)
|
||||
if (NOT (CMAKE_BUILD_TYPE MATCHES "debug"))
|
||||
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${android_proj_jni_location}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# build java part
|
||||
if(android_proj_IGNORE_JAVA)
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
|
||||
WORKING_DIRECTORY "${android_proj_bin_dir}"
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
|
||||
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
|
||||
WORKING_DIRECTORY "${android_proj_bin_dir}"
|
||||
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
|
||||
DEPENDS "${Wagic_BINARY_DIR}/bin/classes.jar.dephelper" opencv_java # as we are part of Wagic we can just force this dependency
|
||||
DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
|
||||
endif()
|
||||
|
||||
unset(JNI_LIB_NAME)
|
||||
|
||||
add_custom_target(${target} ALL SOURCES "${android_proj_bin_dir}/bin/${target}-debug.apk" )
|
||||
if(NOT android_proj_IGNORE_JAVA)
|
||||
add_dependencies(${target} opencv_java)
|
||||
endif()
|
||||
if(android_proj_native_deps)
|
||||
add_dependencies(${target} ${android_proj_native_deps})
|
||||
endif()
|
||||
|
||||
if(__android_project_chain)
|
||||
add_dependencies(${target} ${__android_project_chain})
|
||||
endif()
|
||||
set(__android_project_chain ${target} CACHE INTERNAL "auxiliary variable used for Android progects chaining")
|
||||
|
||||
# put the final .apk to the Wagic's bin folder
|
||||
add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${android_proj_bin_dir}/bin/${target}-debug.apk" "${Wagic_BINARY_DIR}/bin/${target}.apk")
|
||||
if(INSTALL_ANDROID_EXAMPLES AND "${target}" MATCHES "^example-")
|
||||
#apk
|
||||
install(FILES "${Wagic_BINARY_DIR}/bin/${target}.apk" DESTINATION "samples" COMPONENT main)
|
||||
get_filename_component(sample_dir "${path}" NAME)
|
||||
#java part
|
||||
list(REMOVE_ITEM android_proj_files ${ANDROID_MANIFEST_FILE})
|
||||
foreach(f ${android_proj_files} ${ANDROID_MANIFEST_FILE})
|
||||
get_filename_component(install_subdir "${f}" PATH)
|
||||
install(FILES "${android_proj_bin_dir}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT main)
|
||||
endforeach()
|
||||
#jni part + eclipse files
|
||||
file(GLOB_RECURSE jni_files RELATIVE "${path}" "${path}/jni/*" "${path}/.cproject")
|
||||
ocv_list_filterout(jni_files "\\\\.svn")
|
||||
foreach(f ${jni_files} ".classpath" ".project" ".settings/org.eclipse.jdt.core.prefs")
|
||||
get_filename_component(install_subdir "${f}" PATH)
|
||||
install(FILES "${path}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT main)
|
||||
endforeach()
|
||||
#update proj
|
||||
if(android_proj_lib_deps_commands)
|
||||
set(inst_lib_opt " --library ../../sdk/java")
|
||||
endif()
|
||||
install(CODE "EXECUTE_PROCESS(COMMAND ${ANDROID_EXECUTABLE} --silent update project --path . --target \"${android_proj_sdk_target}\" --name \"${target}\" ${inst_lib_opt}
|
||||
WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}\"
|
||||
)" COMPONENT main)
|
||||
#empty 'gen'
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/gen\")" COMPONENT main)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -0,0 +1,13 @@
|
||||
find_host_program(ANT_EXECUTABLE "ant")
|
||||
|
||||
if(ANT_EXECUTABLE)
|
||||
set(ANT_FOUND ON)
|
||||
else()
|
||||
set(ANT_FOUND OFF)
|
||||
endif()
|
||||
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ANT REQUIRED_VARS ANT_EXECUTABLE)
|
||||
mark_as_advanced(ANT_EXECUTABLE ANT_FOUND)
|
||||
@@ -0,0 +1,29 @@
|
||||
# - Find OpenSL (actually OpenSLES)
|
||||
# Find the OpenSLES includes and libraries
|
||||
#
|
||||
# OPENSL_INCLUDE_DIR - where to find dsound.h
|
||||
# OPENSL_LIBRARIES - List of libraries when using dsound.
|
||||
# OPENSL_FOUND - True if dsound found.
|
||||
|
||||
if(OPENSL_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(OPENSL_FIND_QUIETLY TRUE)
|
||||
endif(OPENSL_INCLUDE_DIR)
|
||||
|
||||
find_path(OPENSL_INCLUDE_DIR SLES/OpenSLES.h)
|
||||
|
||||
find_library(OPENSL_LIBRARY NAMES OpenSLES)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set OPENSL_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(OPENSL DEFAULT_MSG
|
||||
OPENSL_INCLUDE_DIR OPENSL_LIBRARY)
|
||||
|
||||
if(OPENSL_FOUND)
|
||||
set(OPENSL_LIBRARIES ${OPENSL_LIBRARY})
|
||||
else(OPENSL_FOUND)
|
||||
set(OPENSL_LIBRARIES)
|
||||
endif(OPENSL_FOUND)
|
||||
|
||||
mark_as_advanced(OPENSL_INCLUDE_DIR OPENSL_LIBRARY)
|
||||
@@ -0,0 +1,231 @@
|
||||
macro(FindOrBuildZipFS)
|
||||
if(BUILD_ZIPFS)
|
||||
add_subdirectory(
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/zipFS
|
||||
${CMAKE_BINARY_DIR}/thirdparty/zipFS)
|
||||
set(ZIPFS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/zipFS)
|
||||
set(ZIPFS_LIBRARY zipFS)
|
||||
else()
|
||||
message(WARNING "ZIPFS must get build")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildTinyXML)
|
||||
if(BUILD_TINYXML)
|
||||
add_definitions(-DTIXML_USE_STL)
|
||||
add_subdirectory(
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/tinyxml
|
||||
${CMAKE_BINARY_DIR}/thirdparty/tinyxml)
|
||||
set(TINYXML_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/tinyxml)
|
||||
set(TINYXML_LIBRARIES tinyxml)
|
||||
else()
|
||||
find_package(TinyXML REQUIRED)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildSDL2)
|
||||
if(BUILD_SDL2)
|
||||
if(WIN32)
|
||||
#SDL2 DirectX build is somehow broken...
|
||||
set(SDL_AUDIO FALSE)
|
||||
set(SDL_JOYSTICK FALSE)
|
||||
set(SDL_HAPTIC FALSE)
|
||||
set(SDL_SHARED FALSE)
|
||||
endif()
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/SDL2)
|
||||
set(SDL2_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/SDL2/include ${CMAKE_BINARY_DIR}/thirdparty/SDL2)
|
||||
if(EMSCRIPTEN)
|
||||
set(SDL2_LIBRARY SDL2-static)
|
||||
else()
|
||||
set(SDL2_LIBRARY SDL2)
|
||||
endif()
|
||||
elseif(NOT EMSCRIPTEN)
|
||||
find_package(SDL2)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildUNZIP)
|
||||
if(BUILD_UNZIP)
|
||||
add_subdirectory(
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/unzip
|
||||
${CMAKE_BINARY_DIR}/thirdparty/unzip)
|
||||
set(UNZIP_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/unzip)
|
||||
set(UNZIP_LIBRARY unzip)
|
||||
else()
|
||||
message(WARNING "UNZIP must get build")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildBoost)
|
||||
if(PSP OR UNIX OR WIN32 OR IOS)
|
||||
#the psp build does not need more than a few headers
|
||||
#todo: remove from the repository
|
||||
set(BOOST_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/Boost)
|
||||
# elseif(WIN32)
|
||||
#set BOOST_ROOT to the root of boost
|
||||
# set(Boost_USE_STATIC_LIBS ON)
|
||||
# set(Boost_USE_MULTITHREADED ON)
|
||||
# set(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
|
||||
# set(BOOST_LIBRARYDIR ${BOOST_ROOT}/libs)
|
||||
# set(BOOST_INCLUDEDIR ${BOOST_ROOT})
|
||||
|
||||
# find_package(Boost COMPONENTS system thread date_time REQUIRED)
|
||||
# if(NOT Boost_FOUND)
|
||||
# message("Set the BOOST_ROOT environment variable to point to your boost installation.")
|
||||
# message("We need system thread and date_time compiled static libs")
|
||||
# message("These libs are compiler specific.")
|
||||
# endif()
|
||||
# elseif(UNIX AND NOT ANDROID)
|
||||
# find_package(Boost COMPONENTS system thread date_time REQUIRED)
|
||||
elseif(ANDROID)
|
||||
#this is a hack. we compile a few boost libds directly into
|
||||
#the application. we should require static libs for android
|
||||
#to be available. maybe we could add the build option to
|
||||
#download and build a compatible boost version
|
||||
find_path(BOOST_INCLUDE_DIRS NAMES bind.hpp HINTS $ENV{ANDROID_BOOST_ROOT} PATH_SUFFIXES boost)
|
||||
|
||||
if(BOOST_INCLUDE_DIRS)
|
||||
get_filename_component(BOOST_INCLUDE_DIRS ${BOOST_INCLUDE_DIRS} PATH)
|
||||
set(ANDROID_BOOST_PTHREAD_SRC_DIR ${BOOST_INCLUDE_DIRS}/libs/thread/src/pthread)
|
||||
set(ANDROID_BOOST_SYSTEM_SRC_DIR ${BOOST_INCLUDE_DIRS}/libs/system/src/)
|
||||
else()
|
||||
message(SEND_ERROR "We require a few boost sources to get compiled into wagic. Please point the ANDROID_BOOST_ROOT environment variable to a boost-source copy root.")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(FindOrBuildZLIB)
|
||||
if(BUILD_ZLIB)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib)
|
||||
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
|
||||
set(ZLIB_LIBRARIES zlib)
|
||||
else()
|
||||
if(WIN32)
|
||||
set(ZLIB_ROOT ${CMAKE_SOURCE_DIR}/thirdparty/binary/win)
|
||||
find_package(ZLIB)
|
||||
else()
|
||||
if(backend_qt_console OR backend_qt_widget OR EMSCRIPTEN)
|
||||
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib)
|
||||
else()
|
||||
find_package(ZLIB)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildGIF)
|
||||
if(BUILD_GIF)
|
||||
message(WARNING "GIF sources are currently not included within the wagic tree")
|
||||
else()
|
||||
if(PSP)
|
||||
find_package(GIF)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildJPEG)
|
||||
if(BUILD_JPEG)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/libjpeg ${CMAKE_BINARY_DIR}/thirdparty/libjpeg)
|
||||
set(JPEG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/libjpeg)
|
||||
set(JPEG_LIBRARY jpeg)
|
||||
else()
|
||||
if(WIN32)
|
||||
#findJPEG does currently not provide prefix vars to guide it
|
||||
find_path(JPEG_INCLUDE_DIR jpeglib.h HINTS ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
|
||||
find_library(JPEG_LIBRARY NAMES libjpeg-static-mt HINTS ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/lib)
|
||||
|
||||
if(JPEG_INCLUDE_DIR AND JPEG_LIBRARY)
|
||||
set(JPEG_FOUND ON)
|
||||
mark_as_advanced(JPEG_INCLUDE_DIR JPEG_LIBRARY)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find JPEG on windows")
|
||||
endif()
|
||||
else()
|
||||
find_package(JPEG)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildPNG)
|
||||
if(BUILD_PNG)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/libpng ${CMAKE_BINARY_DIR}/thirdparty/libpng)
|
||||
set(PNG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/libpng)
|
||||
# find_path(PNG_INCLUDE_DIRS NAMES png.h HINTS ${CMAKE_SOURCE_DIR}/thirdparty/libpng)
|
||||
set(PNG_LIBRARIES png)
|
||||
else()
|
||||
if(WIN32)
|
||||
#findPNG does currently not provide prefix vars. so we find
|
||||
find_path(PNG_INCLUDE_DIRS png.h HINTS ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
|
||||
find_library(PNG_LIBRARIES libpng HINTS ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/lib)
|
||||
|
||||
if (PNG_LIBRARIES AND PNG_INCLUDE_DIRS)
|
||||
set(PNG_FOUND ON)
|
||||
mark_as_advanced(PNG_INCLUDE_DIRS PNG_LIBRARIES)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find PNG on windows")
|
||||
endif()
|
||||
else()
|
||||
find_package(PNG)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildFreetype)
|
||||
if(PSP)
|
||||
set(ENV{FREETYPE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/include)
|
||||
set(ENV{FREETYPE_LIBRARIES} freetype)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildHgeTools)
|
||||
if(PSP)
|
||||
find_library(HGETOOLS_LIBRARY NAMES hgetools HINTS "${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/lib")
|
||||
set(HGETOOLS_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/include")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildMikMod)
|
||||
if(PSP)
|
||||
find_library(MIKMOD_LIBRARY NAMES mikmod HINTS "${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/lib")
|
||||
set(MIKMOD_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/include")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildQt)
|
||||
if(backend_qt_console)
|
||||
add_definitions(-DCONSOLE_CONFIG -DTESTSUITE)
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core Network Multimedia REQUIRED)
|
||||
elseif(backend_qt_widget)
|
||||
add_definitions(-DQT_WIDGET)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Core Gui OpenGL Network Multimedia REQUIRED)
|
||||
endif()
|
||||
# include(${QT_USE_FILE})
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildOpenGL)
|
||||
if(backend_sdl OR backend_qt_console OR backend_qt_widget)
|
||||
if(ANDROID)
|
||||
#find openglesv on android
|
||||
set(OPENGL_LIBRARIES "-ldl -lGLESv1_CM -lGLESv2 -llog -landroid")
|
||||
elseif(EMSCRIPTEN)
|
||||
set(OPENGL_LIBRARIES "")
|
||||
else()
|
||||
find_package(OpenGL)
|
||||
# find_package(GLUT)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildOpenSL)
|
||||
find_package(OpenSL)
|
||||
endmacro()
|
||||
|
||||
macro(FindOrBuildPSPSDK)
|
||||
find_package(PSPSDK COMPONENTS psppower pspmpeg pspaudiocodec pspaudiolib pspaudio pspmp3 pspgum pspgu psprtc pspfpu REQUIRED)
|
||||
endmacro()
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# - Try to find PSPSDK
|
||||
# Once done this will define
|
||||
# PSPSDK_FOUND - System has PSPSDK
|
||||
# PSPSDK_INCLUDE_DIR - The PSPSDK include directories
|
||||
# PSPSDK_LIB - The libraries requested with the components field
|
||||
# PSPSDK_REQUIRED_LIB - The libriries the PSPSDK needs always
|
||||
# PSPSDK_CFLAGS - The CFLAGS to use
|
||||
# PSPSDK_PATH - The output of psp-config --pspsdk-path
|
||||
# PSPSDK_PREFIX - The output of psp-config --psp-prefix
|
||||
# PSPSDK_CXX_COMPILER - The PSPSDK CXX Compilers path
|
||||
# PSPSDK_CXX_LINKER - The PSPSDK CXX Linker command
|
||||
# PSPSDK_FIXUP_IMPORTS_COMMAND - psp-fixup-imports command
|
||||
# PSPSDK_PRXGEN_COMMAND - psp-prxgen command
|
||||
# PSPSDK_PACK_PBP_COMMAND - pack-pbp command
|
||||
# PSPSDK_MKSFO_COMMAND - mksfo command
|
||||
|
||||
#find the psp-config progams absolute path
|
||||
#psp-config needs to be reachable via the system shell (PATH)
|
||||
find_program(PSP_CONFIG_PROGRAM psp-config)
|
||||
|
||||
#TODO: check if something is REQUIRED and throw errors instead of messages
|
||||
if(PSP_CONFIG_PROGRAM)
|
||||
find_program(PSPSDK_CXX_COMPILER psp-g++)
|
||||
find_program(PSPSDK_CXX_LINKER psp-gcc)
|
||||
find_program(PSPSDK_FIXUP_IMPORTS_COMMAND psp-fixup-imports)
|
||||
find_program(PSPSDK_PRXGEN_COMMAND psp-prxgen)
|
||||
find_program(PSPSDK_PACK_PBP_COMMAND pack-pbp)
|
||||
find_program(PSPSDK_MKSFO_COMMAND mksfo)
|
||||
|
||||
#ask psp-config for the
|
||||
execute_process(COMMAND psp-config --pspsdk-path OUTPUT_VARIABLE PSPSDK_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND psp-config --psp-prefix OUTPUT_VARIABLE PSPSDK_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(PSPSDK_INCLUDE_DIR "${PSPSDK_PATH}/include")
|
||||
|
||||
foreach(_COMPONENT ${PSPSDK_FIND_COMPONENTS})
|
||||
find_library(PSPSDK_${_COMPONENT} NAMES ${_COMPONENT})
|
||||
if(NOT PSPSDK_${_COMPONENT})
|
||||
message(SEND_ERROR "PSPSDK: ${_COMPONENT} not found")
|
||||
else()
|
||||
set(PSPSDK_LIB ${PSPSDK_LIB} ${PSPSDK_${_COMPONENT}})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#find libs which pspsdk does require to link even if the programs does not need one of them directly
|
||||
foreach(_COMPONENT pspdebug pspdisplay pspge pspctrl pspsdk c pspnet pspnet_inet pspnet_apctl pspnet_resolver psputility pspuser)
|
||||
find_library(PSPSDK_${_COMPONENT} NAMES ${_COMPONENT})
|
||||
if(NOT PSPSDK_${_COMPONENT})
|
||||
message(SEND_ERROR "PSPSDK: ${_COMPONENT} not found")
|
||||
else()
|
||||
set(PSPSDK_REQUIRED_LIB ${PSPSDK_REQUIRED_LIB} ${PSPSDK_${_COMPONENT}})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(PSPSDK DEFAULT_MSG
|
||||
PSPSDK_CXX_LINKER PSPSDK_CXX_COMPILER PSPSDK_PATH PSPSDK_PREFIX PSPSDK_LIB PSPSDK_REQUIRED_LIB PSPSDK_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(PSPSDK_CXX_LINKER PSPSDK_CXX_COMPILER PSPSDK_PATH PSPSDK_PREFIX PSPSDK_LIB PSPSDK_REQUIRED_LIB PSPSDK_INCLUDE_DIR)
|
||||
@@ -0,0 +1,181 @@
|
||||
|
||||
# Locate SDL2 library
|
||||
# This module defines
|
||||
# SDL2_LIBRARY, the name of the library to link against
|
||||
# SDL2_FOUND, if false, do not try to link to SDL2
|
||||
# SDL2_INCLUDE_DIR, where to find SDL.h
|
||||
#
|
||||
# This module responds to the the flag:
|
||||
# SDL2_BUILDING_LIBRARY
|
||||
# If this is defined, then no SDL2_main will be linked in because
|
||||
# only applications need main().
|
||||
# Otherwise, it is assumed you are building an application and this
|
||||
# module will attempt to locate and set the the proper link flags
|
||||
# as part of the returned SDL2_LIBRARY variable.
|
||||
#
|
||||
# Don't forget to include SDL2main.h and SDL2main.m your project for the
|
||||
# OS X framework based version. (Other versions link to -lSDL2main which
|
||||
# this module will try to find on your behalf.) Also for OS X, this
|
||||
# module will automatically add the -framework Cocoa on your behalf.
|
||||
#
|
||||
#
|
||||
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
|
||||
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
|
||||
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
|
||||
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
|
||||
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
|
||||
# as appropriate. These values are used to generate the final SDL2_LIBRARY
|
||||
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
|
||||
#
|
||||
#
|
||||
# $SDL2DIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$SDL2DIR
|
||||
# used in building SDL2.
|
||||
# l.e.galup 9-20-02
|
||||
#
|
||||
# Modified by Eric Wing.
|
||||
# Added code to assist with automated building by using environmental variables
|
||||
# and providing a more controlled/consistent search behavior.
|
||||
# Added new modifications to recognize OS X frameworks and
|
||||
# additional Unix paths (FreeBSD, etc).
|
||||
# Also corrected the header search path to follow "proper" SDL2 guidelines.
|
||||
# Added a search for SDL2main which is needed by some platforms.
|
||||
# Added a search for threads which is needed by some platforms.
|
||||
# Added needed compile switches for MinGW.
|
||||
#
|
||||
# On OSX, this will prefer the Framework version (if found) over others.
|
||||
# People will have to manually change the cache values of
|
||||
# SDL2_LIBRARY to override this selection or set the CMake environment
|
||||
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||
#
|
||||
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
|
||||
# This needed to change because "proper" SDL2 convention
|
||||
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
|
||||
# reasons because not all systems place things in SDL2/ (see FreeBSD).
|
||||
#
|
||||
# Ported by Johnny Patterson. This is a literal port for SDL2 of the FindSDL.cmake
|
||||
# module with the minor edit of changing "SDL" to "SDL2" where necessary. This
|
||||
# was not created for redistribution, and exists temporarily pending official
|
||||
# SDL2 CMake modules.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2003-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
|
||||
HINTS
|
||||
$ENV{SDL2DIR}
|
||||
PATH_SUFFIXES include/SDL2 include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include/SDL2
|
||||
/usr/include/SDL2
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SDL2_LIBRARY_TEMP
|
||||
NAMES SDL2
|
||||
HINTS
|
||||
$ENV{SDL2DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}")
|
||||
|
||||
IF(NOT SDL2_BUILDING_LIBRARY)
|
||||
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
||||
# Non-OS X framework versions expect you to also dynamically link to
|
||||
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
|
||||
# seem to provide SDL2main for compatibility even though they don't
|
||||
# necessarily need it.
|
||||
FIND_LIBRARY(SDL2MAIN_LIBRARY
|
||||
NAMES SDL2main
|
||||
HINTS
|
||||
$ENV{SDL2DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
||||
ENDIF(NOT SDL2_BUILDING_LIBRARY)
|
||||
|
||||
# SDL2 may require threads on your system.
|
||||
# The Apple build may not need an explicit flag because one of the
|
||||
# frameworks may already provide it.
|
||||
# But for non-OSX systems, I will use the CMake Threads package.
|
||||
IF(NOT APPLE)
|
||||
FIND_PACKAGE(Threads)
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# MinGW needs an additional library, mwindows
|
||||
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
|
||||
# (Actually on second look, I think it only needs one of the m* libraries.)
|
||||
IF(MINGW)
|
||||
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
|
||||
ENDIF(MINGW)
|
||||
|
||||
SET(SDL2_FOUND "NO")
|
||||
IF(SDL2_LIBRARY_TEMP)
|
||||
# For SDL2main
|
||||
IF(NOT SDL2_BUILDING_LIBRARY)
|
||||
IF(SDL2MAIN_LIBRARY)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
ENDIF(SDL2MAIN_LIBRARY)
|
||||
ENDIF(NOT SDL2_BUILDING_LIBRARY)
|
||||
|
||||
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
|
||||
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||
# though it actually is there if I modify a pre-used variable.
|
||||
# I think it has something to do with the CACHE STRING.
|
||||
# So I use a temporary variable until the end so I can set the
|
||||
# "real" variable in one-shot.
|
||||
IF(APPLE)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
||||
ENDIF(APPLE)
|
||||
|
||||
# For threads, as mentioned Apple doesn't need this.
|
||||
# In fact, there seems to be a problem if I used the Threads package
|
||||
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||
IF(NOT APPLE)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# For MinGW library
|
||||
IF(MINGW)
|
||||
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
ENDIF(MINGW)
|
||||
|
||||
# Set the final string here so the GUI reflects the final state.
|
||||
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
|
||||
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
|
||||
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
|
||||
|
||||
SET(SDL2_FOUND "YES")
|
||||
ENDIF(SDL2_LIBRARY_TEMP)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
|
||||
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
|
||||
mark_as_advanced(SDL2MAIN_LIBRARY SDL2_LIBRARY SDL2_INCLUDE_DIR)
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
# - Find TinyXML
|
||||
# Find the native TinyXML includes and library
|
||||
#
|
||||
# TINYXML_FOUND - True if TinyXML found.
|
||||
# TINYXML_INCLUDE_DIR - where to find tinyxml.h, etc.
|
||||
# TINYXML_LIBRARIES - List of libraries when using TinyXML.
|
||||
#
|
||||
|
||||
IF( TINYXML_INCLUDE_DIR )
|
||||
# Already in cache, be silent
|
||||
SET( TinyXML_FIND_QUIETLY TRUE )
|
||||
ENDIF( TINYXML_INCLUDE_DIR )
|
||||
|
||||
FIND_PATH( TINYXML_INCLUDE_DIR "tinyxml.h"
|
||||
PATH_SUFFIXES "tinyxml" )
|
||||
|
||||
FIND_LIBRARY( TINYXML_LIBRARIES
|
||||
NAMES "tinyxml"
|
||||
PATH_SUFFIXES "tinyxml" )
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set TINYXML_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE( "FindPackageHandleStandardArgs" )
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS( "TinyXML" DEFAULT_MSG TINYXML_INCLUDE_DIR TINYXML_LIBRARIES )
|
||||
|
||||
MARK_AS_ADVANCED( TINYXML_INCLUDE_DIR TINYXML_LIBRARIES )
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
include(CMakeForceCompiler)
|
||||
|
||||
# this one is important
|
||||
SET(CMAKE_SYSTEM_NAME "Generic")
|
||||
#this one not so much
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
set (CMAKE_SYSTEM_NAME Generic)
|
||||
|
||||
# Just point to anything that exists.
|
||||
# We don't need CMake to generate proper build files.
|
||||
set(CMAKE_C_COMPILER ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Skip the platform compiler checks
|
||||
set (CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||
set (CMAKE_C_COMPILER_WORKS TRUE)
|
||||
|
||||
#how libraries look
|
||||
SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
|
||||
|
||||
SET(CMAKE_SYSTEM_INCLUDE_PATH
|
||||
${THEOS_PATH}/include
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
${CMAKE_SYSTEM_INCLUDE_PATH})
|
||||
|
||||
# where is the target environment
|
||||
SET(CMAKE_SYSTEM_LIBRARY_PATH
|
||||
${THEOS_PATH}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_SYSTEM_LIBRARY_PATH})
|
||||
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${THEOS_PATH}
|
||||
${THEOS_PATH}/lib
|
||||
${THEOS_PATH}/include
|
||||
)
|
||||
|
||||
# search for programs in the build host directories
|
||||
# for libraries and headers in the target directories and then in the host
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY FIRST)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE FIRST)
|
||||
|
||||
set(IOS 1)
|
||||
@@ -0,0 +1,62 @@
|
||||
include(CMakeForceCompiler)
|
||||
|
||||
# this one is important
|
||||
SET(CMAKE_SYSTEM_NAME "Generic")
|
||||
#this one not so much
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
find_program(PSP_CONFIG_PROGRAM psp-config)
|
||||
|
||||
execute_process(COMMAND psp-config --pspsdk-path OUTPUT_VARIABLE PSPSDK_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND psp-config --psp-prefix OUTPUT_VARIABLE PSPSDK_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# specify compiler and linker:
|
||||
find_program(PSP_GPP psp-g++)
|
||||
find_program(PSP_GCC psp-gcc)
|
||||
|
||||
CMAKE_FORCE_C_COMPILER(${PSP_GCC} GNU)
|
||||
CMAKE_FORCE_CXX_COMPILER(${PSP_GPP} GNU)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -G0")
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "${PSP_GCC} <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
|
||||
#how libraries look
|
||||
SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
|
||||
|
||||
# where is the target environment
|
||||
SET(CMAKE_SYSTEM_INCLUDE_PATH
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/include
|
||||
${PSPSDK_PATH}/include
|
||||
${PSPSDK_PREFIX}/include
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
${CMAKE_SYSTEM_INCLUDE_PATH})
|
||||
|
||||
SET(CMAKE_SYSTEM_LIBRARY_PATH
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/lib
|
||||
${PSPSDK_PATH}/lib
|
||||
${PSPSDK_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_SYSTEM_LIBRARY_PATH})
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/binary/psp
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/lib
|
||||
${CMAKE_SOURCE_DIR}/thirdparty/binary/psp/include
|
||||
${PSPSDK_PATH}
|
||||
${PSPSDK_PATH}/lib
|
||||
${PSPSDK_PATH}/include
|
||||
${PSPSDK_PREFIX}
|
||||
${PSPSDK_PREFIX}/lib
|
||||
${PSPSDK_PREFIX}/include
|
||||
)
|
||||
|
||||
# search for programs in the build host directories
|
||||
# for libraries and headers in the target directories and then in the host
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY FIRST)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE FIRST)
|
||||
|
||||
set(PSP 1)
|
||||
@@ -0,0 +1,57 @@
|
||||
macro(WAGIC_OPTION variable description value)
|
||||
set(__value ${value})
|
||||
set(__condition "")
|
||||
set(__varname "__value")
|
||||
foreach(arg ${ARGN})
|
||||
if(arg STREQUAL "IF" OR arg STREQUAL "if")
|
||||
set(__varname "__condition")
|
||||
else()
|
||||
list(APPEND ${__varname} ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
unset(__varname)
|
||||
if("${__condition}" STREQUAL "")
|
||||
set(__condition 2 GREATER 1)
|
||||
endif()
|
||||
|
||||
if(${__condition})
|
||||
if("${__value}" MATCHES ";")
|
||||
if(${__value})
|
||||
option(${variable} "${description}" ON)
|
||||
else()
|
||||
option(${variable} "${description}" OFF)
|
||||
endif()
|
||||
elseif(DEFINED ${__value})
|
||||
if(${__value})
|
||||
option(${variable} "${description}" ON)
|
||||
else()
|
||||
option(${variable} "${description}" OFF)
|
||||
endif()
|
||||
else()
|
||||
option(${variable} "${description}" ${__value})
|
||||
endif()
|
||||
else()
|
||||
unset(${variable} CACHE)
|
||||
endif()
|
||||
unset(__condition)
|
||||
unset(__value)
|
||||
endmacro()
|
||||
|
||||
# add prefix to each item in the list
|
||||
macro(list_add_prefix LST PREFIX)
|
||||
set(__tmp "")
|
||||
foreach(item ${${LST}})
|
||||
list(APPEND __tmp "${PREFIX}${item}")
|
||||
endforeach()
|
||||
set(${LST} ${__tmp})
|
||||
unset(__tmp)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(find_host_program)
|
||||
set(_find_program ${CMAKE_FIND_ROOT_PATH_MODE_PROGRAM})
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
find_program(${ARGN})
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ${_find_program})
|
||||
unset(_find_program)
|
||||
endmacro()
|
||||
@@ -0,0 +1,165 @@
|
||||
#the sources, jge will need always
|
||||
set(JGE_generic_src
|
||||
src/Encoding.cpp
|
||||
src/JAnimator.cpp
|
||||
src/JApp.cpp
|
||||
src/JDistortionMesh.cpp
|
||||
src/JFileSystem.cpp
|
||||
src/JGameObject.cpp
|
||||
src/JGE.cpp
|
||||
src/JGui.cpp
|
||||
src/JLogger.cpp
|
||||
src/JLBFont.cpp
|
||||
src/JOBJModel.cpp
|
||||
src/JParticle.cpp
|
||||
src/JParticleEffect.cpp
|
||||
src/JParticleEmitter.cpp
|
||||
src/JParticleSystem.cpp
|
||||
src/JResourceManager.cpp
|
||||
src/JSpline.cpp
|
||||
src/JSprite.cpp
|
||||
src/Vector2D.cpp)
|
||||
|
||||
set(JGE_hge_src
|
||||
src/hge/hgecolor.cpp
|
||||
src/hge/hgedistort.cpp
|
||||
src/hge/hgefont.cpp
|
||||
src/hge/hgeparticle.cpp
|
||||
src/hge/hgerect.cpp
|
||||
src/hge/hgevector.cpp)
|
||||
|
||||
#the sources we need to get graphical output desktops
|
||||
#used by qt-widget build option
|
||||
set(JGE_graphics_src
|
||||
src/Downloader.cpp
|
||||
include/Downloader.h
|
||||
src/JMD2Model.cpp
|
||||
src/pc/JGfx.cpp)
|
||||
|
||||
#the sources we need to fake graphical output on desktops
|
||||
#these are used for the console-only testsuit
|
||||
set(JGE_console_src
|
||||
src/OutputCapturer.cpp
|
||||
src/JGfx-fake.cpp)
|
||||
|
||||
#the sources we need on linux
|
||||
set(JGE_linux_src
|
||||
src/JNetwork.cpp
|
||||
src/pc/JSocket.cpp
|
||||
src/pc/JSfx.cpp)
|
||||
|
||||
set(JGE_android_src
|
||||
src/JNetwork.cpp
|
||||
src/JSocket.cpp
|
||||
src/android/JSfx.cpp)
|
||||
|
||||
#the sources we need if we compile for psp
|
||||
#note: main.cpp contains the main-function.
|
||||
#the other main functions reside in projects/mtg to reduce cross-library dependencies.
|
||||
#there may be a way to get all main-functions into the same project
|
||||
set(JGE_psp_src
|
||||
src/JNetwork.cpp
|
||||
src/JSocket.cpp
|
||||
src/JGfx.cpp
|
||||
src/JSfx.cpp
|
||||
src/JAudio.cpp
|
||||
src/JMP3.cpp
|
||||
src/decoder_prx.cpp
|
||||
src/main.cpp
|
||||
src/vram.cpp)
|
||||
|
||||
set(JGE_ios_src
|
||||
src/iOS/main.m
|
||||
src/iOS/wagicAppDelegate.m
|
||||
src/iOS/ES2Renderer.m
|
||||
src/iOS/EAGLView.m
|
||||
src/iOS/EAGLViewController.m
|
||||
src/iOS/JSfx.cpp)
|
||||
|
||||
set(JGE_windows_src
|
||||
src/JNetwork.cpp
|
||||
src/pc/JSocket.cpp
|
||||
src/windows/JSfx.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)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
if(backend_qt_console)
|
||||
if(UNIX AND NOT ANDROID)
|
||||
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}
|
||||
${JPEG_LIBRARIES} ${PNG_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "qt builds of jge platforms other than linux are not supported")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(backend_qt_widget)
|
||||
if(UNIX AND NOT ANDROID)
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
|
||||
${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}
|
||||
${JPEG_LIBRARIES} ${PNG_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "qt builds of jge platforms other than linux are not supported")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(backend_sdl)
|
||||
if((UNIX OR EMSCRIPTEN) AND NOT ANDROID)
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}
|
||||
${SDL2_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_linux_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY}
|
||||
${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
|
||||
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} ${ZLIB_INCLUDE_DIRS})
|
||||
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 ${EXTRA_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${SDL2_INCLUDE_DIR}
|
||||
${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_windows_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY} ${PNG_LIBRARIES})
|
||||
set(JGE_LINK_DIRECTORIES ${Boost_LIBRARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(backend_psp)
|
||||
if(PSP)
|
||||
#${PSPSDK_PATH}/include should be in system pathes
|
||||
set(JGE_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/psp/include ${TINYXML_INCLUDE_DIR}
|
||||
${ZIPFS_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${BOOST_INCLUDE_DIRS} ${GIF_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} )
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_psp_src} ${JGE_hge_src})
|
||||
set(JGE_LINK_LIBRARIES ${TINYXML_LIBRARIES} ${ZIPFS_LIBRARY} ${UNZIP_LIRARY})
|
||||
else()
|
||||
message(FATAL_ERROR "use the cross-compile toolchain to build as the psp target")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
set(JGE_SOURCES ${JGE_generic_src} ${JGE_ios_src} ${JGE_hge_src} src/pc/JGfx.cpp)
|
||||
set(JGE_SOURCES ${JGE_SOURCES} PARENT_SCOPE)
|
||||
set(JGE_INCLUDE_DIRS ${JGE_INCLUDE_DIRS} src/iOS PARENT_SCOPE)
|
||||
set(JGE_LINK_LIBRARIES ${TINYXML_LIBRARIES} ${ZIPFS_LIBRARY} ${UNZIP_LIRARY})
|
||||
endif()
|
||||
|
||||
add_library(jge STATIC ${JGE_SOURCES})
|
||||
include_directories(${JGE_INTERNAL_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS})
|
||||
target_link_libraries(jge ${JGE_LINK_LIBRARIES})
|
||||
link_directories(${JGE_LINK_DIRECTORIES})
|
||||
|
||||
set(${JGE_LIBRARIES} jge)
|
||||
@@ -25,6 +25,7 @@ std::string ToHex(T* pointer)
|
||||
|
||||
#ifdef LINUX
|
||||
#define OutputDebugString(val) (std::cerr << val);
|
||||
#define OutputDebugStringA(val) (std::cerr << val);
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -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:
|
||||
@@ -72,7 +72,13 @@ protected:
|
||||
QNetworkReply* mNetworkReply;
|
||||
static QNetworkAccessManager networkAccessManager;
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
static void onLoadCb(unsigned int handle, DownloadRequest* req, const char *buffer, unsigned int size);
|
||||
static void onErrorCb(unsigned int handle, DownloadRequest* req, int errorCode, const char* errorText);
|
||||
static void onProgressCb(unsigned int handle, DownloadRequest* req, int bytesReceived, int bytesTotal);
|
||||
#endif
|
||||
void processError(int errorCode, const char* errorText);
|
||||
void processBufferDownloaded(unsigned int size, const char*buffer);
|
||||
|
||||
public:
|
||||
DownloadRequest(string localPath="",
|
||||
|
||||
+1
-1
@@ -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 ?
|
||||
|
||||
+24
-16
@@ -18,20 +18,20 @@
|
||||
|
||||
#include "JTypes.h"
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <SLES/OpenSLES.h>
|
||||
#include "SLES/OpenSLES_Android.h"
|
||||
|
||||
#elif defined USE_PHONON
|
||||
#elif defined(USE_PHONON)
|
||||
#include <phonon/AudioOutput>
|
||||
#include <phonon/MediaObject>
|
||||
#elif (defined QT_CONFIG)
|
||||
#elif defined (QT_CONFIG)
|
||||
#include "QMediaPlayer"
|
||||
#include "QMediaPlaylist"
|
||||
#include "QSoundEffect"
|
||||
#elif defined WIN32
|
||||
#elif defined(WIN32)
|
||||
#include <windows.h>
|
||||
#define WITH_FMOD
|
||||
//#define WITH_FMOD
|
||||
#elif defined (PSP)
|
||||
#include <pspgu.h>
|
||||
#include <pspkernel.h>
|
||||
@@ -48,7 +48,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WITH_FMOD
|
||||
#include "../Dependencies/include/fmod.h"
|
||||
#include "fmod.h"
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
@@ -79,20 +79,26 @@ public slots:
|
||||
std::string filename;
|
||||
std::string key;
|
||||
std::string ext;
|
||||
void* mTrack;
|
||||
#elif defined WITH_FMOD
|
||||
FSOUND_SAMPLE* mTrack; // MP3 needed to be of "sample" type for FMOD, FMUSIC_MODULE is for MODs
|
||||
void* mTrack;
|
||||
#elif defined ANDROID
|
||||
SLObjectItf playerObject;
|
||||
SLPlayItf playInterface;
|
||||
SLSeekItf seekInterface;
|
||||
SLVolumeItf musicVolumeInterface;
|
||||
void* mTrack;
|
||||
#elif (defined QT_CONFIG)
|
||||
QMediaPlaylist* playlist;
|
||||
QMediaPlayer* player;
|
||||
string fullpath;
|
||||
#else
|
||||
void* mTrack;
|
||||
#endif //WITH_FMOD
|
||||
void* mTrack;
|
||||
#elif (defined WIN32)
|
||||
std::string filename;
|
||||
void* mTrack;
|
||||
#endif
|
||||
//#endif //WITH_FMOD
|
||||
|
||||
};
|
||||
|
||||
@@ -107,28 +113,30 @@ public:
|
||||
unsigned long fileSize();
|
||||
#if (defined QT_CONFIG) && (!defined USE_PHONON)
|
||||
QMediaPlayer* effect;
|
||||
void* mSample;
|
||||
void* mSample;
|
||||
#elif defined (PSP)
|
||||
WAVDATA *mSample;
|
||||
WAVDATA* mSample;
|
||||
#elif defined (IOS)
|
||||
std::string filename;
|
||||
std::string key;
|
||||
std::string ext;
|
||||
|
||||
void* mSample;
|
||||
void* mSample;
|
||||
#elif defined (WITH_FMOD)
|
||||
FSOUND_SAMPLE *mSample;
|
||||
#elif defined (USE_PHONON)
|
||||
Phonon::AudioOutput* mOutput;
|
||||
Phonon::MediaObject* mMediaObject;
|
||||
void* mSample;
|
||||
void* mSample;
|
||||
#elif defined ANDROID
|
||||
SLObjectItf playerObject;
|
||||
SLPlayItf playInterface;
|
||||
SLVolumeItf sampleVolumeInterface;
|
||||
void* mSample;
|
||||
void* mSample;
|
||||
#elif (defined WIN32)
|
||||
std::string filename;
|
||||
void* mSample;
|
||||
#else
|
||||
void* mSample;
|
||||
void* mSample;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+15
-2
@@ -26,8 +26,16 @@
|
||||
#include "JAudio.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <stdint.h>
|
||||
//#define __STDC_LIMIT_MACROS
|
||||
#ifdef IOS
|
||||
#include <tr1/cstdint>
|
||||
#else
|
||||
#include <cstdint>
|
||||
#endif
|
||||
//#include <stdint.h>
|
||||
//the MSC version might only define _MSC_STDINT_H_
|
||||
//and that might cause redefinition of standard types
|
||||
//#define _STDINT_H_
|
||||
|
||||
#endif
|
||||
|
||||
@@ -140,9 +148,14 @@ typedef uint32_t u32;
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#elif defined (WIN32) || defined (LINUX)
|
||||
#if defined(__APPLE__)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#include <QtOpenGL>
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef PRECOMPILEDHEADER_H
|
||||
#define PRECOMPILEDHEADER_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "DebugRoutines.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "JGE.h"
|
||||
#include "JFileSystem.h"
|
||||
#include "JLogger.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
|
||||
|
||||
#endif //PRECOMPILEDHEADER_H
|
||||
@@ -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>
|
||||
|
||||
@@ -33,6 +33,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
void* vrelptr( void *ptr ); // make a pointer relative to memory base address (ATTENTION: A NULL rel ptr is not illegal/invalid!)
|
||||
|
||||
void* vabsptr( void *ptr ); // make a pointer absolute (default return type of valloc)
|
||||
|
||||
void* valloc( size_t size );
|
||||
|
||||
+73
-21
@@ -7,6 +7,9 @@
|
||||
#ifdef QT_CONFIG
|
||||
QNetworkAccessManager DownloadRequest::networkAccessManager;
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include "emscripten.h"
|
||||
#endif
|
||||
|
||||
DownloadRequest::DownloadRequest(string localPath,
|
||||
string remoteResourceURL,
|
||||
@@ -48,15 +51,71 @@ 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
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_async_wget2_data(mRemoteResourceURL.c_str(), "GET", 0, this, 1,
|
||||
(em_async_wget2_data_onload_func)DownloadRequest::onLoadCb,
|
||||
(em_async_wget2_data_onerror_func)DownloadRequest::onErrorCb,
|
||||
(em_async_wget2_data_onprogress_func)DownloadRequest::onProgressCb);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
void DownloadRequest::onLoadCb(unsigned int handle, DownloadRequest* req, const char *buffer, unsigned int size)
|
||||
{
|
||||
|
||||
DebugTrace("DownloadRequest::onLoadCb: " << size);
|
||||
req->processBufferDownloaded(size, buffer);
|
||||
Downloader::GetInstance()->Update();
|
||||
}
|
||||
|
||||
void DownloadRequest::onErrorCb(unsigned int handle, DownloadRequest* req, int errorCode, const char* errorText)
|
||||
{
|
||||
DebugTrace("DownloadRequest::onErrorCb");
|
||||
req->processError(errorCode, errorText);
|
||||
Downloader::GetInstance()->Update();
|
||||
}
|
||||
|
||||
void DownloadRequest::onProgressCb(unsigned int handle, DownloadRequest* req, int bytesReceived, int bytesTotal)
|
||||
{
|
||||
DebugTrace("DownloadRequest::onProgressCb");
|
||||
req->DownloadRequest::downloadProgress(bytesReceived, bytesTotal);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DownloadRequest::processError(int errorCode, const char* errorText)
|
||||
{
|
||||
DebugTrace(errorText);
|
||||
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
|
||||
mFile.close();
|
||||
JFileSystem::GetInstance()->Remove(getTempLocalPath());
|
||||
}
|
||||
|
||||
void DownloadRequest::processBufferDownloaded(unsigned int size, const char*buffer)
|
||||
{
|
||||
if(mFile.is_open())
|
||||
{
|
||||
mTotalSize = size;
|
||||
mFile.write(buffer, size);
|
||||
mFile.close();
|
||||
if(!JFileSystem::GetInstance()->Rename(getTempLocalPath(), mLocalPath)) {
|
||||
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
mDownloadStatus = DownloadRequest::DOWNLOADED;
|
||||
}
|
||||
|
||||
void DownloadRequest::fileDownloaded()
|
||||
{
|
||||
do {
|
||||
#ifdef QT_CONFIG
|
||||
do {
|
||||
QByteArray eTagByteArray = mNetworkReply->rawHeader("ETag");
|
||||
if(!eTagByteArray.isEmpty()) {
|
||||
string oldETag = mETag;
|
||||
@@ -67,10 +126,7 @@ void DownloadRequest::fileDownloaded()
|
||||
|
||||
// let's check some error
|
||||
if(mNetworkReply->error() != QNetworkReply::NoError) {
|
||||
DebugTrace(mNetworkReply->errorString().toStdString());
|
||||
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
|
||||
mFile.close();
|
||||
JFileSystem::GetInstance()->Remove(getTempLocalPath());
|
||||
processError((int)mNetworkReply->error(), mNetworkReply->errorString().toStdString().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -89,35 +145,31 @@ void DownloadRequest::fileDownloaded()
|
||||
return;
|
||||
}
|
||||
|
||||
if(mFile.is_open())
|
||||
{
|
||||
QByteArray byteArray = mNetworkReply->readAll();
|
||||
mFile.write(byteArray.constData(), byteArray.size());
|
||||
mFile.close();
|
||||
if(!JFileSystem::GetInstance()->Rename(getTempLocalPath(), mLocalPath)) {
|
||||
mDownloadStatus = DownloadRequest::DOWNLOAD_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mDownloadStatus = DownloadRequest::DOWNLOADED;
|
||||
QByteArray byteArray = mNetworkReply->readAll();
|
||||
processBufferDownloaded(byteArray.size(), byteArray.constData());
|
||||
} while(0);
|
||||
|
||||
Downloader::GetInstance()->Update();
|
||||
mNetworkReply->deleteLater();
|
||||
|
||||
mNetworkReply->deleteLater();
|
||||
emit statusChanged((int)mDownloadStatus);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||
void DownloadRequest::downloadProgress(int64_t bytesReceived, int64_t bytesTotal)
|
||||
{
|
||||
QByteArray byteArray = mNetworkReply->readAll();
|
||||
#ifdef QT_CONFIG
|
||||
QByteArray byteArray = mNetworkReply->readAll();
|
||||
mFile.write(byteArray.constData(), byteArray.size());
|
||||
#endif
|
||||
mCurrentSize = bytesReceived;
|
||||
mTotalSize = bytesTotal;
|
||||
int percent = 0;
|
||||
if(bytesTotal)
|
||||
percent = (bytesReceived/bytesTotal)*100;
|
||||
#ifdef QT_CONFIG
|
||||
emit percentChanged(percent);
|
||||
#endif
|
||||
}
|
||||
|
||||
Downloader* Downloader::mInstance = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "../include/JSprite.h"
|
||||
#include "../include/JAnimator.h"
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+11
-13
@@ -16,14 +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.
|
||||
*/
|
||||
|
||||
#if defined (ANDROID)
|
||||
#include "PrecompiledHeader.h"
|
||||
#endif //ANDROID
|
||||
|
||||
#if defined (LINUX)
|
||||
#include "../../projects/mtg/include/PrecompiledHeader.h"
|
||||
#endif //LINUX
|
||||
|
||||
#include "dirent.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable : 4786)
|
||||
@@ -37,7 +30,8 @@ The content that users should not be touching.
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JLogger.h"
|
||||
#include <dirent.h>
|
||||
#include "DebugRoutines.h"
|
||||
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
#include <QDir>
|
||||
@@ -130,6 +124,10 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
|
||||
userPath = [[documentsDirectory stringByAppendingString: @"/User/"] cStringUsingEncoding:1];
|
||||
systemPath = [[documentsDirectory stringByAppendingString: @"/Res/"] cStringUsingEncoding:1];
|
||||
|
||||
#elif defined (__EMSCRIPTEN__)
|
||||
systemPath = "/";
|
||||
DebugTrace("User path " << userPath);
|
||||
DebugTrace("System path " << systemPath);
|
||||
#elif defined (ANDROID)
|
||||
userPath = JGE::GetInstance()->getFileSystemLocation();
|
||||
systemPath = "";
|
||||
@@ -145,9 +143,9 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
|
||||
userPath = QDir::toNativeSeparators(dir.absolutePath()).toStdString();
|
||||
systemPath = QDir::toNativeSeparators(sysDir.absolutePath()).toStdString();
|
||||
|
||||
DebugTrace("User path " << userPath);
|
||||
DebugTrace("System path " << systemPath);
|
||||
DebugTrace("Current path " << QDir::currentPath().toStdString());
|
||||
DebugTrace("User path " + userPath);
|
||||
DebugTrace("System path " + systemPath);
|
||||
DebugTrace("Current path " + QDir::currentPath().toStdString());
|
||||
#else
|
||||
//Find the Res.txt file and matching Res folders for backwards compatibility
|
||||
ifstream mfile("Res.txt");
|
||||
@@ -302,6 +300,7 @@ void JFileSystem::DetachZipFile()
|
||||
|
||||
bool JFileSystem::openForRead(izfstream & File, const string & FilePath) {
|
||||
|
||||
DebugTrace("JFileSystem::openForRead " << FilePath);
|
||||
File.open(FilePath.c_str(), mUserFS);
|
||||
if (File)
|
||||
return true;
|
||||
@@ -412,7 +411,6 @@ bool JFileSystem::OpenFile(const string &filename)
|
||||
mCurrentFileInZip = &(it2->second);
|
||||
mFileSize = it2->second.m_Size;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <pspaudio.h>
|
||||
#include <pspmp3.h>
|
||||
#include <psputility.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#else
|
||||
#define PSP_AUDIO_VOLUME_MAX 100
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JResourceManager.h"
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "../include/JResourceManager.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JLBFont.h"
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
|
||||
#if defined (_DEBUG) && defined (WIN32) && (!defined LINUX)
|
||||
#include "crtdbg.h"
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JSpline.h"
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
|
||||
#define SMALL_NUMBER 0.0001f
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../include/decoder_prx.h"
|
||||
#include "decoder_prx.h"
|
||||
#include <psputility.h>
|
||||
|
||||
char *prx_static_init()
|
||||
{
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
#if (!defined IOS) && (!defined QT_CONFIG)
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable : 4786)
|
||||
#pragma comment( lib, "giflib.lib" )
|
||||
//#pragma comment( lib, "giflib.lib" )
|
||||
#endif
|
||||
|
||||
#include <png.h>
|
||||
|
||||
@@ -75,7 +75,7 @@ static int __largest_block = __MEM_BLOCKS;
|
||||
static int __mem_free = __MEM_BLOCKS;
|
||||
|
||||
|
||||
inline void* vrelptr( void *ptr )
|
||||
void* vrelptr( void *ptr )
|
||||
{
|
||||
return (void*)((unsigned int)ptr & ~__MEM_START);
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
#include <Windows.h>
|
||||
#include <Mmsystem.h>
|
||||
#include <mciapi.h>
|
||||
//these two headers are already included in the <Windows.h> header
|
||||
#pragma comment(lib, "Winmm.lib")
|
||||
|
||||
#include "DebugRoutines.h"
|
||||
#include "../../include/JSoundSystem.h"
|
||||
#include "../../include/JFileSystem.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JMusic::JMusic()
|
||||
:
|
||||
mTrack(0)
|
||||
{
|
||||
}
|
||||
|
||||
void JMusic::Update(){
|
||||
|
||||
}
|
||||
|
||||
int JMusic::getPlayTime(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
JMusic::~JMusic()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JSample::JSample()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JSample::~JSample()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned long JSample::fileSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
JSoundSystem* JSoundSystem::mInstance = NULL;
|
||||
|
||||
JSoundSystem* JSoundSystem::GetInstance()
|
||||
{
|
||||
if (mInstance == NULL)
|
||||
{
|
||||
mInstance = new JSoundSystem();
|
||||
mInstance->InitSoundSystem();
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::Destroy()
|
||||
{
|
||||
if (mInstance)
|
||||
{
|
||||
mInstance->DestroySoundSystem();
|
||||
delete mInstance;
|
||||
mInstance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSoundSystem::JSoundSystem()
|
||||
{
|
||||
mVolume = 0;
|
||||
mSampleVolume = 0;
|
||||
}
|
||||
|
||||
JSoundSystem::~JSoundSystem()
|
||||
{
|
||||
}
|
||||
|
||||
void JSoundSystem::InitSoundSystem()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::DestroySoundSystem()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
JMusic *JSoundSystem::LoadMusic(const char *fileName)
|
||||
{
|
||||
JMusic* music = NULL;
|
||||
music = new JMusic();
|
||||
if (music)
|
||||
{
|
||||
music->filename = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
||||
std::string aString = "open \"" + music->filename + "\" type mpegvideo alias mp3";
|
||||
mciSendString(aString.c_str(), NULL, 0, NULL);
|
||||
music->mTrack = (void*)-1;
|
||||
}
|
||||
|
||||
return music;
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::PlayMusic(JMusic *music, bool looping)
|
||||
{
|
||||
if (music && music->mTrack)
|
||||
{
|
||||
if(looping)
|
||||
mciSendString("play mp3 repeat", NULL, 0, NULL);
|
||||
else
|
||||
mciSendString("play mp3", NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::StopMusic(JMusic *music)
|
||||
{
|
||||
if (music && music->mTrack)
|
||||
{
|
||||
mciSendString("stop mp3", NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::PauseMusic(JMusic *music)
|
||||
{
|
||||
if (music && music->mTrack)
|
||||
{
|
||||
mciSendString("pause mp3", NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::ResumeMusic(JMusic *music)
|
||||
{
|
||||
if (music && music->mTrack)
|
||||
{
|
||||
mciSendString("resume mp3", NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::SetVolume(int volume)
|
||||
{
|
||||
SetMusicVolume(volume);
|
||||
SetSfxVolume(volume);
|
||||
}
|
||||
|
||||
void JSoundSystem::SetMusicVolume(int volume)
|
||||
{
|
||||
mVolume = volume;
|
||||
}
|
||||
|
||||
void JSoundSystem::SetSfxVolume(int volume)
|
||||
{
|
||||
mSampleVolume = volume;
|
||||
SetMusicVolume(mVolume);
|
||||
}
|
||||
|
||||
JSample *JSoundSystem::LoadSample(const char *fileName)
|
||||
{
|
||||
JSample* sample = NULL;
|
||||
sample = new JSample();
|
||||
if (sample)
|
||||
{
|
||||
sample->filename = JFileSystem::GetInstance()->GetResourceFile(fileName);
|
||||
}
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
||||
|
||||
void JSoundSystem::PlaySample(JSample *sample)
|
||||
{
|
||||
if(sample)
|
||||
{
|
||||
sndPlaySound(sample->filename.c_str(), SND_FILENAME | SND_ASYNC);
|
||||
}
|
||||
}
|
||||
|
||||
+15
-2
@@ -17,6 +17,7 @@ skip_tags: true
|
||||
#---------------------------------#
|
||||
|
||||
environment:
|
||||
DXSDK_DIR: "C:/Program Files (x86)/Microsoft DirectX SDK/"
|
||||
GH_TOKEN:
|
||||
secure: dYnBDQkiY5oVjIlswzBX9BJigNtBGXgGlp1tK3XbHzrDEDrs2vaKD5m+Oz5OSz1C
|
||||
|
||||
@@ -26,6 +27,10 @@ install:
|
||||
- "C:/Python27/python.exe C:/get-pip.py"
|
||||
- "C:/Python27/Scripts/pip.exe install pyjavaproperties"
|
||||
- "C:/Python27/Scripts/pip.exe install github3.py"
|
||||
- git submodule update --init --recursive
|
||||
- cd thirdparty/SDL2
|
||||
# - git checkout release-2.0.3
|
||||
- cd ../..
|
||||
|
||||
#---------------------------------#
|
||||
# build configuration #
|
||||
@@ -34,8 +39,16 @@ install:
|
||||
# build Configuration, i.e. Debug, Release, etc.
|
||||
configuration: Release
|
||||
|
||||
# scripts to run before build
|
||||
before_build:
|
||||
- echo Running cmake...
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -Dbackend_sdl=ON ..
|
||||
- cd ..
|
||||
|
||||
build:
|
||||
project: projects/mtg/mtg_vs2010.sln # path to Visual Studio solution or project
|
||||
project: build/wagic.sln # path to Visual Studio solution or project
|
||||
|
||||
#---------------------------------#
|
||||
# tests configuration #
|
||||
@@ -61,7 +74,7 @@ artifacts:
|
||||
# scripts to run before deployment
|
||||
before_deploy:
|
||||
- cd projects/mtg/bin
|
||||
- "C:/Python27/python.exe createWindowsZip.py"
|
||||
- "C:/Python27/python.exe createWindowsZip.py -b ../../../build"
|
||||
- cd ../../..
|
||||
|
||||
# scripts to run after deployment
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
add_definitions(-DANDROID -DLINUX)
|
||||
add_definitions(-D_STLP_USE_SIMPLE_NODE_ALLOC -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="0192" android:versionName="@string/app_version" package="net.wagic.app">
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<application android:debuggable="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:label="@string/app_name" android:name="org.libsdl.app.SDLActivity" android:screenOrientation="sensorLandscape">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" android:targetSdkVersion="@ANDROID_NATIVE_API_LEVEL@"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,121 @@
|
||||
if(NOT ANDROID_PACKAGE_RELEASE)
|
||||
set(ANDROID_PACKAGE_RELEASE 1)
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID_PACKAGE_PLATFORM)
|
||||
if(ARMEABI_V7A)
|
||||
if(NEON)
|
||||
set(ANDROID_PACKAGE_PLATFORM armv7a_neon)
|
||||
else()
|
||||
set(ANDROID_PACKAGE_PLATFORM armv7a)
|
||||
endif()
|
||||
elseif(ARMEABI_V6)
|
||||
set(ANDROID_PACKAGE_PLATFORM armv6)
|
||||
elseif(ARMEABI)
|
||||
set(ANDROID_PACKAGE_PLATFORM armv5)
|
||||
elseif(X86)
|
||||
set(ANDROID_PACKAGE_PLATFORM x86)
|
||||
elseif(MIPS)
|
||||
set(ANDROID_PACKAGE_PLATFORM mips)
|
||||
else()
|
||||
message(ERROR "Can not automatically determine the value for ANDROID_PACKAGE_PLATFORM")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID_PACKAGE_PLATFORM_NAME)
|
||||
if(ARMEABI_V7A)
|
||||
if(NEON)
|
||||
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v7a with NEON")
|
||||
else()
|
||||
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v7a")
|
||||
endif()
|
||||
elseif(ARMEABI_V6)
|
||||
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v6")
|
||||
elseif(ARMEABI)
|
||||
set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi")
|
||||
elseif(X86)
|
||||
set(ANDROID_PACKAGE_PLATFORM_NAME "x86")
|
||||
elseif(MIPS)
|
||||
set(ANDROID_PACKAGE_PLATFORM_NAME "mips")
|
||||
else()
|
||||
message(ERROR "Can not automatically determine the value for ANDROID_PACKAGE_PLATFORM_NAME")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("${ANDROID_NATIVE_API_LEVEL}" MATCHES "[1-9][0-9]*$")
|
||||
set(ANDROID_SDK_VERSION ${CMAKE_MATCH_0})
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID_SDK_VERSION GREATER 7)
|
||||
set(ANDROID_SDK_VERSION 8)
|
||||
endif()
|
||||
|
||||
set(PACKAGE_DIR "${CMAKE_BINARY_DIR}/package")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml"
|
||||
"${PACKAGE_DIR}/AndroidManifest.xml" @ONLY)
|
||||
#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.xml"
|
||||
# "${PACKAGE_DIR}/build.xml" COPYONLY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml"
|
||||
"${PACKAGE_DIR}/res/values/strings.xml" COPYONLY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/drawable-hdpi/icon.png"
|
||||
"${PACKAGE_DIR}/res/drawable-hdpi/icon.png" COPYONLY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/drawable-ldpi/icon.png"
|
||||
"${PACKAGE_DIR}/res/drawable-ldpi/icon.png" COPYONLY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/drawable-mdpi/icon.png"
|
||||
"${PACKAGE_DIR}/res/drawable-mdpi/icon.png" COPYONLY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/layout/main.xml"
|
||||
"${PACKAGE_DIR}/res/layout/main.xml" COPYONLY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assets/_keystore/wagic-release.keystore"
|
||||
"${PACKAGE_DIR}/assets/_keystore/wagic-release.keystore" COPYONLY)
|
||||
|
||||
string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL_NUMBER "${ANDROID_NATIVE_API_LEVEL}" )
|
||||
|
||||
set(target_name "Wagic_${WAGIC_VERSION}_binary_pack_${ANDROID_PACKAGE_PLATFORM}")
|
||||
get_target_property(wagic_location wagic LOCATION)
|
||||
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} android_build_type)
|
||||
|
||||
set(android_proj_target_files ${ANDROID_PROJECT_FILES})
|
||||
list_add_prefix(android_proj_target_files "${PACKAGE_DIR}/")
|
||||
set(APK_NAME "${PACKAGE_DIR}/bin/${target_name}-${android_build_type}-unsigned.apk")
|
||||
|
||||
file(GLOB camera_wrappers "${OpenCV_SOURCE_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}/libnative_camera_r*.so")
|
||||
set(CAMERA_LIB_COMMANDS "")
|
||||
|
||||
foreach(wrapper ${camera_wrappers})
|
||||
list(APPEND CAMERA_LIB_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/")
|
||||
endforeach()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${APK_NAME}"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/libs"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/bin"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/gen"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${android_proj_target_files}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_DIR}/src"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/"
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy "${SDL2_LIBRARY}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/"
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy "${ZLIB_LIBRARY}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/"
|
||||
# COMMAND ${CMAKE_COMMAND} -E copy "${OPENSL_LIBRARY}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${wagic_location}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/src" "${PACKAGE_DIR}/src"
|
||||
# COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${PACKAGE_DIR}" --target "android-${ANDROID_NATIVE_API_LEVEL}" --name "${target_name}"
|
||||
COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${PACKAGE_DIR}" --target "android-10" --name "${target_name}"
|
||||
COMMAND ${ANT_EXECUTABLE} -noinput -k ${android_build_type}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${APK_NAME}"
|
||||
WORKING_DIRECTORY "${PACKAGE_DIR}"
|
||||
MAIN_DEPENDENCY "${PACKAGE_DIR}/${ANDROID_MANIFEST_FILE}"
|
||||
DEPENDS
|
||||
"${PACKAGE_DIR}/res/values/strings.xml"
|
||||
"${PACKAGE_DIR}/res/layout/main.xml"
|
||||
"${PACKAGE_DIR}/res/drawable-mdpi/icon.png"
|
||||
"${PACKAGE_DIR}/res/drawable-ldpi/icon.png"
|
||||
"${PACKAGE_DIR}/res/drawable-hdpi/icon.png"
|
||||
"${PACKAGE_DIR}/${ANDROID_MANIFEST_FILE}"
|
||||
wagic
|
||||
)
|
||||
|
||||
install(FILES "${APK_NAME}" DESTINATION "apk/" COMPONENT main)
|
||||
add_custom_target(android_package ALL SOURCES "${APK_NAME}" )
|
||||
add_dependencies(android_package wagic)
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/mainLayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Wagic"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Wagic</string>
|
||||
<string name="app_version">0.19.2</string>
|
||||
<string name="info_text">Wagic v0.19.2\\nAll Rights Reserved.</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,174 @@
|
||||
package net.wagic.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
public class StorageOptions
|
||||
{
|
||||
private static ArrayList<String> mMounts = new ArrayList<String>();
|
||||
private static ArrayList<String> mVold = new ArrayList<String>();
|
||||
|
||||
public static String[] labels;
|
||||
public static String[] paths;
|
||||
public static int count = 0;
|
||||
public static String defaultMountPoint;
|
||||
|
||||
public static void determineStorageOptions()
|
||||
{
|
||||
initializeMountPoints();
|
||||
readMountsFile();
|
||||
readVoldFile();
|
||||
compareMountsWithVold();
|
||||
testAndCleanMountsList();
|
||||
setProperties();
|
||||
}
|
||||
|
||||
private static void initializeMountPoints()
|
||||
{
|
||||
try
|
||||
{
|
||||
defaultMountPoint = Environment.getExternalStorageDirectory().getCanonicalPath();
|
||||
} catch (Exception ioEx)
|
||||
{
|
||||
// an error occurred trying to get the canonical path, use '/mnt/sdcard' instead
|
||||
defaultMountPoint = "/mnt/sdcard";
|
||||
}
|
||||
}
|
||||
|
||||
private static void readMountsFile()
|
||||
{
|
||||
/*
|
||||
* Scan the /proc/mounts file and look for lines like this: /dev/block/vold/179:1 /mnt/sdcard vfat
|
||||
* rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
|
||||
*
|
||||
* When one is found, split it into its elements and then pull out the path to the that mount point and add it to the arraylist
|
||||
*/
|
||||
|
||||
try
|
||||
{
|
||||
Scanner scanner = new Scanner(new File("/proc/mounts"));
|
||||
while (scanner.hasNext())
|
||||
{
|
||||
String line = scanner.nextLine();
|
||||
if (line.startsWith("/dev/block/vold/"))
|
||||
{
|
||||
String[] lineElements = line.split(" ");
|
||||
lineElements[1].replaceAll(":.*$", "");
|
||||
mMounts.add(lineElements[1]);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException fnfex)
|
||||
{
|
||||
// if proc/mount doesn't exist we just use
|
||||
Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
|
||||
mMounts.add(defaultMountPoint);
|
||||
} catch (Exception e)
|
||||
{
|
||||
Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file");
|
||||
mMounts.add(defaultMountPoint);
|
||||
}
|
||||
}
|
||||
|
||||
private static void readVoldFile()
|
||||
{
|
||||
/*
|
||||
* Scan the /system/etc/vold.fstab file and look for lines like this: dev_mount sdcard /mnt/sdcard 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0
|
||||
*
|
||||
* When one is found, split it into its elements and then pull out the path to the that mount point and add it to the arraylist
|
||||
*/
|
||||
|
||||
try
|
||||
{
|
||||
Scanner scanner = new Scanner(new File("/system/etc/vold.fstab"));
|
||||
while (scanner.hasNext())
|
||||
{
|
||||
String line = scanner.nextLine();
|
||||
if (line.startsWith("dev_mount"))
|
||||
{
|
||||
String[] lineElements = line.split(" ");
|
||||
lineElements[2] = lineElements[2].replaceAll(":.*$", "");
|
||||
mVold.add(lineElements[2]);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException fnfex)
|
||||
{
|
||||
// if vold.fstab doesn't exist we use the value gathered from the Environment
|
||||
Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point");
|
||||
mMounts.add(defaultMountPoint);
|
||||
} catch (Exception e)
|
||||
{
|
||||
Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file");
|
||||
mMounts.add(defaultMountPoint);
|
||||
}
|
||||
}
|
||||
|
||||
private static void compareMountsWithVold()
|
||||
{
|
||||
/*
|
||||
* Sometimes the two lists of mount points will be different. We only want those mount points that are in both list.
|
||||
*
|
||||
* Compare the two lists together and remove items that are not in both lists.
|
||||
*/
|
||||
|
||||
for (int i = 0; i < mMounts.size(); i++)
|
||||
{
|
||||
String mount = mMounts.get(i);
|
||||
if (!mVold.contains(mount))
|
||||
mMounts.remove(i--);
|
||||
}
|
||||
|
||||
// don't need this anymore, clear the vold list to reduce memory
|
||||
// use and to prepare it for the next time it's needed.
|
||||
mVold.clear();
|
||||
}
|
||||
|
||||
private static void testAndCleanMountsList()
|
||||
{
|
||||
/*
|
||||
* Now that we have a cleaned list of mount paths Test each one to make sure it's a valid and available path. If it is not, remove it from the list.
|
||||
*/
|
||||
|
||||
for (int i = 0; i < mMounts.size(); i++)
|
||||
{
|
||||
String mount = mMounts.get(i);
|
||||
File root = new File(mount);
|
||||
if (!root.exists() || !root.isDirectory() || !root.canWrite())
|
||||
mMounts.remove(i--);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setProperties()
|
||||
{
|
||||
/*
|
||||
* At this point all the paths in the list should be valid. Build the public properties.
|
||||
*/
|
||||
|
||||
ArrayList<String> mLabels = new ArrayList<String>();
|
||||
|
||||
int i = 1;
|
||||
for (String path : mMounts)
|
||||
{ // TODO: /mnt/sdcard is assumed to always mean internal storage. Use this comparison until there is a better way to do this
|
||||
if ("/mnt/sdcard".equalsIgnoreCase(path))
|
||||
mLabels.add("Built-in Storage");
|
||||
else
|
||||
mLabels.add("External SD Card " + i++);
|
||||
}
|
||||
|
||||
labels = new String[mLabels.size()];
|
||||
mLabels.toArray(labels);
|
||||
|
||||
paths = new String[mMounts.size()];
|
||||
mMounts.toArray(paths);
|
||||
|
||||
count = Math.min(labels.length, paths.length);
|
||||
|
||||
// don't need this anymore, clear the mounts list to reduce memory
|
||||
// use and to prepare it for the next time it's needed.
|
||||
mMounts.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,771 @@
|
||||
package org.libsdl.app;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import android.app.*;
|
||||
import android.content.*;
|
||||
import android.view.*;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AbsoluteLayout;
|
||||
import android.os.*;
|
||||
import android.util.Log;
|
||||
import android.graphics.*;
|
||||
import android.media.*;
|
||||
import android.hardware.*;
|
||||
|
||||
|
||||
/**
|
||||
SDL Activity
|
||||
*/
|
||||
public class SDLActivity extends Activity {
|
||||
private static final String TAG = "SDL";
|
||||
|
||||
// Keep track of the paused state
|
||||
public static boolean mIsPaused = false, mIsSurfaceReady = false, mHasFocus = true;
|
||||
|
||||
// Main components
|
||||
protected static SDLActivity mSingleton;
|
||||
protected static SDLSurface mSurface;
|
||||
protected static View mTextEdit;
|
||||
protected static ViewGroup mLayout;
|
||||
|
||||
// This is what SDL runs in. It invokes SDL_main(), eventually
|
||||
protected static Thread mSDLThread;
|
||||
|
||||
// Audio
|
||||
protected static Thread mAudioThread;
|
||||
protected static AudioTrack mAudioTrack;
|
||||
|
||||
// Load the .so
|
||||
static {
|
||||
System.loadLibrary("SDL2");
|
||||
//System.loadLibrary("SDL2_image");
|
||||
//System.loadLibrary("SDL2_mixer");
|
||||
//System.loadLibrary("SDL2_net");
|
||||
//System.loadLibrary("SDL2_ttf");
|
||||
System.loadLibrary("wagic");
|
||||
}
|
||||
|
||||
// Setup
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
//Log.v("SDL", "onCreate()");
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// So we can call stuff from static callbacks
|
||||
mSingleton = this;
|
||||
|
||||
// Set up the surface
|
||||
mSurface = new SDLSurface(getApplication());
|
||||
|
||||
mLayout = new AbsoluteLayout(this);
|
||||
mLayout.addView(mSurface);
|
||||
|
||||
setContentView(mLayout);
|
||||
}
|
||||
|
||||
// Events
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.v("SDL", "onPause()");
|
||||
super.onPause();
|
||||
SDLActivity.handlePause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.v("SDL", "onResume()");
|
||||
super.onResume();
|
||||
SDLActivity.handleResume();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
Log.v("SDL", "onWindowFocusChanged(): " + hasFocus);
|
||||
|
||||
SDLActivity.mHasFocus = hasFocus;
|
||||
if (hasFocus) {
|
||||
SDLActivity.handleResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
Log.v("SDL", "onLowMemory()");
|
||||
super.onLowMemory();
|
||||
SDLActivity.nativeLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.v("SDL", "onDestroy()");
|
||||
// Send a quit message to the application
|
||||
SDLActivity.nativeQuit();
|
||||
|
||||
// Now wait for the SDL thread to quit
|
||||
if (mSDLThread != null) {
|
||||
try {
|
||||
mSDLThread.join();
|
||||
} catch(Exception e) {
|
||||
Log.v("SDL", "Problem stopping thread: " + e);
|
||||
}
|
||||
mSDLThread = null;
|
||||
|
||||
//Log.v("SDL", "Finished waiting for SDL thread");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
int keyCode = event.getKeyCode();
|
||||
// Ignore certain special keys so they're handled by Android
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
|
||||
keyCode == KeyEvent.KEYCODE_CAMERA ||
|
||||
keyCode == 168 || /* API 11: KeyEvent.KEYCODE_ZOOM_IN */
|
||||
keyCode == 169 /* API 11: KeyEvent.KEYCODE_ZOOM_OUT */
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
/** Called by onPause or surfaceDestroyed. Even if surfaceDestroyed
|
||||
* is the first to be called, mIsSurfaceReady should still be set
|
||||
* to 'true' during the call to onPause (in a usual scenario).
|
||||
*/
|
||||
public static void handlePause() {
|
||||
if (!SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady) {
|
||||
SDLActivity.mIsPaused = true;
|
||||
SDLActivity.nativePause();
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, false);
|
||||
}
|
||||
}
|
||||
|
||||
/** Called by onResume or surfaceCreated. An actual resume should be done only when the surface is ready.
|
||||
* Note: Some Android variants may send multiple surfaceChanged events, so we don't need to resume
|
||||
* every time we get one of those events, only if it comes after surfaceDestroyed
|
||||
*/
|
||||
public static void handleResume() {
|
||||
if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) {
|
||||
SDLActivity.mIsPaused = false;
|
||||
SDLActivity.nativeResume();
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Messages from the SDLMain thread
|
||||
static final int COMMAND_CHANGE_TITLE = 1;
|
||||
static final int COMMAND_UNUSED = 2;
|
||||
static final int COMMAND_TEXTEDIT_HIDE = 3;
|
||||
|
||||
protected static final int COMMAND_USER = 0x8000;
|
||||
|
||||
/**
|
||||
* This method is called by SDL if SDL did not handle a message itself.
|
||||
* This happens if a received message contains an unsupported command.
|
||||
* Method can be overwritten to handle Messages in a different class.
|
||||
* @param command the command of the message.
|
||||
* @param param the parameter of the message. May be null.
|
||||
* @return if the message was handled in overridden method.
|
||||
*/
|
||||
protected boolean onUnhandledMessage(int command, Object param) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Handler class for Messages from native SDL applications.
|
||||
* It uses current Activities as target (e.g. for the title).
|
||||
* static to prevent implicit references to enclosing object.
|
||||
*/
|
||||
protected static class SDLCommandHandler extends Handler {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
Log.e(TAG, "error handling message, getContext() returned null");
|
||||
return;
|
||||
}
|
||||
switch (msg.arg1) {
|
||||
case COMMAND_CHANGE_TITLE:
|
||||
if (context instanceof Activity) {
|
||||
((Activity) context).setTitle((String)msg.obj);
|
||||
} else {
|
||||
Log.e(TAG, "error handling message, getContext() returned no Activity");
|
||||
}
|
||||
break;
|
||||
case COMMAND_TEXTEDIT_HIDE:
|
||||
if (mTextEdit != null) {
|
||||
mTextEdit.setVisibility(View.GONE);
|
||||
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) {
|
||||
Log.e(TAG, "error handling message, command is " + msg.arg1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handler for the messages
|
||||
Handler commandHandler = new SDLCommandHandler();
|
||||
|
||||
// Send a message from the SDLMain thread
|
||||
boolean sendCommand(int command, Object data) {
|
||||
Message msg = commandHandler.obtainMessage();
|
||||
msg.arg1 = command;
|
||||
msg.obj = data;
|
||||
return commandHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
// C functions we call
|
||||
public static native void nativeInit();
|
||||
public static native void nativeLowMemory();
|
||||
public static native void nativeQuit();
|
||||
public static native void nativePause();
|
||||
public static native void nativeResume();
|
||||
public static native void onNativeResize(int x, int y, int format);
|
||||
public static native void onNativeKeyDown(int keycode);
|
||||
public static native void onNativeKeyUp(int keycode);
|
||||
public static native void onNativeKeyboardFocusLost();
|
||||
public static native void onNativeTouch(int touchDevId, int pointerFingerId,
|
||||
int action, float x,
|
||||
float y, float p);
|
||||
public static native void onNativeAccel(float x, float y, float z);
|
||||
public static native void onNativeSurfaceChanged();
|
||||
public static native void onNativeSurfaceDestroyed();
|
||||
public static native void nativeFlipBuffers();
|
||||
|
||||
public static void flipBuffers() {
|
||||
SDLActivity.nativeFlipBuffers();
|
||||
}
|
||||
|
||||
public static boolean setActivityTitle(String title) {
|
||||
// Called from SDLMain() thread and can't directly affect the view
|
||||
return mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title);
|
||||
}
|
||||
|
||||
public static boolean sendMessage(int command, int param) {
|
||||
return mSingleton.sendCommand(command, Integer.valueOf(param));
|
||||
}
|
||||
|
||||
public static Context getContext() {
|
||||
return mSingleton;
|
||||
}
|
||||
|
||||
static class ShowTextInputTask implements Runnable {
|
||||
/*
|
||||
* This is used to regulate the pan&scan method to have some offset from
|
||||
* the bottom edge of the input region and the top edge of an input
|
||||
* method (soft keyboard)
|
||||
*/
|
||||
static final int HEIGHT_PADDING = 15;
|
||||
|
||||
public int x, y, w, h;
|
||||
|
||||
public ShowTextInputTask(int x, int y, int w, int h) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(
|
||||
w, h + HEIGHT_PADDING, x, y);
|
||||
|
||||
if (mTextEdit == null) {
|
||||
mTextEdit = new DummyEdit(getContext());
|
||||
|
||||
mLayout.addView(mTextEdit, params);
|
||||
} else {
|
||||
mTextEdit.setLayoutParams(params);
|
||||
}
|
||||
|
||||
mTextEdit.setVisibility(View.VISIBLE);
|
||||
mTextEdit.requestFocus();
|
||||
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(mTextEdit, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean showTextInput(int x, int y, int w, int h) {
|
||||
// Transfer the task to the main thread as a Runnable
|
||||
return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h));
|
||||
}
|
||||
|
||||
public static Surface getNativeSurface() {
|
||||
return SDLActivity.mSurface.getNativeSurface();
|
||||
}
|
||||
|
||||
// Audio
|
||||
public static int audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) {
|
||||
int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO : AudioFormat.CHANNEL_CONFIGURATION_MONO;
|
||||
int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT;
|
||||
int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1);
|
||||
|
||||
Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + (sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
|
||||
|
||||
// Let the user pick a larger buffer if they really want -- but ye
|
||||
// gods they probably shouldn't, the minimums are horrifyingly high
|
||||
// latency already
|
||||
desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize);
|
||||
|
||||
if (mAudioTrack == null) {
|
||||
mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate,
|
||||
channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM);
|
||||
|
||||
// Instantiating AudioTrack can "succeed" without an exception and the track may still be invalid
|
||||
// Ref: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/media/java/android/media/AudioTrack.java
|
||||
// Ref: http://developer.android.com/reference/android/media/AudioTrack.html#getState()
|
||||
|
||||
if (mAudioTrack.getState() != AudioTrack.STATE_INITIALIZED) {
|
||||
Log.e("SDL", "Failed during initialization of Audio Track");
|
||||
mAudioTrack = null;
|
||||
return -1;
|
||||
}
|
||||
|
||||
mAudioTrack.play();
|
||||
}
|
||||
|
||||
Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + (mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void audioWriteShortBuffer(short[] buffer) {
|
||||
for (int i = 0; i < buffer.length; ) {
|
||||
int result = mAudioTrack.write(buffer, i, buffer.length - i);
|
||||
if (result > 0) {
|
||||
i += result;
|
||||
} else if (result == 0) {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch(InterruptedException e) {
|
||||
// Nom nom
|
||||
}
|
||||
} else {
|
||||
Log.w("SDL", "SDL audio: error return from write(short)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void audioWriteByteBuffer(byte[] buffer) {
|
||||
for (int i = 0; i < buffer.length; ) {
|
||||
int result = mAudioTrack.write(buffer, i, buffer.length - i);
|
||||
if (result > 0) {
|
||||
i += result;
|
||||
} else if (result == 0) {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch(InterruptedException e) {
|
||||
// Nom nom
|
||||
}
|
||||
} else {
|
||||
Log.w("SDL", "SDL audio: error return from write(byte)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void audioQuit() {
|
||||
if (mAudioTrack != null) {
|
||||
mAudioTrack.stop();
|
||||
mAudioTrack = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Input
|
||||
|
||||
/**
|
||||
* @return an array which may be empty but is never null.
|
||||
*/
|
||||
public static int[] inputGetInputDeviceIds(int sources) {
|
||||
int[] ids = InputDevice.getDeviceIds();
|
||||
int[] filtered = new int[ids.length];
|
||||
int used = 0;
|
||||
for (int i = 0; i < ids.length; ++i) {
|
||||
InputDevice device = InputDevice.getDevice(ids[i]);
|
||||
if ((device != null) && ((device.getSources() & sources) != 0)) {
|
||||
filtered[used++] = device.getId();
|
||||
}
|
||||
}
|
||||
return Arrays.copyOf(filtered, used);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Simple nativeInit() runnable
|
||||
*/
|
||||
class SDLMain implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
// Runs SDL_main()
|
||||
SDLActivity.nativeInit();
|
||||
|
||||
//Log.v("SDL", "SDL thread terminated");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
SDLSurface. This is what we draw on, so we need to know when it's created
|
||||
in order to do anything useful.
|
||||
|
||||
Because of this, that's where we set up the SDL thread
|
||||
*/
|
||||
class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||
View.OnKeyListener, View.OnTouchListener, SensorEventListener {
|
||||
|
||||
// Sensors
|
||||
protected static SensorManager mSensorManager;
|
||||
protected static Display mDisplay;
|
||||
|
||||
// Keep track of the surface size to normalize touch events
|
||||
protected static float mWidth, mHeight;
|
||||
|
||||
// Startup
|
||||
public SDLSurface(Context context) {
|
||||
super(context);
|
||||
getHolder().addCallback(this);
|
||||
|
||||
setFocusable(true);
|
||||
setFocusableInTouchMode(true);
|
||||
requestFocus();
|
||||
setOnKeyListener(this);
|
||||
setOnTouchListener(this);
|
||||
|
||||
mDisplay = ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
|
||||
|
||||
// Some arbitrary defaults to avoid a potential division by zero
|
||||
mWidth = 1.0f;
|
||||
mHeight = 1.0f;
|
||||
}
|
||||
|
||||
public Surface getNativeSurface() {
|
||||
return getHolder().getSurface();
|
||||
}
|
||||
|
||||
// Called when we have a valid drawing surface
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
Log.v("SDL", "surfaceCreated()");
|
||||
holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
|
||||
}
|
||||
|
||||
// Called when we lose the surface
|
||||
@Override
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
Log.v("SDL", "surfaceDestroyed()");
|
||||
// Call this *before* setting mIsSurfaceReady to 'false'
|
||||
SDLActivity.handlePause();
|
||||
SDLActivity.mIsSurfaceReady = false;
|
||||
SDLActivity.onNativeSurfaceDestroyed();
|
||||
}
|
||||
|
||||
// Called when the surface is resized
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder,
|
||||
int format, int width, int height) {
|
||||
Log.v("SDL", "surfaceChanged()");
|
||||
|
||||
int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default
|
||||
switch (format) {
|
||||
case PixelFormat.A_8:
|
||||
Log.v("SDL", "pixel format A_8");
|
||||
break;
|
||||
case PixelFormat.LA_88:
|
||||
Log.v("SDL", "pixel format LA_88");
|
||||
break;
|
||||
case PixelFormat.L_8:
|
||||
Log.v("SDL", "pixel format L_8");
|
||||
break;
|
||||
case PixelFormat.RGBA_4444:
|
||||
Log.v("SDL", "pixel format RGBA_4444");
|
||||
sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444
|
||||
break;
|
||||
case PixelFormat.RGBA_5551:
|
||||
Log.v("SDL", "pixel format RGBA_5551");
|
||||
sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551
|
||||
break;
|
||||
case PixelFormat.RGBA_8888:
|
||||
Log.v("SDL", "pixel format RGBA_8888");
|
||||
sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888
|
||||
break;
|
||||
case PixelFormat.RGBX_8888:
|
||||
Log.v("SDL", "pixel format RGBX_8888");
|
||||
sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888
|
||||
break;
|
||||
case PixelFormat.RGB_332:
|
||||
Log.v("SDL", "pixel format RGB_332");
|
||||
sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332
|
||||
break;
|
||||
case PixelFormat.RGB_565:
|
||||
Log.v("SDL", "pixel format RGB_565");
|
||||
sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565
|
||||
break;
|
||||
case PixelFormat.RGB_888:
|
||||
Log.v("SDL", "pixel format RGB_888");
|
||||
// Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
|
||||
sdlFormat = 0x16161804; // SDL_PIXELFORMAT_RGB888
|
||||
break;
|
||||
default:
|
||||
Log.v("SDL", "pixel format unknown " + format);
|
||||
break;
|
||||
}
|
||||
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
SDLActivity.onNativeResize(width, height, sdlFormat);
|
||||
Log.v("SDL", "Window size:" + width + "x"+height);
|
||||
|
||||
// Set mIsSurfaceReady to 'true' *before* making a call to handleResume
|
||||
SDLActivity.mIsSurfaceReady = true;
|
||||
SDLActivity.onNativeSurfaceChanged();
|
||||
|
||||
|
||||
if (SDLActivity.mSDLThread == null) {
|
||||
// This is the entry point to the C app.
|
||||
// Start up the C app thread and enable sensor input for the first time
|
||||
|
||||
SDLActivity.mSDLThread = new Thread(new SDLMain(), "SDLThread");
|
||||
enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
SDLActivity.mSDLThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
// unused
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {}
|
||||
|
||||
|
||||
// Key events
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
//Log.v("SDL", "key down: " + keyCode);
|
||||
SDLActivity.onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
}
|
||||
else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
//Log.v("SDL", "key up: " + keyCode);
|
||||
SDLActivity.onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Touch events
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
final int touchDevId = event.getDeviceId();
|
||||
final int pointerCount = event.getPointerCount();
|
||||
// touchId, pointerId, action, x, y, pressure
|
||||
int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */
|
||||
int pointerFingerId = event.getPointerId(actionPointerIndex);
|
||||
int action = (event.getAction() & MotionEvent.ACTION_MASK); /* API 8: event.getActionMasked(); */
|
||||
|
||||
float x = event.getX(actionPointerIndex) / mWidth;
|
||||
float y = event.getY(actionPointerIndex) / mHeight;
|
||||
float p = event.getPressure(actionPointerIndex);
|
||||
|
||||
if (action == MotionEvent.ACTION_MOVE && pointerCount > 1) {
|
||||
// TODO send motion to every pointer if its position has
|
||||
// changed since prev event.
|
||||
for (int i = 0; i < pointerCount; i++) {
|
||||
pointerFingerId = event.getPointerId(i);
|
||||
x = event.getX(i) / mWidth;
|
||||
y = event.getY(i) / mHeight;
|
||||
p = event.getPressure(i);
|
||||
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
|
||||
}
|
||||
} else {
|
||||
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Sensor events
|
||||
public void enableSensor(int sensortype, boolean enabled) {
|
||||
// TODO: This uses getDefaultSensor - what if we have >1 accels?
|
||||
if (enabled) {
|
||||
mSensorManager.registerListener(this,
|
||||
mSensorManager.getDefaultSensor(sensortype),
|
||||
SensorManager.SENSOR_DELAY_GAME, null);
|
||||
} else {
|
||||
mSensorManager.unregisterListener(this,
|
||||
mSensorManager.getDefaultSensor(sensortype));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
|
||||
float x, y;
|
||||
switch (mDisplay.getRotation()) {
|
||||
case Surface.ROTATION_90:
|
||||
x = -event.values[1];
|
||||
y = event.values[0];
|
||||
break;
|
||||
case Surface.ROTATION_270:
|
||||
x = event.values[1];
|
||||
y = -event.values[0];
|
||||
break;
|
||||
case Surface.ROTATION_180:
|
||||
x = -event.values[1];
|
||||
y = -event.values[0];
|
||||
break;
|
||||
default:
|
||||
x = event.values[0];
|
||||
y = event.values[1];
|
||||
break;
|
||||
}
|
||||
SDLActivity.onNativeAccel(-x / SensorManager.GRAVITY_EARTH,
|
||||
y / SensorManager.GRAVITY_EARTH,
|
||||
event.values[2] / SensorManager.GRAVITY_EARTH - 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* This is a fake invisible editor view that receives the input and defines the
|
||||
* pan&scan region
|
||||
*/
|
||||
class DummyEdit extends View implements View.OnKeyListener {
|
||||
InputConnection ic;
|
||||
|
||||
public DummyEdit(Context context) {
|
||||
super(context);
|
||||
setFocusableInTouchMode(true);
|
||||
setFocusable(true);
|
||||
setOnKeyListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckIsTextEditor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
|
||||
// This handles the hardware keyboard input
|
||||
if (event.isPrintingKey()) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
SDLActivity.onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
SDLActivity.onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
public boolean onKeyPreIme (int keyCode, KeyEvent event) {
|
||||
// As seen on StackOverflow: http://stackoverflow.com/questions/7634346/keyboard-hide-event
|
||||
// FIXME: Discussion at http://bugzilla.libsdl.org/show_bug.cgi?id=1639
|
||||
// FIXME: This is not a 100% effective solution to the problem of detecting if the keyboard is showing or not
|
||||
// FIXME: A more effective solution would be to change our Layout from AbsoluteLayout to Relative or Linear
|
||||
// FIXME: And determine the keyboard presence doing this: http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android
|
||||
// FIXME: An even more effective way would be if Android provided this out of the box, but where would the fun be in that :)
|
||||
if (event.getAction()==KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (SDLActivity.mTextEdit != null && SDLActivity.mTextEdit.getVisibility() == View.VISIBLE) {
|
||||
SDLActivity.onNativeKeyboardFocusLost();
|
||||
}
|
||||
}
|
||||
return super.onKeyPreIme(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
ic = new SDLInputConnection(this, true);
|
||||
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
|
||||
| 33554432 /* API 11: EditorInfo.IME_FLAG_NO_FULLSCREEN */;
|
||||
|
||||
return ic;
|
||||
}
|
||||
}
|
||||
|
||||
class SDLInputConnection extends BaseInputConnection {
|
||||
|
||||
public SDLInputConnection(View targetView, boolean fullEditor) {
|
||||
super(targetView, fullEditor);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
|
||||
/*
|
||||
* This handles the keycodes from soft keyboard (and IME-translated
|
||||
* input from hardkeyboard)
|
||||
*/
|
||||
int keyCode = event.getKeyCode();
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (event.isPrintingKey()) {
|
||||
commitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
}
|
||||
SDLActivity.onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
|
||||
SDLActivity.onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
return super.sendKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean commitText(CharSequence text, int newCursorPosition) {
|
||||
|
||||
nativeCommitText(text.toString(), newCursorPosition);
|
||||
|
||||
return super.commitText(text, newCursorPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setComposingText(CharSequence text, int newCursorPosition) {
|
||||
|
||||
nativeSetComposingText(text.toString(), newCursorPosition);
|
||||
|
||||
return super.setComposingText(text, newCursorPosition);
|
||||
}
|
||||
|
||||
public native void nativeCommitText(String text, int newCursorPosition);
|
||||
|
||||
public native void nativeSetComposingText(String text, int newCursorPosition);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
set(CMAKE_CXX_FLAGS "-s USE_SDL=2 -s USE_ZLIB=1 -s FULL_ES2=1 -std=c++11 -s TOTAL_MEMORY=16777216 -O0 --preload-file ../../../projects/mtg/bin/Res@/")
|
||||
#set(CMAKE_CXX_FLAGS "-s USE_SDL=2 -s FULL_ES2=1 -std=c++11 -g4 -s ALLOW_MEMORY_GROWTH=1 --preload-file ../../../projects/mtg/bin/Res@/")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
add_definitions(-DLINUX)
|
||||
add_definitions(-D_DEBUG)
|
||||
add_definitions(-DUSERDIR=".wagic")
|
||||
add_definitions(-DRESDIR="/")
|
||||
add_definitions(-DGL_ES_VERSION_2_0)
|
||||
@@ -0,0 +1,5 @@
|
||||
add_definitions(-DLINUX)
|
||||
add_definitions(-DUSERDIR=".wagic")
|
||||
add_definitions(-DRESDIR="Res")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++0x")
|
||||
set(CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
|
||||
@@ -0,0 +1,5 @@
|
||||
add_definitions(-DPSP -G0)
|
||||
add_definitions(-D_PSP_FW_VERSION=371)
|
||||
add_definitions(-DDEVHOOK -DPSPFW3XX)
|
||||
|
||||
include_directories(${PSPSDK_PATH}/include)
|
||||
@@ -0,0 +1,4 @@
|
||||
add_definitions(-DLINUX)
|
||||
add_definitions(-DUSERDIR=".wagic")
|
||||
add_definitions(-DRESDIR="Res")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
@@ -0,0 +1,3 @@
|
||||
add_definitions(-DWIN32)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
@@ -0,0 +1,233 @@
|
||||
#MTGs common sources
|
||||
set(MTG_generic_src
|
||||
src/AbilityParser.cpp
|
||||
src/ActionElement.cpp
|
||||
src/ActionLayer.cpp
|
||||
src/ActionStack.cpp
|
||||
src/AIHints.cpp
|
||||
src/AIMomirPlayer.cpp
|
||||
src/AIPlayer.cpp
|
||||
src/AIPlayerBaka.cpp
|
||||
src/AIStats.cpp
|
||||
src/AllAbilities.cpp
|
||||
src/CardDescriptor.cpp
|
||||
src/CardDisplay.cpp
|
||||
src/CardGui.cpp
|
||||
src/CardPrimitive.cpp
|
||||
src/CardSelector.cpp
|
||||
src/CardSelectorSingleton.cpp
|
||||
src/CarouselDeckView.cpp
|
||||
src/Closest.cpp
|
||||
src/Counters.cpp
|
||||
src/Credits.cpp
|
||||
src/Damage.cpp
|
||||
src/DamagerDamaged.cpp
|
||||
src/DeckDataWrapper.cpp
|
||||
src/DeckEditorMenu.cpp
|
||||
src/DeckManager.cpp
|
||||
src/DeckMenu.cpp
|
||||
src/DeckMenuItem.cpp
|
||||
src/DeckMetaData.cpp
|
||||
src/DeckStats.cpp
|
||||
src/DeckView.cpp
|
||||
src/DuelLayers.cpp
|
||||
src/ExtraCost.cpp
|
||||
src/GameApp.cpp
|
||||
src/GameLauncher.cpp
|
||||
src/GameObserver.cpp
|
||||
src/GameOptions.cpp
|
||||
src/GameStateAwards.cpp
|
||||
src/GameState.cpp
|
||||
src/GameStateDeckViewer.cpp
|
||||
src/GameStateDuel.cpp
|
||||
src/GameStateMenu.cpp
|
||||
src/GameStateOptions.cpp
|
||||
src/GameStateShop.cpp
|
||||
src/GameStateStory.cpp
|
||||
src/GameStateTransitions.cpp
|
||||
src/GridDeckView.cpp
|
||||
src/GuiAvatars.cpp
|
||||
src/GuiBackground.cpp
|
||||
src/GuiCardsController.cpp
|
||||
src/GuiCombat.cpp
|
||||
src/GuiFrame.cpp
|
||||
src/GuiHand.cpp
|
||||
src/GuiLayers.cpp
|
||||
src/GuiMana.cpp
|
||||
src/GuiPhaseBar.cpp
|
||||
src/GuiPlay.cpp
|
||||
src/GuiStatic.cpp
|
||||
src/IconButton.cpp
|
||||
src/InteractiveButton.cpp
|
||||
src/ManaCost.cpp
|
||||
src/ManaCostHybrid.cpp
|
||||
src/MenuItem.cpp
|
||||
src/ModRules.cpp
|
||||
src/MTGAbility.cpp
|
||||
src/MTGCard.cpp
|
||||
src/MTGCardInstance.cpp
|
||||
src/MTGDeck.cpp
|
||||
src/MTGDefinitions.cpp
|
||||
src/MTGGamePhase.cpp
|
||||
src/MTGGameZones.cpp
|
||||
src/MTGPack.cpp
|
||||
src/MTGRules.cpp
|
||||
src/ObjectAnalytics.cpp
|
||||
src/OptionItem.cpp
|
||||
src/PhaseRing.cpp
|
||||
src/Player.cpp
|
||||
src/PlayerData.cpp
|
||||
src/PlayGuiObject.cpp
|
||||
src/PlayGuiObjectController.cpp
|
||||
src/PlayRestrictions.cpp
|
||||
src/Pos.cpp
|
||||
src/PriceList.cpp
|
||||
src/ReplacementEffects.cpp
|
||||
src/Rules.cpp
|
||||
src/SimpleMenu.cpp
|
||||
src/SimpleMenuItem.cpp
|
||||
src/SimpleButton.cpp
|
||||
src/SimplePad.cpp
|
||||
src/SimplePopup.cpp
|
||||
src/StoryFlow.cpp
|
||||
src/Subtypes.cpp
|
||||
src/StyleManager.cpp
|
||||
src/TargetChooser.cpp
|
||||
src/TargetsList.cpp
|
||||
src/Tasks.cpp
|
||||
src/TextScroller.cpp
|
||||
src/ThisDescriptor.cpp
|
||||
src/Token.cpp
|
||||
src/Translate.cpp
|
||||
src/TranslateKeys.cpp
|
||||
src/Trash.cpp
|
||||
src/utils.cpp
|
||||
src/WCachedResource.cpp
|
||||
src/WDataSrc.cpp
|
||||
src/WEvent.cpp
|
||||
src/WFilter.cpp
|
||||
src/WFont.cpp
|
||||
src/WGui.cpp
|
||||
src/WResourceManager.cpp
|
||||
)
|
||||
|
||||
set(MTG_network_src src/NetworkPlayer.cpp)
|
||||
|
||||
#the sources we need if we compile a graphical qt version
|
||||
#TODO: add declarative version since this only works with QWidget right now
|
||||
set(MTG_qt_graphic_src
|
||||
src/qt/filedownloader.cpp
|
||||
src/qt/corewrapper.cpp
|
||||
include/qt/corewrapper.h #so automoc finds it
|
||||
include/qt/filedownloader.h
|
||||
src/Qtmain.cpp)
|
||||
|
||||
#the sources we need to compile the testsuit
|
||||
set(MTG_qt_console_src
|
||||
src/Qtconsole.cpp
|
||||
src/TestSuiteAI.cpp)
|
||||
|
||||
set(MTG_sdl_src
|
||||
src/SDLmain.cpp)
|
||||
|
||||
set(MTG_android_sdl_src
|
||||
src/SDLmain.cpp)
|
||||
|
||||
set(MTG_iOS_src
|
||||
iOS/UI/WagicDownloadProgressViewController.m
|
||||
iOS/asi-http-request/ASIAuthenticationDialog.m
|
||||
iOS/asi-http-request/ASIDataCompressor.m
|
||||
iOS/asi-http-request/ASIDataDecompressor.m
|
||||
iOS/asi-http-request/ASIDownloadCache.m
|
||||
iOS/asi-http-request/ASIFormDataRequest.m
|
||||
iOS/asi-http-request/ASIHTTPRequest.m
|
||||
iOS/asi-http-request/ASIInputStream.m
|
||||
iOS/asi-http-request/ASINetworkQueue.m
|
||||
iOS/SoundManager/SoundManager.m
|
||||
iOS/SoundManager/MyOpenALSupport.c
|
||||
iOS/Reachability/Reachability/Reachability.m
|
||||
iOS/ZipArchive/ZipArchive.mm)
|
||||
|
||||
|
||||
set(MTG_iOS_INCLUDE_DIRS iOS/UI iOS/Reachability/Reachability iOS/asi-http-request iOS/ZipArchive iOS/SoundManager)
|
||||
|
||||
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)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
endif()
|
||||
|
||||
if(backend_qt_console)
|
||||
if(UNIX AND NOT ANDROID)
|
||||
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${ZIPFS_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS}
|
||||
${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default)
|
||||
add_executable(wagic ${MTG_generic_src} ${MTG_qt_console_src} ${MTG_network_src})
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${Qt5Core_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS} ${TINYXML_LIBRARIES}
|
||||
${HGE_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "qt-console builds are only supported on unix platforms")
|
||||
endif()
|
||||
elseif(backend_qt_widget)
|
||||
if(UNIX AND NOT ANDROID)
|
||||
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${ZIPFS_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS}
|
||||
${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default)
|
||||
add_executable(wagic ${MTG_generic_src} ${MTG_qt_graphic_src} ${MTG_network_src})
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${Qt5Core_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES}
|
||||
${HGE_LIBRARY} ${ZLIB_LIBRARIES})# ${X11_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "qt-widget builds are only supported on unix platforms")
|
||||
endif()
|
||||
elseif(backend_sdl)
|
||||
if((UNIX OR EMSCRIPTEN) AND NOT ANDROID)
|
||||
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
|
||||
add_executable(wagic ${MTG_generic_src} ${MTG_sdl_src} ${MTG_network_src} src/TestSuiteAI.cpp src/AIPlayerBakaB.cpp)
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES} ${HGE_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
elseif(ANDROID)
|
||||
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${BOOST_INCLUDE_DIRS} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR})
|
||||
#we should try to get rid of this hack
|
||||
add_library(wagic SHARED ${MTG_generic_src} ${MTG_network_src} ${MTG_android_sdl_src} src/TestSuiteAI.cpp)
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES} ${HGE_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
elseif(WIN32)
|
||||
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_DIRS})
|
||||
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} ${BOOST_date_time} ${HGE_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
elseif(backend_psp)
|
||||
if(PSP)
|
||||
#${PSPSDK_PATH}/include
|
||||
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
|
||||
${UNZIP_INCLUDE_DIR} ${BOOST_INCLUDE_DIRS} ${GIF_INCLUDE_DIR} ${HGETOOLS_INCLUDE_DIRS})
|
||||
add_executable(wagic ${MTG_generic_src} ${MTG_network_src})
|
||||
target_link_libraries(wagic ${JGE_LIBRARY} ${PSPSDK_LIB} ${HGETOOLS_LIBRARY} ${FREETYPE_LIB} ${JPEG_LIBRARY}
|
||||
${GIF_LIBRARIES} ${PNG_LIBRARIES} z m ${MIKMOD_LIBRARY} ${TINYXML_LIBRARIES}
|
||||
stdc++ ${PSPSDK_REQUIRED_LIB})
|
||||
|
||||
set(PRXSPECS_FILE "${PSPSDK_PATH}/lib/prxspecs")
|
||||
set(LINKFILE_FILE "${PSPSDK_PATH}/lib/linkfile.prx")
|
||||
|
||||
get_property(wagic_elf_location TARGET wagic PROPERTY LOCATION)
|
||||
get_filename_component(wagic_elf_directory ${wagic_elf_location} PATH)
|
||||
|
||||
set_target_properties(wagic PROPERTIES LINK_FLAGS "-specs=${PRXSPECS_FILE} -Wl,-q,-T${LINKFILE_FILE}")
|
||||
|
||||
add_custom_command(TARGET wagic POST_BUILD
|
||||
COMMAND ${PSPSDK_MKSFO_COMMAND} ARGS "'Wagic, the Homebrew?!'" "${wagic_elf_directory}/PARAM.SFO"
|
||||
COMMAND ${PSPSDK_FIXUP_IMPORTS_COMMAND} ARGS ${wagic_elf_location}
|
||||
COMMAND ${PSPSDK_PRXGEN_COMMAND} ARGS ${wagic_elf_location} "${wagic_elf_directory}/wagic.prx"
|
||||
COMMAND ${PSPSDK_PACK_PBP_COMMAND} ARGS ${wagic_elf_directory}/EBOOT.PBP ${wagic_elf_directory}/PARAM.SFO ${CMAKE_CURRENT_SOURCE_DIR}/icon.png NULL ${CMAKE_CURRENT_SOURCE_DIR}/pic0.png ${CMAKE_CURRENT_SOURCE_DIR}/pic1.png NULL "${wagic_elf_directory}/wagic.prx" NULL)
|
||||
else()
|
||||
message(FATAL_ERROR "use the cross-compile toolchain to build as the psp target")
|
||||
endif()
|
||||
endif()
|
||||
if(IOS)
|
||||
set(MTG_generic_src ${MTG_generic_src} ${MTG_iOS_src} PARENT_SCOPE)
|
||||
set(MTG_INCLUDE_DIRS ${MTG_INCLUDE_DIRS} ${MTG_iOS_INCLUDE_DIRS} PARENT_SCOPE)
|
||||
|
||||
endif()
|
||||
@@ -1,3 +0,0 @@
|
||||
maxGrade=0: Borderline (99% OK)
|
||||
keybindings_sdl=13:2,27:2,32:10,97:7,98:5,100:6,101:15,102:16,105:11,106:12,107:13,108:10,113:14,115:9,119:8,1073741903:6,1073741904:7,1073741905:9,1073741906:8,1073741912:2,1073741952:14,1073741953:13,1073742048:3,1073742052:3,1073742094:2
|
||||
aidecks=10
|
||||
@@ -10233,7 +10233,7 @@ type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Bedlam Reveler
|
||||
autohand=affinity(instant,sorcery|mygraveyard) reduce({1})
|
||||
anyzone=foreach(instant,sorcery|mygraveyard) changecost(colorless:-1) forcedalive
|
||||
auto=@movedTo(*[-creature]|mystack):1/1 ueot
|
||||
auto=reject all(*|myhand) && draw:3
|
||||
text=Bedlam Reveler costs {1} less to cast for each instant and sorcery card in your graveyard. -- Prowess (Whenever you cast a noncreature spell, this creature gets +1/+1 until end of turn.) -- When Bedlam Reveler enters the battlefield, discard your hand, then draw three cards.
|
||||
@@ -11325,7 +11325,7 @@ type=Enchantment
|
||||
[card]
|
||||
name=Blasphemous Act
|
||||
auto=damage:13 all(creature)
|
||||
autohand=affinity(creature|battlefield) reduce({1})
|
||||
anyzone=foreach(creature|battlefield) changecost(colorless:-1) forcedalive
|
||||
text=Blasphemous Act costs 1 less to cast for each creature on the battlefield. -- Blasphemous Act deals 13 damage to each creature.
|
||||
mana={8}{R}
|
||||
type=Sorcery
|
||||
@@ -35600,7 +35600,7 @@ type=Instant
|
||||
[card]
|
||||
name=Emeria Angel
|
||||
abilities=flying
|
||||
auto=@movedTo(land|myBattlefield):may token(Bird,creature bird, 1/1,flying white)
|
||||
auto=@movedTo(land|myBattlefield):may token(Bird,creature bird, 1/1,flying,white)
|
||||
text=Flying -- Landfall - Whenever a land enters the battlefield under your control, you may put a 1/1 white Bird creature token with flying onto the battlefield.
|
||||
mana={2}{W}{W}
|
||||
type=Creature
|
||||
@@ -41166,8 +41166,7 @@ type=Enchantment
|
||||
[card]
|
||||
name=Flagstones of Trokair
|
||||
auto={T}:Add{W}
|
||||
aicode=activate moveTo(myBattlefield) and!(tap(noevent))! target(plains|myLibrary)
|
||||
auto=@movedTo(this|graveyard) from(battlefield):name(search card) reveal:plibrarycount optionone name(choose card) target(plains|reveal) moveto(ownerlibrary) and!( becomes(tobecast) ueot )! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerlibrary) and!( all(*|reveal) moveto(ownerlibrary) and!(shuffle)! )! optiontwoend afterrevealed all(tobecast|mylibrary) moveto(ownerlibrary) and!(moveTo(myBattlefield) and!(tap(noevent))!)! afterrevealedend revealend
|
||||
auto=@movedTo(this|graveyard) from(battlefield):name(search card) ability$!moveTo(myBattlefield) and!(tap(noevent))! target(plains|myLibrary)!$ controller
|
||||
text={T}: Add {W} to your mana pool. -- When Flagstones of Trokair is put into a graveyard from the battlefield, you may search your library for a Plains card and put it onto the battlefield tapped. If you do, shuffle your library.
|
||||
type=Legendary Land
|
||||
[/card]
|
||||
@@ -42426,7 +42425,7 @@ type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Flurry of Wings
|
||||
auto=foreach(creature[attacking]) token(Bird Soldier,Creature Bird Soldier,1/1,white flying)
|
||||
auto=foreach(creature[attacking]) token(Bird Soldier,Creature Bird Soldier,1/1,white,flying)
|
||||
text=Put X 1/1 white Bird Soldier creature tokens with flying onto the battlefield, where X is the number of attacking creatures.
|
||||
mana={G}{W}{U}
|
||||
type=Instant
|
||||
@@ -46209,7 +46208,7 @@ toughness=4
|
||||
[/card]
|
||||
[card]
|
||||
name=Ghoultree
|
||||
autohand=affinity(creature|mygraveyard) reduce({1})
|
||||
anyzone=foreach(creature|mygraveyard) changecost(colorless:-1) forcedalive
|
||||
text=Ghoultree cost {1} less to cast for each creature card in your graveyard.
|
||||
mana={7}{G}
|
||||
type=Creature
|
||||
@@ -60797,7 +60796,7 @@ toughness=3
|
||||
[card]
|
||||
name=Jotun Owl Keeper
|
||||
auto=cumulativeupcost[{WU}] sacrifice
|
||||
auto=@movedTo(this|graveyard) from(battlefield):thisforeach(counter{0/0.1.Age}) token(Bird,Creature Bird,1/1,white flying)
|
||||
auto=@movedTo(this|graveyard) from(battlefield):thisforeach(counter{0/0.1.Age}) token(Bird,Creature Bird,1/1,white,flying)
|
||||
text=Cumulative upkeep {W} or {U} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.) -- When Jotun Owl Keeper dies, put a 1/1 white Bird creature token with flying onto the battlefield for each age counter on it.
|
||||
mana={2}{W}
|
||||
type=Creature
|
||||
@@ -64909,7 +64908,7 @@ toughness=5
|
||||
name=Krosan Verge
|
||||
auto=tap(noevent)
|
||||
auto={T}:Add{1}
|
||||
auto={2}{T}{S}:name(sacrifice to search) ability$! name(search forest) notatarget(forest|mylibrary) moveto(ownerbattlefield) and!(tap(noevent))! !$ controller && ability$! name(search plains) notatarget(plains|mylibrary) moveto(ownerbattlefield) and!(tap(noevent))! !$ controller
|
||||
auto={2}{T}{S}:name(sacrifice to search) transforms((,newability[ability$! name(search forest) notatarget(forest|mylibrary) moveto(ownerbattlefield) and!(tap(noevent))! !$ controller],newability[ability$! name(search plains) notatarget(plains|mylibrary) moveto(ownerbattlefield) and!(tap(noevent))! !$ controller])) oneshot
|
||||
text=Krosan Verge enters the battlefield tapped. -- {T}: Add {1} to your mana pool. -- {2}, {T}, Sacrifice Krosan Verge: Search your library for a Forest card and a Plains card and put them onto the battlefield tapped. Then shuffle your library.
|
||||
type=Land
|
||||
[/card]
|
||||
@@ -79818,7 +79817,7 @@ name=Niblis of the Breath
|
||||
abilities=flying
|
||||
auto={U}{T}:may tap target(creature)
|
||||
auto={U}{T}:may untap target(creature)
|
||||
text=Flying -- Whenever Niblis of the Urn attacks, you may tap target creature.
|
||||
text=Flying -- {U}, {T}: You may tap or untap target creature.
|
||||
mana={2}{U}
|
||||
type=Creature
|
||||
subtype=Spirit
|
||||
@@ -80577,7 +80576,7 @@ subtype=Nissa
|
||||
[/card]
|
||||
[card]
|
||||
name=Nissa's Chosen
|
||||
auto=@movedTo(graveyard) from(this|battlefield):all(this) bottomoflibrary
|
||||
auto=@movedTo(graveyard) from(this|battlefield):all(trigger[from]) bottomoflibrary
|
||||
text=If Nissa's Chosen would die, put it on the bottom of its owner's library instead.
|
||||
mana={G}{G}
|
||||
type=Creature
|
||||
@@ -83413,11 +83412,11 @@ toughness=2
|
||||
[/card]
|
||||
[card]
|
||||
name=Ordered Migration
|
||||
auto=aslongas(forest|myBattlefield) token(Bird,Creature Bird,1/1,blue flying)
|
||||
auto=aslongas(mountain|myBattlefield) token(Bird,Creature Bird,1/1,blue flying)
|
||||
auto=aslongas(island|myBattlefield) token(Bird,Creature Bird,1/1,blue flying)
|
||||
auto=aslongas(swamp|myBattlefield) token(Bird,Creature Bird,1/1,blue flying)
|
||||
auto=aslongas(plains|myBattlefield) token(Bird,Creature Bird,1/1,blue flying)
|
||||
auto=aslongas(forest|myBattlefield) token(Bird,Creature Bird,1/1,blue,flying)
|
||||
auto=aslongas(mountain|myBattlefield) token(Bird,Creature Bird,1/1,blue,flying)
|
||||
auto=aslongas(island|myBattlefield) token(Bird,Creature Bird,1/1,blue,flying)
|
||||
auto=aslongas(swamp|myBattlefield) token(Bird,Creature Bird,1/1,blue,flying)
|
||||
auto=aslongas(plains|myBattlefield) token(Bird,Creature Bird,1/1,blue,flying)
|
||||
text=Domain - Put a 1/1 blue Bird creature token with flying onto the battlefield for each basic land type among lands you control.
|
||||
mana={3}{W}{U}
|
||||
type=Sorcery
|
||||
@@ -90652,8 +90651,8 @@ toughness=5
|
||||
[card]
|
||||
name=Quarantine Field
|
||||
auto=counter(0/0,xx,Isolation)
|
||||
auto=(blink)forsrc target(<prexx>*[-land]|opponentbattlefield)
|
||||
text=Quarantine Field enters the battlefield with X isolation counters on it. -- When Quarantine Field enters the battlefield, for each isolation counter on it, exile up to one target nonland permanent an opponent controls until Quarantine Field leaves the battlefield. (WORKAROUND ONLY EXILES UP TO X AND NOT FOR EACH COUNTER)
|
||||
auto=this(variable{xx} >0) (blink)forsrc target(<upto:counter{0%0.1.Isolation}>*[-land]|opponentbattlefield)
|
||||
text=Quarantine Field enters the battlefield with X isolation counters on it. -- When Quarantine Field enters the battlefield, for each isolation counter on it, exile up to one target nonland permanent an opponent controls until Quarantine Field leaves the battlefield.
|
||||
mana={X}{X}{W}{W}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
@@ -106337,7 +106336,8 @@ toughness=6
|
||||
[/card]
|
||||
[card]
|
||||
name=Simoon
|
||||
auto=damage:1 all(creature|opponentBattlefield)
|
||||
target=opponent
|
||||
auto=damage:1 all(creature|targetedpersonsbattlefield)
|
||||
text=Simoon deals 1 damage to each creature target opponent controls.
|
||||
mana={R}{G}
|
||||
type=Instant
|
||||
@@ -109371,7 +109371,7 @@ type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Solitary Confinement
|
||||
auto=upcost[{D(*|myhand)}] sacrifice
|
||||
auto=@each my upkeep :name(discard or sacrifice) ability$!if type(*|myhand)~morethan~0 then choice reject notatarget(*|myhand) _ choice sacrifice all(mystored)!$ controller
|
||||
auto=phasealter(remove,draw,controller)
|
||||
abilities=playershroud
|
||||
auto=preventalldamage to(controller)
|
||||
@@ -114073,7 +114073,7 @@ toughness=2
|
||||
[/card]
|
||||
[card]
|
||||
name=Stone Idol Trap
|
||||
autohand=affinity(creature[attacking]|battlefield) reduce({1})
|
||||
anyzone=foreach(creature[attacking]|battlefield) changecost(colorless:-1) forcedalive
|
||||
auto=token(Construct,Artifact Creature Construct,6/12,trample) and!( transforms((,newability[@next endofturn:moveTo(exile)])) forever )!
|
||||
text=Stone Idol Trap costs {1} less to cast for each attacking creature. -- Put a 6/12 colorless Construct artifact creature token with trample onto the battlefield. Exile it at the beginning of your next end step.
|
||||
mana={5}{R}
|
||||
@@ -138100,4 +138100,4 @@ type=Land Creature
|
||||
subtype=Forest Dryad
|
||||
power=1
|
||||
toughness=1
|
||||
[/card]
|
||||
[/card]
|
||||
@@ -1936,12 +1936,6 @@ mana={3}{R}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Burning Wish
|
||||
text=You may choose a sorcery card you own from outside the game, reveal that card, and put it into your hand. Exile Burning Wish.
|
||||
mana={1}{R}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Burning-Eye Zubera
|
||||
text=When Burning-Eye Zubera dies, if 4 or more damage was dealt to it this turn, Burning-Eye Zubera deals 3 damage to target creature or player.
|
||||
mana={2}{R}{R}
|
||||
@@ -3340,15 +3334,6 @@ mana={4}{U}{U}
|
||||
type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Courser of Kruphix
|
||||
text=Play with the top card of your library revealed. -- You may play the top card of your library if it's a land card. -- Whenever a land enters the battlefield under your control, you gain 1 life.
|
||||
mana={1}{G}{G}
|
||||
type=Enchantment Creature
|
||||
subtype=Centaur
|
||||
power=2
|
||||
toughness=4
|
||||
[/card]
|
||||
[card]
|
||||
name=Covenant of Minds
|
||||
text=Reveal the top three cards of your library. Target opponent may choose to put those cards into your hand. If he or she doesn't, put those cards into your graveyard and draw five cards.
|
||||
mana={4}{U}
|
||||
@@ -3468,12 +3453,6 @@ mana={4}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Crown of Convergence
|
||||
text=Play with the top card of your library revealed. -- As long as the top card of your library is a creature card, creatures you control that share a color with that card get +1/+1. -- {G}{W}: Put the top card of your library on the bottom of your library.
|
||||
mana={2}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Crown of Doom
|
||||
text=Whenever a creature attacks you or a planeswalker you control, it gets +2/+0 until end of turn. -- {2}: Target player other than Crown of Doom's owner gains control of it. Activate this ability only during your turn.
|
||||
mana={3}
|
||||
@@ -3585,12 +3564,6 @@ mana={4}{U}{U}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Cunning Wish
|
||||
text=You may choose an instant card you own from outside the game, reveal that card, and put it into your hand. Exile Cunning Wish.
|
||||
mana={2}{U}
|
||||
type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Curious Homunculus
|
||||
text={T}: Add {C} to your mana pool. Spend this mana only to cast an instant or sorcery spell. -- At the beginning of your upkeep, if there are three or more instant and/or sorcery cards in your graveyard, transform Curious Homunculus.
|
||||
mana={1}{U}
|
||||
@@ -4008,12 +3981,6 @@ mana={R}
|
||||
type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Death Wish
|
||||
text=You may choose a card you own from outside the game and put it into your hand. You lose half your life, rounded up. Exile Death Wish.
|
||||
mana={1}{B}{B}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Death-Mask Duplicant
|
||||
text=Imprint — {1}: Exile target creature card from your graveyard. -- As long as a card exiled with Death-Mask Duplicant has flying, Death-Mask Duplicant has flying. The same is true for fear, first strike, double strike, haste, landwalk, protection, and trample.
|
||||
mana={7}
|
||||
@@ -5321,7 +5288,7 @@ mana={2}{G}{G}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Evasive Action
|
||||
name=
|
||||
text=Domain — Counter target spell unless its controller pays {1} for each basic land type among lands you control.
|
||||
mana={1}{U}
|
||||
type=Instant
|
||||
@@ -6325,12 +6292,6 @@ mana={1}{R}{R}{R}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Future Sight
|
||||
text=Play with the top card of your library revealed. -- You may play the top card of your library.
|
||||
mana={2}{U}{U}{U}
|
||||
type=Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Gabriel Angelfire
|
||||
text=At the beginning of your upkeep, choose flying, first strike, trample, or rampage 3. Gabriel Angelfire gains that ability until your next upkeep. (Whenever a creature with rampage 3 becomes blocked, it gets +3/+3 until end of turn for each creature blocking it beyond the first.)
|
||||
mana={3}{G}{G}{W}{W}
|
||||
@@ -6355,15 +6316,6 @@ mana={3}{G}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Gaea's Herald
|
||||
text=Creature spells can't be countered.
|
||||
mana={1}{G}
|
||||
type=Creature
|
||||
subtype=Elf
|
||||
power=1
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
name=Gaea's Liege
|
||||
text=As long as Gaea's Liege isn't attacking, its power and toughness are each equal to the number of Forests you control. As long as Gaea's Liege is attacking, its power and toughness are each equal to the number of Forests defending player controls. -- {T}: Target land becomes a Forest until Gaea's Liege leaves the battlefield.
|
||||
mana={3}{G}{G}{G}
|
||||
@@ -6415,16 +6367,6 @@ mana={2}{R}
|
||||
type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Garruk's Horde
|
||||
abilities=trample
|
||||
text=Trample -- Play with the top card of your library revealed. -- You may cast the top card of your library if it's a creature card. (Do this only any time you could cast that creature card. You still pay the spell's costs.)
|
||||
mana={5}{G}{G}
|
||||
type=Creature
|
||||
subtype=Beast
|
||||
power=7
|
||||
toughness=7
|
||||
[/card]
|
||||
[card]
|
||||
name=Garrulous Sycophant
|
||||
text=At the beginning of your end step, if you're the monarch, each opponent loses 1 life and you gain 1 life.
|
||||
mana={2}{B}
|
||||
@@ -6701,16 +6643,6 @@ power=5
|
||||
toughness=5
|
||||
[/card]
|
||||
[card]
|
||||
name=Gisela, the Broken Blade
|
||||
abilities=flying,first strike,lifelink
|
||||
text=Flying, first strike, lifelink -- At the beginning of your end step, if you both own and control Gisela, the Broken Blade and a creature named Bruna, the Fading Light, exile them, then meld them into Brisela, Voice of Nightmares.
|
||||
mana={2}{W}{W}
|
||||
type=Legendary Creature
|
||||
subtype=Angel Horror
|
||||
power=4
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Give // Take
|
||||
text=Put three +1/+1 counters on target creature. -- // -- Remove all +1/+1 counters from target creature you control. Draw that many cards. -- -- Fuse (You may cast one or both halves of this card from your hand.)
|
||||
mana={2}{G} // {2}{U}
|
||||
@@ -6828,12 +6760,6 @@ power=1
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
name=Glittering Wish
|
||||
text=You may choose a multicolored card you own from outside the game, reveal that card, and put it into your hand. Exile Glittering Wish.
|
||||
mana={G}{W}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Global Ruin
|
||||
text=Each player chooses from the lands he or she controls a land of each basic land type, then sacrifices the rest.
|
||||
mana={4}{W}
|
||||
@@ -7045,15 +6971,6 @@ power=1
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
name=Goblin Spy
|
||||
text=Play with the top card of your library revealed.
|
||||
mana={R}
|
||||
type=Creature
|
||||
subtype=Goblin Rogue
|
||||
power=1
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
name=Goblin Test Pilot
|
||||
abilities=flying
|
||||
text=Flying -- {T}: Goblin Test Pilot deals 2 damage to target creature or player chosen at random.
|
||||
@@ -7092,12 +7009,6 @@ type=Legendary Artifact
|
||||
subtype=Equipment
|
||||
[/card]
|
||||
[card]
|
||||
name=Golden Wish
|
||||
text=You may choose an artifact or enchantment card you own from outside the game, reveal that card, and put it into your hand. Exile Golden Wish.
|
||||
mana={3}{W}{W}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Goldenhide Ox
|
||||
text=Constellation — Whenever Goldenhide Ox or another enchantment enters the battlefield under your control, target creature must be blocked this turn if able.
|
||||
mana={5}{G}
|
||||
@@ -7624,15 +7535,6 @@ type=Artifact
|
||||
subtype=Equipment
|
||||
[/card]
|
||||
[card]
|
||||
name=Hanweir, the Writhing Township
|
||||
text=Whenever Hanweir Garrison attacks, put two 1/1 red Human creature tokens onto the battlefield tapped and attacking. -- (Melds with Hanweir Battlements.)
|
||||
mana={2}{R}
|
||||
type=Creature
|
||||
subtype=Human Soldier
|
||||
power=2
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Harbinger of the Tides
|
||||
text=You may cast Harbinger of the Tides as though it had flash if you pay {2} more to cast it. (You may cast it any time you could cast an instant.) -- When Harbinger of the Tides enters the battlefield, you may return target tapped creature an opponent controls to its owner's hand.
|
||||
mana={U}{U}
|
||||
@@ -9828,12 +9730,6 @@ mana={1}{R}{R}
|
||||
type=World Enchantment
|
||||
[/card]
|
||||
[card]
|
||||
name=Lantern of Insight
|
||||
text=Each player plays with the top card of his or her library revealed. -- {T}, Sacrifice Lantern of Insight: Target player shuffles his or her library.
|
||||
mana={1}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Laquatus's Disdain
|
||||
text=Counter target spell cast from a graveyard. -- Draw a card.
|
||||
mana={1}{U}
|
||||
@@ -10230,12 +10126,6 @@ power=*
|
||||
toughness=*
|
||||
[/card]
|
||||
[card]
|
||||
name=Living Wish
|
||||
text=You may choose a creature or land card you own from outside the game, reveal that card, and put it into your hand. Exile Living Wish.
|
||||
mana={1}{G}
|
||||
type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Loafing Giant
|
||||
text=Whenever Loafing Giant attacks or blocks, put the top card of your library into your graveyard. If that card is a land card, prevent all combat damage Loafing Giant would deal this turn.
|
||||
mana={4}{R}
|
||||
@@ -10468,15 +10358,6 @@ power=5
|
||||
toughness=5
|
||||
[/card]
|
||||
[card]
|
||||
name=Magus of the Future
|
||||
text=Play with the top card of your library revealed. -- You may play the top card of your library.
|
||||
mana={2}{U}{U}{U}
|
||||
type=Creature
|
||||
subtype=Human Wizard
|
||||
power=2
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Magus of the Scroll
|
||||
text={3}, {T}: Name a card. Reveal a card at random from your hand. If it's the named card, Magus of the Scroll deals 2 damage to target creature or player.
|
||||
mana={R}
|
||||
@@ -10854,15 +10735,6 @@ mana={4}{R}
|
||||
type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Melek, Izzet Paragon
|
||||
text=Play with the top card of your library revealed. -- You may cast the top card of your library if it's an instant or sorcery card. -- Whenever you cast an instant or sorcery spell from your library, copy it. You may choose new targets for the copy.
|
||||
mana={4}{U}{R}
|
||||
type=Legendary Creature
|
||||
subtype=Weird Wizard
|
||||
power=2
|
||||
toughness=4
|
||||
[/card]
|
||||
[card]
|
||||
name=Meletis Charlatan
|
||||
text={2}{U}, {T}: The controller of target instant or sorcery spell copies it. That player may choose new targets for the copy.
|
||||
mana={2}{U}
|
||||
@@ -11511,15 +11383,6 @@ power=3
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Mul Daya Channelers
|
||||
text=Play with the top card of your library revealed. -- As long as the top card of your library is a creature card, Mul Daya Channelers gets +3/+3. -- As long as the top card of your library is a land card, Mul Daya Channelers has "{T}: Add two mana of any one color to your mana pool."
|
||||
mana={1}{G}{G}
|
||||
type=Creature
|
||||
subtype=Elf Druid Shaman
|
||||
power=2
|
||||
toughness=2
|
||||
[/card]
|
||||
[card]
|
||||
name=Multani's Presence
|
||||
text=Whenever a spell you've cast is countered, draw a card.
|
||||
mana={G}
|
||||
@@ -12475,15 +12338,6 @@ power=3
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
name=Oracle of Mul Daya
|
||||
text=You may play an additional land on each of your turns. -- Play with the top card of your library revealed. -- You may play the top card of your library if it's a land card.
|
||||
mana={3}{G}
|
||||
type=Creature
|
||||
subtype=Elf Shaman
|
||||
power=2
|
||||
toughness=2
|
||||
[/card]
|
||||
[card]
|
||||
name=Oracle's Attendants
|
||||
text={T}: All damage that would be dealt to target creature this turn by a source of your choice is dealt to Oracle's Attendants instead.
|
||||
mana={3}{W}
|
||||
@@ -18201,12 +18055,6 @@ power=3
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Temporal Aperture
|
||||
text={5}, {T}: Shuffle your library, then reveal the top card. Until end of turn, for as long as that card remains on top of your library, play with the top card of your library revealed and you may play that card without paying its mana cost. (If it has X in its mana cost, X is 0.)
|
||||
mana={2}
|
||||
type=Artifact
|
||||
[/card]
|
||||
[card]
|
||||
name=Temporal Extortion
|
||||
text=When you cast Temporal Extortion, any player may pay half his or her life, rounded up. If a player does, counter Temporal Extortion. -- Take an extra turn after this one.
|
||||
mana={B}{B}{B}{B}
|
||||
@@ -19380,15 +19228,6 @@ mana={W}
|
||||
type=Instant
|
||||
[/card]
|
||||
[card]
|
||||
name=Vampire Nocturnus
|
||||
text=Play with the top card of your library revealed. -- As long as the top card of your library is black, Vampire Nocturnus and other Vampire creatures you control get +2/+1 and have flying.
|
||||
mana={1}{B}{B}{B}
|
||||
type=Creature
|
||||
subtype=Vampire
|
||||
power=3
|
||||
toughness=3
|
||||
[/card]
|
||||
[card]
|
||||
name=Vandalize
|
||||
text=Choose one or both — -- • Destroy target artifact. -- • Destroy target land.
|
||||
mana={4}{R}
|
||||
|
||||
@@ -4,15 +4,13 @@ import zipfile
|
||||
from pyjavaproperties import Properties
|
||||
from optparse import OptionParser
|
||||
|
||||
def createWindowsZipFile(filename):
|
||||
def createWindowsZipFile(filename, buildpath):
|
||||
utilities = ZipUtilities()
|
||||
zip_file = zipfile.ZipFile(filename, 'w', zipfile.ZIP_STORED)
|
||||
zip_file.write('../../../LICENSE')
|
||||
zip_file.write('libpng13.dll')
|
||||
zip_file.write('SDL.dll')
|
||||
zip_file.write('fmod.dll')
|
||||
zip_file.write('zlib1.dll')
|
||||
zip_file.write('Wagic.exe')
|
||||
zip_file.write(buildpath + '/../LICENSE')
|
||||
zip_file.write(buildpath + '/lib/Release/SDL2.dll', 'SDL2.dll')
|
||||
zip_file.write(buildpath + '/lib/Release/zlib.dll', 'zlib.dll')
|
||||
zip_file.write(buildpath + '/bin/Release/wagic.exe', 'wagic.exe')
|
||||
zip_file.write('Res/' + getFilename('core') + '.zip')
|
||||
zip_file.close()
|
||||
|
||||
@@ -25,7 +23,7 @@ def getFilename(filename):
|
||||
filename = filename + '-' + major + minor + point
|
||||
return filename
|
||||
|
||||
def createStandardResFile():
|
||||
def createStandardResFile(buildpath):
|
||||
print "Creating Resource File"
|
||||
cmd = 'python createResourceZip.py -n ' + getFilename('core') + '.zip'
|
||||
os.chdir("Res")
|
||||
@@ -33,7 +31,7 @@ def createStandardResFile():
|
||||
os.chdir("..")
|
||||
print "Creating Windows Package File"
|
||||
filename = 'Wagic-windows.zip'
|
||||
createWindowsZipFile( filename )
|
||||
createWindowsZipFile( filename, buildpath )
|
||||
print >> sys.stderr, 'Created Windows Package: {0}'.format( filename)
|
||||
|
||||
class ZipUtilities:
|
||||
@@ -63,11 +61,11 @@ def main():
|
||||
## using optparse instead of argParse for now since python 2.7 may not be installed.
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-p", "--platform", help="PLATFORM: specify custom build. (eg ios, android, etc)", metavar="PLATFORM", dest="platform")
|
||||
parser.add_option("-b", "--build", help="BUILD: specify the build directory", metavar="BUILD", dest="build")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
createStandardResFile()
|
||||
createStandardResFile(options.build)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
+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;
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_STDINT_H_ // [
|
||||
#define _MSC_STDINT_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#if (_MSC_VER < 1300) && defined(__cplusplus)
|
||||
extern "C++" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#if (_MSC_VER < 1300) && defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
||||
#ifndef _W64
|
||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
# define _W64 __w64
|
||||
# else
|
||||
# define _W64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
typedef __int8 int8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef _W64 int intptr_t;
|
||||
typedef _W64 unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
|
||||
#endif // _MSC_STDINT_H_ ]
|
||||
@@ -1406,6 +1406,28 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class TrCardExerted: public Trigger
|
||||
{
|
||||
public:
|
||||
TrCardExerted(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
|
||||
Trigger(observer, id, source, once, tc)
|
||||
{
|
||||
}
|
||||
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
WEventCardExerted * e = dynamic_cast<WEventCardExerted *> (event);
|
||||
if (!e) return 0;
|
||||
if (!tc->canTarget(e->card)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
TrCardExerted * clone() const
|
||||
{
|
||||
return NEW TrCardExerted(*this);
|
||||
}
|
||||
};
|
||||
|
||||
class TrCombatTrigger: public Trigger
|
||||
{
|
||||
public:
|
||||
@@ -5174,6 +5196,7 @@ public:
|
||||
list<int> oldcolors;
|
||||
list<int> oldtypes;
|
||||
vector<int> dontremove;
|
||||
bool removemc;
|
||||
bool addNewColors;
|
||||
bool remove;
|
||||
bool removeCreatureSubtypes;
|
||||
@@ -7290,6 +7313,57 @@ public:
|
||||
return NEW AProvoke(*this);
|
||||
}
|
||||
};
|
||||
//exert
|
||||
class AExert: public InstantAbility
|
||||
{
|
||||
public:
|
||||
MTGAbility * andAbility;
|
||||
AExert(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target) :
|
||||
InstantAbility(observer, _id, _source)
|
||||
{
|
||||
target = _target;
|
||||
andAbility = NULL;
|
||||
}
|
||||
|
||||
int resolve()
|
||||
{
|
||||
MTGCardInstance * card = (MTGCardInstance *) target;
|
||||
if (card)
|
||||
{
|
||||
card->exerted = true;
|
||||
WEvent * e = NEW WEventCardExerted(card);
|
||||
game->receiveEvent(e);
|
||||
if(andAbility)
|
||||
{
|
||||
MTGAbility * andAbilityClone = andAbility->clone();
|
||||
andAbilityClone->target = card;
|
||||
if(andAbility->oneShot)
|
||||
{
|
||||
andAbilityClone->resolve();
|
||||
SAFE_DELETE(andAbilityClone);
|
||||
}
|
||||
else
|
||||
{
|
||||
andAbilityClone->addToGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Exert";
|
||||
}
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "AAExert ::: (";
|
||||
return InstantAbility::toString(out) << ")";
|
||||
}
|
||||
AExert * clone() const
|
||||
{
|
||||
return NEW AExert(*this);
|
||||
}
|
||||
};
|
||||
//------------------
|
||||
//trigger regen
|
||||
class ATriggerRegen: public InstantAbility
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
bool blinked;
|
||||
bool isExtraCostTarget;
|
||||
bool morphed;
|
||||
bool exerted;
|
||||
bool turningOver;
|
||||
bool isMorphed;
|
||||
bool isFlipped;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
#include "../../../JGE/src/tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
#include <JGui.h>
|
||||
class GameObserver;
|
||||
class MTGDeck;
|
||||
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
|
||||
int loadMatches(WSrcCards* src, bool all = false)
|
||||
{
|
||||
return loadMatches(src, all);
|
||||
return active->loadMatches(src, all);
|
||||
}
|
||||
|
||||
int addRandomCards(MTGDeck * i, int howmany = 1)
|
||||
|
||||
@@ -205,6 +205,12 @@ struct WEventCardCycle : public WEventCardUpdate {
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//event when card is exerted.
|
||||
struct WEventCardExerted : public WEventCardUpdate {
|
||||
WEventCardExerted(MTGCardInstance * card);
|
||||
virtual Targetable * getTarget(int target);
|
||||
};
|
||||
|
||||
//Event when a card's "defenser" status changes
|
||||
//before : attacker that card was blocking previously
|
||||
//after: attacker that card is blocking now
|
||||
|
||||
@@ -201,4 +201,7 @@ public:
|
||||
void FormatText(string &s, vector<string>& output, int customLen = 0);
|
||||
};
|
||||
|
||||
#if defined (PSP)
|
||||
void SwizzlePlot(u8* out, PIXEL_TYPE color, int i, int j, unsigned int width);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -711,7 +711,8 @@ int ActionStack::addAbility(MTGAbility * ability)
|
||||
if (!observer->players[0]->isAI() && ability->source->controller() == observer->players[0] && 0
|
||||
== options[Options::INTERRUPTMYABILITIES].number)
|
||||
{
|
||||
if(observer->gameType() == GAME_TYPE_MOMIR && ability->aType == MTGAbility::FORCED_TOKEN_CREATOR)
|
||||
if((observer->gameType() == GAME_TYPE_MOMIR && ability->aType == MTGAbility::FORCED_TOKEN_CREATOR)||
|
||||
(dynamic_cast<GenericTargetAbility *>(ability) && ability->canBeInterrupted && !observer->OpenedDisplay && !observer->players[0]->game->reveal->cards.size()))//test interrupt...
|
||||
interruptDecision[0] = NOT_DECIDED;
|
||||
else
|
||||
interruptDecision[0] = DONT_INTERRUPT;
|
||||
@@ -1040,7 +1041,7 @@ void ActionStack::Update(float dt)
|
||||
if (getCurrentTutorial() && (observer->players[0]->isHuman() || observer->players[1]->isHuman() ) )
|
||||
return;
|
||||
|
||||
if (observer->mLayers->actionLayer()->menuObject || observer->LPWeffect)
|
||||
if (observer->mLayers->actionLayer()->menuObject)// || observer->LPWeffect) //test fix for hang for both legendary with action/reveal
|
||||
if(observer->players[0]->isHuman() || observer->players[1]->isHuman())
|
||||
return;//dont do any of this if a menuobject exist.
|
||||
|
||||
|
||||
@@ -6046,6 +6046,7 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou
|
||||
}
|
||||
myCurrentTurn = 1000;
|
||||
//this subkeyword adds a color without removing the existing colors.
|
||||
removemc = (sabilities.find("removemc") != string::npos);
|
||||
addNewColors = (sabilities.find("newcolors") != string::npos);
|
||||
remove = (stypes.find("removealltypes") != string::npos);
|
||||
removeCreatureSubtypes = (stypes.find("removecreaturesubtypes") != string::npos);
|
||||
@@ -6235,6 +6236,9 @@ for (it = types.begin(); it != types.end(); it++)
|
||||
_target->addbaseT(val->getValue());
|
||||
delete val;
|
||||
}
|
||||
//remove manacost
|
||||
if(removemc)
|
||||
_target->getManaCost()->resetCosts();
|
||||
|
||||
return MTGAbility::addToGame();
|
||||
}
|
||||
@@ -7729,11 +7733,14 @@ void ABlink::resolveBlink()
|
||||
this->forceDestroy = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_target && _target->next)
|
||||
_target = _target->next;
|
||||
_target->blinked = true;
|
||||
Blinked = _target;
|
||||
if(source->isPermanent()&&!source->isInPlay(game))
|
||||
{
|
||||
Blinked->blinked = false;
|
||||
}
|
||||
if (!blinkueot && !blinkForSource)
|
||||
{
|
||||
returnCardIntoPlay(_target);
|
||||
|
||||
@@ -461,12 +461,16 @@ void CardGui::Render()
|
||||
}
|
||||
|
||||
string buff = "";
|
||||
string starMark = "";
|
||||
if(card->exerted)
|
||||
starMark += "*";
|
||||
if(card->isToken && !card->isACopier)
|
||||
buff = "T";
|
||||
if(card->isToken && card->isACopier)
|
||||
buff = "CT";
|
||||
if(!card->isToken && card->isACopier)
|
||||
buff = "C";
|
||||
buff = starMark + buff;
|
||||
//if(card->has(Constants::PAYZERO))
|
||||
//buff += "Z";
|
||||
if(card->chooseacolor >= 1)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -134,7 +134,7 @@ void GuiAvatar::Render()
|
||||
}
|
||||
//poison
|
||||
char poison[10];
|
||||
if (poisonCount >= 0)
|
||||
if (poisonCount > 0)
|
||||
{
|
||||
sprintf(poison, "%i", poisonCount);
|
||||
switch (corner)
|
||||
@@ -151,7 +151,7 @@ void GuiAvatar::Render()
|
||||
}
|
||||
//energy
|
||||
char energy[15];
|
||||
if (energyCount >= 0)
|
||||
if (energyCount > 0)
|
||||
{
|
||||
sprintf(energy, "%i", energyCount);
|
||||
switch (corner)
|
||||
|
||||
@@ -386,7 +386,10 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
for(unsigned int gy = 0;gy < grave->cardsSeenThisTurn.size();gy++)
|
||||
{
|
||||
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
|
||||
if(checkCard->isCreature())
|
||||
if(checkCard->isCreature() &&
|
||||
((checkCard->previousZone == checkCurrent->game->battlefield)||
|
||||
(checkCard->previousZone == checkCurrent->opponent()->game->battlefield))//died from battlefield
|
||||
)
|
||||
{
|
||||
isMorbid = true;
|
||||
break;
|
||||
@@ -398,7 +401,26 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
if(!isMorbid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
check = restriction[i].find("zerodead");
|
||||
if(check != string::npos)//returns true if zero
|
||||
{
|
||||
bool hasDeadCreature = false;
|
||||
Player * checkCurrent = card->controller();
|
||||
MTGGameZone * grave = checkCurrent->game->graveyard;
|
||||
for(unsigned int gy = 0;gy < grave->cardsSeenThisTurn.size();gy++)
|
||||
{
|
||||
MTGCardInstance * checkCard = grave->cardsSeenThisTurn[gy];
|
||||
if(checkCard->isCreature() &&
|
||||
((checkCard->previousZone == checkCurrent->game->battlefield))//died from your battlefield
|
||||
)
|
||||
{
|
||||
hasDeadCreature = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(hasDeadCreature)
|
||||
return 0;
|
||||
}
|
||||
//Ensnaring Bridge
|
||||
check = restriction[i].find("powermorethanopponenthand");
|
||||
if (check != string::npos)//for opponent creatures
|
||||
@@ -432,13 +454,14 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
MTGGameZone * grave = checkCurrent->game->graveyard;
|
||||
|
||||
int checkTypesAmount = 0;
|
||||
if(grave->hasType("creature")) checkTypesAmount++;
|
||||
if (grave->hasType("creature")) checkTypesAmount++;
|
||||
if (grave->hasType("enchantment")) checkTypesAmount++;
|
||||
if (grave->hasType("sorcery")) checkTypesAmount++;
|
||||
if (grave->hasType("instant")) checkTypesAmount++;
|
||||
if (grave->hasType("land")) checkTypesAmount++;
|
||||
if (grave->hasType("artifact")) checkTypesAmount++;
|
||||
if (grave->hasType("planeswalker")) checkTypesAmount++;
|
||||
if (grave->hasType("tribal")) checkTypesAmount++;
|
||||
if (checkTypesAmount < 4)
|
||||
return 0;
|
||||
}
|
||||
@@ -450,13 +473,14 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
MTGGameZone * grave = checkCurrent->game->graveyard;
|
||||
|
||||
int checkTypesAmount = 0;
|
||||
if(grave->hasType("creature")) checkTypesAmount++;
|
||||
if (grave->hasType("creature")) checkTypesAmount++;
|
||||
if (grave->hasType("enchantment")) checkTypesAmount++;
|
||||
if (grave->hasType("sorcery")) checkTypesAmount++;
|
||||
if (grave->hasType("instant")) checkTypesAmount++;
|
||||
if (grave->hasType("land")) checkTypesAmount++;
|
||||
if (grave->hasType("artifact")) checkTypesAmount++;
|
||||
if (grave->hasType("planeswalker")) checkTypesAmount++;
|
||||
if (grave->hasType("tribal")) checkTypesAmount++;
|
||||
if (checkTypesAmount > 3)
|
||||
return 0;
|
||||
}
|
||||
@@ -552,6 +576,20 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
|
||||
return 0;
|
||||
}
|
||||
|
||||
check = restriction[i].find("hasexerted");
|
||||
if(check != string::npos)
|
||||
{
|
||||
if(!card->exerted)
|
||||
return 0;
|
||||
}
|
||||
|
||||
check = restriction[i].find("notexerted");
|
||||
if(check != string::npos)
|
||||
{
|
||||
if(card->exerted)
|
||||
return 0;
|
||||
}
|
||||
|
||||
check = restriction[i].find("discardbyopponent");
|
||||
if(check != string::npos)
|
||||
{
|
||||
@@ -1068,6 +1106,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
|
||||
if (TargetChooser *tc = parseSimpleTC(s,"phasedin", card))
|
||||
return NEW TrCardPhasesIn(observer, id, card, tc,once);
|
||||
|
||||
//Card Exerted
|
||||
if (TargetChooser *tc = parseSimpleTC(s,"exerted", card))
|
||||
return NEW TrCardExerted(observer, id, card, tc,once);
|
||||
|
||||
//CombatTrigger
|
||||
//Card card attacked and is blocked
|
||||
found = s.find("combat(");
|
||||
@@ -2926,7 +2968,20 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
((AManifest*)a)->withenchant = true;
|
||||
return a;
|
||||
}
|
||||
|
||||
//exert
|
||||
found = s.find("exert");
|
||||
if (found != string::npos)
|
||||
{
|
||||
MTGAbility * a = NEW AExert(observer, id, card, target);
|
||||
a->oneShot = 1;
|
||||
if(storedAndAbility.size())
|
||||
{
|
||||
string stored = storedAndAbility;
|
||||
storedAndAbility.clear();
|
||||
((AExert*)a)->andAbility = parseMagicLine(stored, id, spell, card);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
//provoke
|
||||
found = s.find("provoke");
|
||||
if (found != string::npos)
|
||||
|
||||
@@ -224,6 +224,7 @@ void MTGCardInstance::initMTGCI()
|
||||
blinked = false;
|
||||
isExtraCostTarget = false;
|
||||
morphed = false;
|
||||
exerted = false;
|
||||
turningOver = false;
|
||||
isMorphed = false;
|
||||
MeldedFrom = "";
|
||||
|
||||
@@ -1219,6 +1219,11 @@ int MTGDeck::save(const string& destFileName, bool useExpandedDescriptions, cons
|
||||
void MTGDeck::printDetailedDeckText(std::ofstream& file )
|
||||
{
|
||||
ostringstream currentCard, creatures, lands, spells, types;
|
||||
ostringstream ss_creatures, ss_lands, ss_spells;
|
||||
int numberOfCreatures = 0;
|
||||
int numberOfSpells = 0;
|
||||
int numberOfLands = 0;
|
||||
|
||||
map<int, int>::iterator it;
|
||||
for (it = cards.begin(); it != cards.end(); it++)
|
||||
{
|
||||
@@ -1266,17 +1271,31 @@ void MTGDeck::printDetailedDeckText(std::ofstream& file )
|
||||
|
||||
currentCard <<endl;
|
||||
setInfo = NULL;
|
||||
// Add counter to know number of creatures, non-creature spells and lands present in the deck
|
||||
if ( card->data->isLand() )
|
||||
{
|
||||
lands<< currentCard.str();
|
||||
numberOfLands+=nbCards;
|
||||
}
|
||||
else if ( card->data->isCreature() )
|
||||
{
|
||||
creatures << currentCard.str();
|
||||
else
|
||||
numberOfCreatures+=nbCards;
|
||||
}
|
||||
else
|
||||
{
|
||||
spells << currentCard.str();
|
||||
numberOfSpells+=nbCards;
|
||||
}
|
||||
currentCard.str("");
|
||||
}
|
||||
file << getCardBlockText( "Creatures", creatures.str() ) << endl;
|
||||
file << getCardBlockText( "Spells", spells.str() ) << endl;
|
||||
file << getCardBlockText( "Lands", lands.str() ) << endl;
|
||||
ss_creatures << numberOfCreatures;
|
||||
ss_spells << numberOfSpells;
|
||||
ss_lands << numberOfLands;
|
||||
|
||||
file << getCardBlockText( "Creatures x " + ss_creatures.str(), creatures.str() ) << endl;
|
||||
file << getCardBlockText( "Spells x " + ss_spells.str(), spells.str() ) << endl;
|
||||
file << getCardBlockText( "Lands x " + ss_lands.str(), lands.str() ) << endl;
|
||||
creatures.str("");
|
||||
spells.str("");
|
||||
lands.str("");
|
||||
|
||||
@@ -554,6 +554,13 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
}
|
||||
}
|
||||
}
|
||||
//remove exerted if changing controls
|
||||
if((to == g->players[0]->game->battlefield && from == g->players[1]->game->battlefield)||
|
||||
(to == g->players[1]->game->battlefield && from == g->players[0]->game->battlefield))
|
||||
{
|
||||
if(ret->exerted)
|
||||
ret->exerted = false;
|
||||
}
|
||||
}
|
||||
if(!asCopy)
|
||||
{
|
||||
@@ -1125,13 +1132,25 @@ void MTGInPlay::untapAll()
|
||||
card->setUntapping();
|
||||
if (!card->basicAbilities[(int)Constants::DOESNOTUNTAP] && !card->basicAbilities[(int)Constants::SHACKLER])
|
||||
{
|
||||
if (card->frozen < 1)
|
||||
if(card->exerted)
|
||||
{
|
||||
card->attemptUntap();
|
||||
card->exerted = false;
|
||||
if (card->frozen >= 1)
|
||||
{
|
||||
card->frozen = 0;
|
||||
}
|
||||
}
|
||||
if (card->frozen >= 1)
|
||||
else
|
||||
{
|
||||
card->frozen = 0;
|
||||
card->exerted = false;
|
||||
if (card->frozen < 1)
|
||||
{
|
||||
card->attemptUntap();
|
||||
}
|
||||
if (card->frozen >= 1)
|
||||
{
|
||||
card->frozen = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "WFilter.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "MTGPack.h"
|
||||
#include "../../../JGE/src/tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
|
||||
MTGPack MTGPacks::defaultBooster;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "ModRules.h"
|
||||
#include "utils.h"
|
||||
#include "GameState.h"
|
||||
#include "../../../JGE/src/tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
|
||||
|
||||
ModRules gModRules;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include <SDL.h>
|
||||
#if (defined ANDROID)
|
||||
#include <SDL_opengles.h>
|
||||
@@ -15,10 +16,15 @@
|
||||
#include "../include/JRenderer.h"
|
||||
#include "../include/JGameLauncher.h"
|
||||
#include "DebugRoutines.h"
|
||||
#include "Downloader.h"
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#if (defined FORCE_GLES)
|
||||
#undef GL_ES_VERSION_2_0
|
||||
#undef GL_VERSION_2_0
|
||||
@@ -101,7 +107,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;
|
||||
@@ -112,10 +118,27 @@ public: /* For easy interfacing with JGE static functions */
|
||||
|
||||
int mMouseDownX;
|
||||
int mMouseDownY;
|
||||
static SdlApp* sInstance;
|
||||
|
||||
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)
|
||||
{
|
||||
sInstance = this;
|
||||
}
|
||||
|
||||
static void OneIter()
|
||||
{
|
||||
SDL_Event Event;
|
||||
if (g_engine)
|
||||
{
|
||||
for (int x = 0; x < 5 && SDL_WaitEventTimeout(&Event, 10); ++x)
|
||||
{
|
||||
if(!g_engine->IsPaused())
|
||||
sInstance->OnEvent(&Event);
|
||||
}
|
||||
if(!g_engine->IsPaused())
|
||||
sInstance->OnUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
int OnExecute()
|
||||
@@ -125,26 +148,18 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_Event Event;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_main_loop(SdlApp::OneIter, 60, 1);
|
||||
#else
|
||||
while(Running)
|
||||
{
|
||||
if (g_engine)
|
||||
{
|
||||
for (int x = 0; x < 5 && SDL_WaitEventTimeout(&Event, 10); ++x)
|
||||
{
|
||||
if(!g_engine->IsPaused())
|
||||
OnEvent(&Event);
|
||||
}
|
||||
if(!g_engine->IsPaused())
|
||||
OnUpdate();
|
||||
}
|
||||
OneIter();
|
||||
}
|
||||
|
||||
OnCleanup();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
public:
|
||||
bool OnInit();
|
||||
@@ -211,11 +226,11 @@ public:
|
||||
|
||||
/* On Android, this is triggered when the device orientation changed */
|
||||
case SDL_WINDOWEVENT:
|
||||
window = SDL_GetWindowFromID(Event->window.windowID);
|
||||
int h,w;
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
OnResize(w, h);
|
||||
break;
|
||||
window = SDL_GetWindowFromID(Event->window.windowID);
|
||||
int h, w;
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
OnResize(w, h);
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
@@ -276,10 +291,11 @@ public:
|
||||
|
||||
void OnCleanup()
|
||||
{
|
||||
SDL_FreeSurface(Surf_Display);
|
||||
SDL_Quit();
|
||||
SDL_GL_DeleteContext(gl_context);
|
||||
SDL_Quit();
|
||||
}
|
||||
};
|
||||
SdlApp* SdlApp::sInstance = 0;
|
||||
|
||||
static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[] =
|
||||
{
|
||||
@@ -404,7 +420,11 @@ bool InitGame(void)
|
||||
|
||||
void DestroyGame(void)
|
||||
{
|
||||
g_engine->SetApp(NULL);
|
||||
if (g_engine != NULL)
|
||||
{
|
||||
g_engine->SetApp(NULL);
|
||||
}
|
||||
|
||||
if (g_app)
|
||||
{
|
||||
g_app->Destroy();
|
||||
@@ -444,7 +464,7 @@ void SdlApp::OnUpdate()
|
||||
if(g_engine)
|
||||
g_engine->Render();
|
||||
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
|
||||
void SdlApp::OnKeyPressed(const SDL_KeyboardEvent& event)
|
||||
@@ -633,23 +653,31 @@ bool SdlApp::OnInit()
|
||||
{
|
||||
int window_w, window_h;
|
||||
|
||||
if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||
{
|
||||
DebugTrace("I R in da OnInit()");
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||
#else
|
||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
#endif //__EMSCRIPTEN__
|
||||
{
|
||||
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;
|
||||
window_h = pVideoInfo->current_h;
|
||||
#if (defined ANDROID) || (defined IOS)|| (defined __EMSCRIPTEN__)
|
||||
window_w = currentDisplayMode.w;
|
||||
window_h = currentDisplayMode.h;
|
||||
#else
|
||||
window_w = ACTUAL_SCREEN_WIDTH;
|
||||
window_h = ACTUAL_SCREEN_HEIGHT;
|
||||
window_w = SCREEN_WIDTH;
|
||||
window_h = SCREEN_HEIGHT;
|
||||
#endif
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
int buffers, samples;
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
|
||||
@@ -663,26 +691,51 @@ 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_MULTISAMPLESAMPLES, 2);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
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);
|
||||
}
|
||||
|
||||
if((Surf_Display = SDL_SetVideoMode(window_w, window_h, 32,
|
||||
#ifdef ANDROID
|
||||
SDL_OPENGL | SDL_FULLSCREEN | SDL_WINDOW_BORDERLESS)) == NULL)
|
||||
{
|
||||
#ifndef __EMSCRIPTEN__
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
#else
|
||||
SDL_OPENGL | SDL_RESIZABLE )) == NULL)
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||
|
||||
SDL_DisplayMode current;
|
||||
SDL_GetCurrentDisplayMode(0, ¤t);
|
||||
#endif
|
||||
|
||||
#if (defined ANDROID)
|
||||
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS;
|
||||
#elif defined __EMSCRIPTEN__
|
||||
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS;
|
||||
#else
|
||||
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
|
||||
#endif
|
||||
window = SDL_CreateWindow(
|
||||
g_launcher->GetName(),
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
window_w, window_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)
|
||||
#if (defined GL_ES_VERSION_2_0)
|
||||
#if (defined GL_ES_VERSION_2_0) && (!defined __EMSCRIPTEN__)
|
||||
glClearDepthf(1.0f); // Depth Buffer Setup
|
||||
#else
|
||||
glClearDepth(1.0f); // Depth Buffer Setup
|
||||
@@ -729,7 +782,7 @@ bool SdlApp::OnInit()
|
||||
return true;
|
||||
};
|
||||
|
||||
#if (defined ANDROID) || (defined WIN32)
|
||||
#if (defined ANDROID)
|
||||
int SDL_main(int argc, char * argv[])
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
@@ -759,7 +812,8 @@ int main(int argc, char* argv[])
|
||||
|
||||
int result = g_SdlApp->OnExecute();
|
||||
|
||||
if (g_launcher)
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if (g_launcher)
|
||||
delete g_launcher;
|
||||
|
||||
if(g_SdlApp)
|
||||
@@ -767,6 +821,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// Shutdown
|
||||
DestroyGame();
|
||||
#endif //__EMSCRIPTEN__
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "WFilter.h"
|
||||
#include "StyleManager.h"
|
||||
#include "../../../JGE/src/tinyxml/tinyxml.h"
|
||||
#include "tinyxml.h"
|
||||
|
||||
void StyleManager::killRules()
|
||||
{
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
#include <QThread>
|
||||
#endif
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
#include <QThread>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
|
||||
#ifdef TESTSUITE
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
#ifdef SDL_CONFIG
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#ifdef QT_CONFIG
|
||||
#include <QKeySequence>
|
||||
#endif
|
||||
using std::string;
|
||||
using std::map;
|
||||
|
||||
@@ -27,6 +30,8 @@ const KeyRep& translateKey(LocalKeySym key)
|
||||
str = XKeysymToString(key);
|
||||
#elif defined (SDL_CONFIG)
|
||||
str = (char*)SDL_GetKeyName(key);
|
||||
#elif defined (QT_CONFIG)
|
||||
str = (char*)QKeySequence(key).toString().toUtf8().constData();
|
||||
#endif
|
||||
if (!str)
|
||||
{
|
||||
|
||||
@@ -121,6 +121,11 @@ WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardExerted::WEventCardExerted(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventVampire::WEventVampire(MTGCardInstance * card,MTGCardInstance * source,MTGCardInstance * victem) :
|
||||
WEventCardUpdate(card),source(source),victem(victem)
|
||||
{
|
||||
@@ -377,6 +382,12 @@ Targetable * WEventCardCycle::getTarget(int target)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardExerted::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardAttackedNotBlocked::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
|
||||
@@ -249,7 +249,7 @@ WFBFont::~WFBFont()
|
||||
}
|
||||
|
||||
#if defined (PSP)
|
||||
static void SwizzlePlot(u8* out, PIXEL_TYPE color, int i, int j, unsigned int width)
|
||||
void SwizzlePlot(u8* out, PIXEL_TYPE color, int i, int j, unsigned int width)
|
||||
{
|
||||
unsigned int rowblocks = (width >> 4);
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ ResourceManagerImpl::ResourceManagerImpl()
|
||||
|
||||
LOG("Calling CacheEngine::Create");
|
||||
|
||||
#ifdef PSP
|
||||
#if (defined PSP) || (defined __EMSCRIPTEN__)
|
||||
CacheEngine::Create<UnthreadedCardRetriever>(textureWCache);
|
||||
#else
|
||||
CacheEngine::Create<ThreadedCardRetriever>(textureWCache);
|
||||
|
||||
Vendored
Vendored
Vendored
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user