Commit 920e8f80 authored by 苍蓝's avatar 苍蓝

Initial commit (clean history)

parents
Pipeline #38488 canceled with stages
in 27 seconds
export ASSET_BRANCH_NAME="master"
# if $CI_COMMIT_REF_NAME includes develop or pre, then we use the develop branch
if [[ "$CI_COMMIT_REF_NAME" == *"develop"* || "$CI_COMMIT_REF_NAME" == *".pre"* ]]; then
export ASSET_BRANCH_NAME="develop"
fi
#!/bin/bash
set -x
set -o errexit
source .ci/asset-branch
# ygopro-database
apt update && apt -y install wget git libarchive-tools sqlite3
git clone --depth=1 -b master https://code.moenext.com/nanahira/ygopro-database
cp -rf ./ygopro-database/locales/$TARGET_LOCALE/strings.conf .
cp -rf ./ygopro-database/locales/$TARGET_LOCALE/servers.conf .
rm -f cards.cdb
sqlite3 ./ygopro-database/locales/$TARGET_LOCALE/cards.cdb .dump | sqlite3 cards.cdb
# ygopro-images
mkdir pics
if [[ "$ASSET_BRANCH_NAME" == "develop" ]]; then
echo "This is a pre-release, skipping download."
else
wget -O - https://cdn02.moecube.com:444/images/ygopro-images-${TARGET_LOCALE}.zip | bsdtar -C pics -xf -
fi
#!/bin/bash
libs_to_configure=(
"ogg"
# "opus"
)
cd miniaudio/external
for lib in "${libs_to_configure[@]}"; do
cd $lib
./configure
cd ..
done
#!/bin/sh
set -x
set -o errexit
cd event
./configure --disable-openssl --enable-static=yes --enable-shared=no
sed -f make-event-config.sed < config.h > ./include/event2/event-config.h
cd ..
#!/bin/bash
set -x
set -o errexit
TARGET_PLATFORM=$(arch)
TARGET_YGOPRO_BINARY_PATH=./ygopro-platforms/ygopro-platform-$TARGET_PLATFORM
./.ci/configure-audio.sh
rm -rf sqlite3/VERSION sqlite3/version
./premake5 gmake --cc=clang
cd build
make config=release -j$(sysctl -n hw.ncpu)
cd ..
mkdir ygopro-platforms
mv bin/release/YGOPro $TARGET_YGOPRO_BINARY_PATH
#if [[ $TARGET_PLATFORM == "x86" ]]; then
# install_name_tool -change /usr/local/lib/libirrklang.dylib @executable_path/../Frameworks/libirrklang.dylib $TARGET_YGOPRO_BINARY_PATH
#fi
strip $TARGET_YGOPRO_BINARY_PATH
#!/bin/bash
set -x
set -o errexit
ARCHIVE_FILES=(ygopro cards.cdb locales fonts sound textures strings.conf system.conf servers.conf pack)
if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM=linux
fi
#if [[ "$TARGET_PLATFORM" != "linuxarm" ]]; then
ARCHIVE_FILES+=(sound)
#fi
apt update && apt -y install tar zstd
mkdir dist replay
cp -rf locales/$TARGET_LOCALE/* .
tar -acf "dist/KoishiPro-dlc-$CI_COMMIT_REF_NAME-$TARGET_PLATFORM-$TARGET_LOCALE.tar.$ARCHIVE_SUFFIX" --exclude='.git*' "${ARCHIVE_FILES[@]}"
#!/bin/bash
set -x
set -o errexit
ARCHIVE_FILES=(ygopro LICENSE README.md lflist.conf strings.conf system.conf servers.conf cards.cdb script textures deck single pics replay windbot bot bot.conf locales fonts pack)
# TARGET_LOCALE
# ARCHIVE_SUFFIX
if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM=linux
fi
if [[ "$TARGET_PLATFORM" != "linuxarm" ]]; then
ARCHIVE_FILES+=(sound)
fi
apt update && apt -y install tar git zstd
mkdir dist replay
tar -acf "dist/KoishiPro-$CI_COMMIT_REF_NAME-$TARGET_PLATFORM-$TARGET_LOCALE.tar.$ARCHIVE_SUFFIX" --exclude='.git*' "${ARCHIVE_FILES[@]}"
#!/bin/bash
set -x
set -o errexit
ARCHIVE_FILES=(ygopro.app cards.cdb locales fonts sound textures strings.conf system.conf servers.conf pack)
if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM=darwin
fi
apt update && apt -y install tar zstd
mkdir dist replay
cp -rf locales/$TARGET_LOCALE/* .
tar -acf "dist/KoishiPro-dlc-$CI_COMMIT_REF_NAME-$TARGET_PLATFORM-$TARGET_LOCALE.tar.$ARCHIVE_SUFFIX" --exclude='.git*' "${ARCHIVE_FILES[@]}"
#!/bin/bash
set -x
set -o errexit
ARCHIVE_FILES=(ygopro.app LICENSE README.md lflist.conf strings.conf system.conf servers.conf cards.cdb script textures deck single pics replay sound windbot bot bot.conf locales fonts pack)
# TARGET_LOCALE
# ARCHIVE_SUFFIX
if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM=darwin
fi
apt update && apt -y install tar git zstd
mkdir dist replay
tar -acf "dist/KoishiPro-$CI_COMMIT_REF_NAME-$TARGET_PLATFORM-$TARGET_LOCALE.tar.$ARCHIVE_SUFFIX" --exclude='.git*' "${ARCHIVE_FILES[@]}"
#!/bin/bash
set -x
set -o errexit
ARCHIVE_FILES=(ygopro.exe vcomp140.dll LICENSE README.md lflist.conf strings.conf system.conf servers.conf cards.cdb script textures deck single pics replay sound bot.conf Bot.exe WindBot locales fonts skin pack)
if [[ "$TARGET_LOCALE" == "zh-CN" ]]; then
ARCHIVE_FILES=("${ARCHIVE_FILES[@]}" update-koishipro)
fi
# TARGET_LOCALE
if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM=win32
fi
apt update && apt -y install p7zip-full git
mkdir dist replay
7z a -mx9 -xr!.git* dist/KoishiPro-$CI_COMMIT_REF_NAME-win32-$TARGET_LOCALE.7z "${ARCHIVE_FILES[@]}"
#!/bin/bash
set -x
set -o errexit
ARCHIVE_FILES=(ygopro.exe vcomp140.dll cards.cdb locales fonts sound textures strings.conf system.conf servers.conf skin pack)
if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM=win32
fi
apt update && apt -y install tar zstd
mkdir dist replay
cp -rf locales/$TARGET_LOCALE/* .
tar -acf "dist/KoishiPro-dlc-$CI_COMMIT_REF_NAME-$TARGET_PLATFORM-$TARGET_LOCALE.tar.$ARCHIVE_SUFFIX" --exclude='.git*' "${ARCHIVE_FILES[@]}"
#!/bin/bash
set -x
set -o errexit
ARCHIVE_FILES=(ygopro.exe vcomp140.dll LICENSE README.md lflist.conf strings.conf system.conf servers.conf cards.cdb script textures deck single pics replay sound bot.conf Bot.exe WindBot locales fonts skin pack)
if [[ "$TARGET_LOCALE" == "zh-CN" && "$ARCHIVE_SUFFIX" != "zst" ]]; then
ARCHIVE_FILES=("${ARCHIVE_FILES[@]}" update-koishipro)
fi
# TARGET_LOCALE
# ARCHIVE_SUFFIX
if [[ -z "$TARGET_PLATFORM" ]]; then
TARGET_PLATFORM=win32
fi
apt update && apt -y install tar git zstd
mkdir dist replay
tar -acf "dist/KoishiPro-$CI_COMMIT_REF_NAME-$TARGET_PLATFORM-$TARGET_LOCALE.tar.$ARCHIVE_SUFFIX" --exclude='.git*' "${ARCHIVE_FILES[@]}"
#!/bin/bash
set -x
set -o errexit
source .ci/prepare-repo
prepare_repo "https://code.moenext.com/mycard/irrlicht-new.git" "irrlicht"
#!/bin/bash
set -x
set -o errexit
source .ci/prepare-repo
prepare_repo "https://code.moenext.com/mycard/miniaudio.git" "miniaudio"
cp -rf miniaudio/extras/miniaudio_split/miniaudio.* miniaudio/
mkdir -p miniaudio/external
install_external() {
dir="$1"
url="$2"
if [ ! -d "miniaudio/external/$dir" ]; then
mkdir -p "miniaudio/external/$dir"
# Download the external library and strip one level of directories from the archive
wget -O - "$url" | tar --strip-components=1 -C "miniaudio/external/$dir" -zxf -
fi
}
install_external "ogg" "https://mat-cacher.moenext.com/https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.gz"
install_external "opus" "https://mat-cacher.moenext.com/https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz"
install_external "opusfile" "https://mat-cacher.moenext.com/https://github.com/xiph/opusfile/releases/download/v0.12/opusfile-0.12.tar.gz"
install_external "vorbis" "https://mat-cacher.moenext.com/https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz"
source .ci/asset-branch
BRANCH_NAME="$ASSET_BRANCH_NAME"
prepare_repo() {
REPO_URL="$1"
TARGET_DIR_NAME="$2"
if [ ! -d "$TARGET_DIR_NAME" ]; then
echo "Cloning repository $REPO_URL branch $BRANCH_NAME into $TARGET_DIR_NAME"
git clone --depth=1 --branch "$BRANCH_NAME" "$REPO_URL" "$TARGET_DIR_NAME"
else
echo "Repository $REPO_URL already exists in $TARGET_DIR_NAME, updating to $BRANCH_NAME..."
cd "$TARGET_DIR_NAME"
git remote set-url origin "$REPO_URL"
git fetch origin "$BRANCH_NAME"
git checkout "$BRANCH_NAME"
git reset --hard origin/"$BRANCH_NAME"
cd ..
fi
}
#!/bin/bash
set -x
set -o errexit
echo "$MACOS_CERTIFICATE" | base64 --decode --output cert.p12
security create-keychain -p "$MACOS_KEYCHAIN_PASSWORD" "$MACOS_KEYCHAIN_NAME" || true
security list-keychains -s login.keychain "$MACOS_KEYCHAIN_NAME"
security default-keychain -s "$MACOS_KEYCHAIN_NAME"
security unlock-keychain -p "$MACOS_KEYCHAIN_PASSWORD" "$MACOS_KEYCHAIN_NAME"
security import cert.p12 -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$MACOS_KEYCHAIN_PASSWORD" "$MACOS_KEYCHAIN_NAME";
CERT_IDENTITY_NAME=$(security find-identity -v -p codesigning $MACOS_KEYCHAIN_NAME | head -1 | grep -o '".*"' | tr -d '"')
/usr/bin/codesign --deep --sign "$CERT_IDENTITY_NAME" ygopro.app
security lock-keychain "$MACOS_KEYCHAIN_NAME"
#!/bin/bash
set -o errexit
apt update; apt -y install curl jq
apiRoot=https://api.moecube.com
loginInfo=$(curl -sL -X POST $apiRoot/accounts/signin -d account=$MYCARD_USERNAME -d password=$MYCARD_PASSWORD)
token=$(echo $loginInfo | jq '.token' | sed 's/"//g')
header="Authorization: $token"
echo "Login succeeded."
appName="koishipro"
handleErrorMessage() {
rawJsonInput="$1"
successInfo=$(echo "$rawJsonInput" | jq '.success')
if [[ "$successInfo" != "true" ]]; then
echo "$rawJsonInput"
exit 1
fi
}
runForDepot() {
platform=$1
locale=$2
archivePath="./dist/KoishiPro-dlc-$appVersion-$platform-$locale.tar.zst"
suffix="?platform=$platform&locale=$locale&arch=generic"
echo "Uploading $archivePath"
result=$(curl -H "$header" -X POST "$apiRoot/release/api/build/$appName/${appVersion}${suffix}" -F file=@$archivePath)
handleErrorMessage "$result"
echo "$result" | jq .
}
source .ci/asset-branch
if [[ "$ASSET_BRANCH_NAME" == "develop" ]]; then
echo "This is a pre-release, skipping upload."
else
runForDepot win32 zh-CN
runForDepot linux zh-CN
runForDepot darwin zh-CN
runForDepot win32 en-US
runForDepot linux en-US
runForDepot darwin en-US
fi
This diff is collapsed.
# data files
/beta
/expansions
/specials
# build files
/bin
build
/obj
# dependencies
/event
/libevent*
/freetype
/sqlite3
/irrklang
/irrlicht*
/lua
/miniaudio
# gframe additionals
/gframe/ygopro.ico
/gframe/ygopro.rc
/gframe/ygopro.aps
/gframe/ygopro.icns
/gframe/dirent.h
# git repos
/CustomTools
/DataEditorX
/Magic*
/pics
/Printer
/ygopro-*
/*-Cards
# libs
/*.dll
/*.so
/*.dylib
# windbot related files
/[Bb]ot
/[Bb]ot.conf
/[Bb]ot.exe
/[Bb]ot.sh
/[Ww]ind[Bb]ot
# ygopro config file
/system_user.conf
# ygopro folders
/deck
/pack
/fonts
/replay
/single
/screenshots
/sound/*.wav
/sound/custom
/sound/BGM
/sound/README.md
/sound/LICENSE
/sound/,*
/update
/update*
/locales
/lib
/pack
# ygopro main program
/ygopro
/ygopro_*
/ygopro.exe
/ygopro_*.exe
/ygopro.app
/ygopro_*.app
/premake4
/premake4.exe
/premake5*
/premake5.exe
# others
*.log
.vscode
core*
/bak/
/.vs
/bug.txt
/output
/temp
[Tt]humbs.cdb
/PrinterData.txt
/*.bat
/*.sh
/*.sql
/patch.exe.manifest
/patch.exe
/diff.exe
stages:
- prepare
- build
- combine
- pack
- deploy
variables:
GIT_DEPTH: "1"
mat_common:
stage: prepare
tags:
- linux
script:
# lua
- wget -O - https://mat-cacher.moenext.com/https://www.lua.org/ftp/lua-5.4.8.tar.gz | tar zfx -
- mv lua-5.4.8 lua
# sqlite3
- wget -O - https://mat-cacher.moenext.com/https://www.sqlite.org/2025/sqlite-autoconf-3500100.tar.gz | tar zfx -
- mv sqlite-autoconf-3500100 sqlite3
# freetype
- wget -O - https://mat-cacher.moenext.com/https://downloads.sourceforge.net/freetype/freetype-2.13.3.tar.gz | tar zfx -
- mv freetype-2.13.3 freetype
# event
- wget -O - https://mat-cacher.moenext.com/https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz | tar zfx -
- mv libevent-2.1.12-stable event
# irrlicht
- ./.ci/prepare-irrlicht.sh
# miniaudio
- ./.ci/prepare-miniaudio.sh
# premake
- cp -rf premake/* .;
artifacts:
paths:
- lua
- freetype
- sqlite3
- event
- irrlicht
- miniaudio
mat_submodules:
stage: prepare
tags:
- linux
script:
- rm -rf ocgcore script
- mkdir ocgcore script
- git config --global --add safe.directory $CI_PROJECT_DIR
- git submodule update --init
artifacts:
paths:
- ocgcore
- script
#mat_linux:
# stage: prepare
# tags:
# - linux
# image: git-registry.mycard.moe/mycard/docker-runner-base:debian11
# script:
# - apt update; apt -y install git wget tar
# - ./.ci/prepare-irrlicht.sh
# artifacts:
# paths:
# - irrlicht
mat_macos:
stage: prepare
tags:
- linux
script:
- apt update; apt -y install wget tar
- wget -O - https://cdn02.moecube.com:444/premake5-built/premake-5.0.0-beta7-macosx.tar.gz | tar zfx -
- chmod +x premake5
artifacts:
paths:
- premake5
mat_windows:
stage: prepare
tags:
- linux
script:
- apt update; apt -y install wget tar patch p7zip-full
# premake5.exe
- wget https://cdn02.moecube.com:444/premake5-built/premake-5.0.0-beta7-windows.zip
- 7z x -y premake-5.0.0-beta7-windows.zip
artifacts:
paths:
- premake5.exe
._exec_build:
stage: build
variables:
NO_LUA_SAFE: '1' # on client no lua safe
#cache:
# key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
# paths:
# - bin/
# - obj/
exec_windows:
extends: ._exec_build
tags:
- vs
dependencies:
- mat_common
- mat_windows
- mat_submodules
script:
- bash -c 'cp -rf premake/* . ; cp -rf resource/* .'
- '.\premake5.exe vs2019'
- cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\YGOPro.sln /m /p:Configuration=Release /p:Platform=x64'
- copy bin\release\x64\ygopro.exe .
- copy C:\Windows\System32\vcomp140.dll .
artifacts:
paths:
- ygopro.exe
- vcomp140.dll
[submodule "ocgcore"]
path = ocgcore
url = https://github.com/purerosefallen/ygopro-core.git
[submodule "script"]
path = script
url = https://github.com/Smile-DK/ygopro-scripts.git
This diff is collapsed.
## YGOPro
A script engine for "yu-gi-oh!" and sample gui
[中文说明](https://github.com/Fluorohydride/ygopro/wiki/%E4%B8%AD%E6%96%87%E8%AF%B4%E6%98%8E)
### Keys:
* ESC: Minimize the window.
* A: Holding down this button will let the system stop at every timing.
* S: Holding down this button will let the system skip every timing.
* D: Holding down this button will let the system stop at available timing.
* R: Fix the font glitch.
* F1~F4: Show the cards in your grave, banished zone, extra deck, xyz materials.
* F5~F8: Show the cards in your opponent's grave, banished zone, extra deck, xyz materials.
### Color in card list:
#### Background:
* White = your card, Grey = your opponent's card
#### Text:
Cards in deck, extra deck and banished zone:
* Black = face-up, Blue = face-down
Xyz materials:
* Black = default, Blue = the owner of the xyz material is different from its controller
### Sequence:
* Monster Zone: 1~5, starting from the left hand side.
* Spell & Trap Zone: 1~5, starting from the left hand side.
* Field Zone: 6
* Pendulum Zone: 0~1, starting from the left hand side.
* The others: 1~n, starting from the bottom.
### Deck edit page:
* All numeric textboxs: They support >, =, <, >=, <= signs.
* Card name: Search card names and texts by default, $foo will only search foo in card names, and @foo will search cards of "foo" archetype(due to translation, card name contains "foo" does not mean that card is "foo" card).
### Command-line options:
* `-e foo.cdb`: Load foo.cdb as the extra database.
* `-n nickname`: Set the nickname.
* `-h 192.168.0.2`: Set the host to join in LAN mode.
* `-p 7911`: Set the port to join in LAN mode.
* `-w abc`: Set the password to join in LAN mode.
* `-d`: Enter the deck edit page.
* `-d deck`: If used along with `-j` it mean select the deck, or it will open the deck to edit.
* `-c`: Create host with default settings.
* `-j`: Join the host specified in above, or if absent, lasthost in system.conf file.
* `-r`: Enter the replay mode page.
* `-r replay.yrp`: Load the replay.yrp in replay mode.
* `-s`: Enter the single mode page.
* `-s puzzle.lua`: Load the puzzle.lua in single mode.
* `-k`: Keep when duel finished. See below.
#### Note:
* `-c` `-j` `-e` `-r` `-s` shoule be the last parameter, because any parameters after it will get ignored.
* `-d` `-c` `-j` `-e` `-r` `-s` will make YGOPro automatically exit when the duel or deck editing is finished. This is useful for some launchers. If you want to keep it, add `-k` before them.
* `-d` `-r` `-s` support full path of file, or just filename. But remember deck filename should NOT have extension when replay and single filename MUST have extension.
### Directories:
* pics: .jpg card images(177*254).
* pics\thumbnail: .jpg thumbnail images(44*64).
* script: .lua script files.
* textures: Other image files.
* deck: .ydk deck files.
* replay: .yrp replay files.
* expansions: *.cdb will be loaded as extra databases.
\ No newline at end of file
File added
project (ygo)
cmake_minimum_required (VERSION 3.8)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/macros")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include (AutoFiles)
include (platform/settings)
if (MSVC)
add_subdirectory (event)
add_subdirectory (freetype)
add_subdirectory (irrlicht)
add_subdirectory (sqlite3)
add_subdirectory (lua)
else ()
find_package(LibEvent REQUIRED)
find_package(Freetype REQUIRED)
find_package(Irrlicht REQUIRED)
find_package(Sqlite REQUIRED)
find_package(Lua REQUIRED)
find_package(OpenGL REQUIRED)
endif ()
option(USE_IRRKLANG "Use irrKlang sound library" OFF)
if (USE_IRRKLANG)
set(IRRKLANG_DIR ${CMAKE_SOURCE_DIR}/irrKlang)
endif ()
add_subdirectory (ocgcore)
add_subdirectory (gframe)
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
add_definitions ( "-fexceptions" "-fomit-frame-pointer" "-fno-strict-aliasing" "-Wno-format-security" )
add_definitions ( "-static-libgcc" "-static-libstdc++" )
add_definitions ( "-wd4996" "-D_CRT_SECURE_NO_WARNINGS" )
add_definitions ( "-D_UNICODE" "-DUNICODE" "/utf-8" )
include (MSVCMultipleProcessCompile)
include (MSVCStaticRuntime)
include (MSVCJustMyCodeDebugging)
function (AutoFiles _folder _base _pattern)
if (ARGC GREATER 3)
set(_exclude ${ARGN})
else ()
set(_exclude)
endif ()
file (GLOB _files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${_folder}/*)
set (folderFiles)
foreach (_fname ${_files})
if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_fname})
AutoFiles ("${_fname}" "${_base}" "${_pattern}" "${_exclude}")
elseif (_fname MATCHES ${_pattern})
if(_exclude)
if (NOT _fname MATCHES ${_exclude})
set(folderFiles ${folderFiles} ${_fname})
endif ()
else ()
set(folderFiles ${folderFiles} ${_fname})
endif ()
endif ()
endforeach ()
string(REPLACE "./" "" _folder2 ${_folder})
string(REPLACE "/" "\\" _folder2 ${_folder2})
if (_folder2 STREQUAL ".")
source_group(${_base} FILES ${folderFiles})
else ()
source_group(${_base}\\${_folder2} FILES ${folderFiles})
endif ()
set(AUTO_FILES_RESULT ${AUTO_FILES_RESULT} ${folderFiles} PARENT_SCOPE)
endfunction ()
# - Try to find the dl library
# Once done this will define
#
# DL_FOUND - System has libdl
# DL_LIBRARIES - The libraries needed to use libdl
# DL_DEFINITIONS - Compiler switches required for using libdl
FIND_PATH(DL_INCLUDE_DIR dlfcn.h
PATH_SUFFIXES include
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
FIND_LIBRARY(DL_LIBRARIES NAMES dl
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libdl DEFAULT_MSG DL_LIBRARIES DL_INCLUDE_DIR)
MARK_AS_ADVANCED(DL_INCLUDE_DIR DL_LIBRARIES)
# - Try to find the Lib library
# Once done this will define
#
# FREETYPE_FOUND - System has freetype
# FREETYPE_INCLUDE_DIR - The freetype include directory
# FREETYPE_LIBRARIES - The libraries needed to use freetype
# FREETYPE_DEFINITIONS - Compiler switches required for using freetype
SET(FREETYPE_DEFINITIONS ${PC_FREETYPE_CFLAGS_OTHER})
FIND_PATH(FREETYPE_INCLUDE_DIR ft2build.h
HINTS
${PC_FREETYPE_INCLUDEDIR}
${PC_FREETYPE_INCLUDE_DIRS}
PATH_SUFFIXES freetype2
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
FIND_LIBRARY(FREETYPE_LIBRARIES NAMES freetype
HINTS
${PC_FREETYPE_LIBDIR}
${PC_FREETYPE_LIBRARY_DIRS}
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FREETYPE DEFAULT_MSG FREETYPE_LIBRARIES FREETYPE_INCLUDE_DIR)
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR FREETYPE_LIBRARIES)
# - Try to find the Lib library
# Once done this will define
#
# IRRLICHT_FOUND - System has IRRLICHT
# IRRLICHT_INCLUDE_DIR - The IRRLICHT include directory
# IRRLICHT_LIBRARIES - The libraries needed to use IRRLICHT
# IRRLICHT_DEFINITIONS - Compiler switches required for using IRRLICHT
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
#FIND_PACKAGE(PkgConfig)
#PKG_SEARCH_MODULE(PC_IRRLICHT Irrlicht)
SET(IRRLICHT_DEFINITIONS ${PC_IRRLICHT_CFLAGS_OTHER})
FIND_PATH(IRRLICHT_INCLUDE_DIR irrlicht.h
HINTS
${PC_IRRLICHT_INCLUDEDIR}
${PC_IRRLICHT_INCLUDE_DIRS}
PATH_SUFFIXES include include/irrlicht
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
FIND_LIBRARY(IRRLICHT_LIBRARIES NAMES Irrlicht irrlicht
HINTS
${PC_IRRLICHT_LIBDIR}
${PC_IRRLICHT_LIBRARY_DIRS}
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARIES IRRLICHT_INCLUDE_DIR)
MARK_AS_ADVANCED(IRRLICHT_INCLUDE_DIR IRRLICHT_LIBRARIES)
# - Try to find the Lib library
# Once done this will define
#
# LIBEVENT_FOUND - System has Libevent
# LIBEVENT_INCLUDE_DIR - The Libevent include directory
# LIBEVENT_LIBRARIES - The libraries needed to use Libevent
# LIBEVENT_DEFINITIONS - Compiler switches required for using Libevent
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
#FIND_PACKAGE(PkgConfig)
#PKG_SEARCH_MODULE(PC_LIBEVENT event)
SET(LIBEVENT_DEFINITIONS ${PC_LIBEVENT_CFLAGS_OTHER})
FIND_PATH(LIBEVENT_INCLUDE_DIR event2/event.h
HINTS
${PC_LIBEVENT_INCLUDEDIR}
${PC_LIBEVENT_INCLUDE_DIRS}
PATH_SUFFIXES include
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
FIND_LIBRARY(LIBEVENT_LIBRARIES NAMES event
HINTS
${PC_LIBEVENT_LIBDIR}
${PC_LIBEVENT_LIBRARY_DIRS}
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
FIND_LIBRARY(LIBEVENT_LIBRARIES_PTHREADS NAMES event_pthreads
HINTS
${PC_LIBEVENT_LIBDIR}
${PC_LIBEVENT_LIBRARY_DIRS}
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
SET(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARIES} ${LIBEVENT_LIBRARIES_PTHREADS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibEvent DEFAULT_MSG LIBEVENT_LIBRARIES LIBEVENT_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBEVENT_INCLUDE_DIR LIBEVENT_LIBRARIES)
# Locate Lua library
# This module defines
# LUA52_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include <lua/lua.h>
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-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(LUA_INCLUDE_DIR lua.h
HINTS
$ENV{LUA_DIR}
PATH_SUFFIXES include/lua53 include/lua5.3 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
FIND_LIBRARY(LUA_LIBRARY
NAMES lua53-c++ lua5.3-c++ lua-5.3-c++ lua-c++
HINTS
$ENV{LUA_DIR}
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
IF(LUA_LIBRARY)
# include the math library for Unix
IF(UNIX AND NOT APPLE)
FIND_LIBRARY(LUA_MATH_LIBRARY m)
SET( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
ELSE(UNIX AND NOT APPLE)
SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
ENDIF(UNIX AND NOT APPLE)
ENDIF(LUA_LIBRARY)
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
UNSET(lua_version_str)
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
# - Try to find the Lib library
# Once done this will define
#
# SQLITE_FOUND - System has sqlite
# SQLITE_INCLUDE_DIR - The sqlite include directory
# SQLITE_LIBRARIES - The libraries needed to use sqlite
# SQLITE_DEFINITIONS - Compiler switches required for using sqlite
SET(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER})
FIND_PATH(SQLITE_INCLUDE_DIR sqlite3.h
HINTS
${PC_SQLITE_INCLUDEDIR}
${PC_SQLITE_INCLUDE_DIRS}
PATH_SUFFIXES include
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
FIND_LIBRARY(SQLITE_LIBRARIES NAMES sqlite3
HINTS
${PC_SQLITE_LIBDIR}
${PC_SQLITE_LIBRARY_DIRS}
PATH_SUFFIXES lib64 lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/opt/local
)
SET(SQLITE_LIBRARIES ${SQLITE_LIBRARIES})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLITE DEFAULT_MSG SQLITE_LIBRARIES SQLITE_INCLUDE_DIR)
MARK_AS_ADVANCED(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES)
# - Combine lists of prefixes and suffixes in all combinations
#
# list_combinations(var PREFIXES listitems... SUFFIXES listitems...) -
# where var is the name of your desired output variable and PREFIXES
# and SUFFIXES are special arguments that indicate the start of your
# list of prefixes or suffixes respectively.
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__list_combinations)
return()
endif()
set(__list_combinations YES)
function(list_combinations var)
# Parse arguments
set(_prefixes)
set(_suffixes)
set(_nowhere)
set(_curdest _nowhere)
foreach(_element ${ARGN})
if("${_element}" STREQUAL "PREFIXES")
set(_curdest _prefixes)
elseif("${_element}" STREQUAL "SUFFIXES")
set(_curdest _suffixes)
else()
list(APPEND ${_curdest} "${_element}")
endif()
endforeach()
if(_nowhere)
message(STATUS "_prefixes ${_prefixes}")
message(STATUS "_prefixes ${_suffixes}")
message(STATUS "_prefixes ${_nowhere}")
message(FATAL_ERROR
"Syntax error in use of ${CMAKE_CURRENT_LIST_FILE}")
endif()
foreach(_prefix ${_prefixes})
foreach(_suffix ${_suffixes})
list(APPEND _out "${_prefix}${_suffix}")
endforeach()
endforeach()
set(${var} "${_out}" PARENT_SCOPE)
endfunction()
# - Enable Just My Code debugging on MSVC
#
# include(MSVCJustMyCodeDebugging)
#
# Requires these CMake modules:
# ListCombinations.cmake
#
# The cmake property VS_JUST_MY_CODE_DEBUGGING introduced in CMake 3.15
# also add /JMC to Release configuration, which is inappropriate
if(MSVC AND NOT "${MSVC_VERSION}" LESS 1918)
# Only available in VS 2017 15.8 and newer
include(ListCombinations)
list_combinations(_varnames
PREFIXES
CMAKE_CXX_FLAGS_
SUFFIXES
DEBUG
RELWITHDEBINFO)
foreach(_var ${_varnames})
set(${_var} "${${_var}} /JMC")
endforeach()
endif()
# - Compile with multiple processes on MSVC
#
# include(MSVCMultipleProcessCompile)
#
# Requires these CMake modules:
# ListCombinations.cmake
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(MSVC AND NOT "${MSVC_VERSION}" LESS 1400)
# Only available in VS 2005 and newer
string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC)
include(ListCombinations)
list_combinations(_varnames
PREFIXES
CMAKE_C_FLAGS_
CMAKE_CXX_FLAGS_
SUFFIXES
${_conftypesUC})
foreach(_var ${_varnames})
set(${_var} "${${_var}} /MP")
endforeach()
endif()
# - Modify compile flags to use the static runtimes of MSVC
#
# include(MSVCStaticRuntime)
#
# Requires these CMake modules:
# ListCombinations.cmake
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(MSVC)
string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC)
include(ListCombinations)
list_combinations(_varnames
PREFIXES
CMAKE_C_FLAGS_
CMAKE_CXX_FLAGS_
SUFFIXES
${_conftypesUC})
foreach(_var ${_varnames})
string(REPLACE "/MDd" "/MTd" ${_var} "${${_var}}")
string(REPLACE "/MD" "/MT" ${_var} "${${_var}}")
endforeach()
endif()
set(Boost_USE_STATIC_LIBS ON)
add_definitions ( "-DLUA_USE_MACOSX" )
add_definitions ( "-DLUA_USE_POSIX" )
add_definitions ( "-DLUA_USE_LINUX" )
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(PLATFORM 64)
MESSAGE(STATUS "Detected 64-bit platform")
else()
set(PLATFORM 32)
MESSAGE(STATUS "Detected 32-bit platform")
endif()
if(WIN32)
include(platform/win)
elseif(UNIX)
include(platform/unix)
endif()
if (APPLE)
include (platform/apple)
if ("${CMAKE_GENERATOR}" MATCHES "Xcode")
include (platform/xcode)
endif ()
elseif (CMAKE_SYSTEM MATCHES Linux)
include (platform/linux)
else ()
include (platform/common)
endif ()
if(CMAKE_C_COMPILER MATCHES "icc")
include(compiler/icc)
elseif(CMAKE_C_COMPILER MATCHES "clang")
include(compiler/clang-compile)
elseif(CMAKE_C_COMPILER MATCHES "cc")
include(compiler/gcc)
endif()
find_package(Threads)
find_package(DL)
if ( MSVC )
include(compiler/msvc)
elseif ( MINGW )
if(CMAKE_C_COMPILER MATCHES "clang")
include(compiler/clang)
elseif(CMAKE_C_COMPILER MATCHES "cc")
include(compiler/gcc)
endif()
include(compiler/mingw)
endif()
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
This diff is collapsed.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef _C_GUI_IMAGE_BUTTON_H_
#define _C_GUI_IMAGE_BUTTON_H_
#include <IrrCompileConfig.h>
#ifdef _IRR_COMPILE_WITH_GUI_
#include <IGUIButton.h>
#include <SColor.h>
namespace irr {
namespace video {
class IVideoDriver;
class ITexture;
}
namespace gui {
class IGUISpriteBank;
void Draw2DImageRotation(video::IVideoDriver* driver, video::ITexture* image, core::rect<s32> sourceRect,
core::vector2d<s32> position, core::vector2d<s32> rotationPoint, f32 rotation = 0.0f,
core::vector2df scale = core::vector2df(1.0, 1.0), bool useAlphaChannel = true, video::SColor color = 0xffffffff);
void Draw2DImageQuad(video::IVideoDriver* driver, video::ITexture* image, core::rect<s32> sourceRect,
core::vector2d<s32> corner[4], bool useAlphaChannel = true, video::SColor color = 0xffffffff);
class CGUIImageButton : public IGUIButton {
public:
static CGUIImageButton* addImageButton(IGUIEnvironment* env, const core::rect<s32>& rectangle, IGUIElement* parent, s32 id);
//! constructor
CGUIImageButton(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool noclip = false);
//! destructor
~CGUIImageButton() override;
//! called if an event happened.
bool OnEvent(const SEvent& event) override;
//! draws the element and its children
void draw() override;
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
void setOverrideFont(IGUIFont* font = 0) override;
//! Gets the override font (if any)
IGUIFont* getOverrideFont() const override;
//! Get the font which is used right now for drawing
IGUIFont* getActiveFont() const override;
//! Sets an image which should be displayed on the button when it is in normal state.
void setImage(video::ITexture* image = 0) override;
//! Sets an image which should be displayed on the button when it is in normal state.
void setImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
void setPressedImage(video::ITexture* image = 0) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets the sprite bank used by the button
void setSpriteBank(IGUISpriteBank* bank = 0) override;
//! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
\param state: State of the button to set the sprite for
\param index: The sprite number from the current sprite bank
\param color: The color of the sprite
*/
void setSprite(EGUI_BUTTON_STATE state, s32 index,
video::SColor color = video::SColor(255, 255, 255, 255), bool loop = false) override;
//! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button,
//! the user can change the state of the button.
void setIsPushButton(bool isPushButton = true) override;
//! Checks whether the button is a push button
bool isPushButton() const override;
//! Sets the pressed state of the button if this is a pushbutton
void setPressed(bool pressed = true) override;
//! Returns if the button is currently pressed
bool isPressed() const override;
//! Sets if the button should use the skin to draw its border
void setDrawBorder(bool border = true) override;
//! Checks if the button face and border are being drawn
bool isDrawingBorder() const override;
//! Sets if the alpha channel should be used for drawing images on the button (default is false)
void setUseAlphaChannel(bool useAlphaChannel = true) override;
//! Checks if the alpha channel should be used for drawing images on the button
bool isAlphaChannelUsed() const override;
//! Sets if the button should scale the button images to fit
void setScaleImage(bool scaleImage = true) override;
//! Checks whether the button scales the used images
bool isScalingImage() const override;
//! Writes attributes of the element.
void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const override;
//! Reads attributes of the element
void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) override;
// from ygopro
void setDrawImage(bool b);
void setImageRotation(f32 r);
void setImageScale(core::vector2df s);
void setImageSize(core::dimension2di s);
protected:
struct ButtonSprite
{
s32 Index;
video::SColor Color;
bool Loop;
};
ButtonSprite ButtonSprites[EGBS_COUNT];
IGUISpriteBank* SpriteBank;
IGUIFont* OverrideFont;
video::ITexture* Image;
video::ITexture* PressedImage;
core::rect<s32> ImageRect;
core::rect<s32> PressedImageRect;
bool IsPushButton;
bool Pressed;
bool UseAlphaChannel;
bool DrawBorder;
bool ScaleImage;
// from ygopro
bool isDrawImage;
bool isFixedSize;
f32 imageRotation;
core::vector2df imageScale;
core::dimension2di imageSize;
};
}
}
#endif // _IRR_COMPILE_WITH_GUI_
#endif //_C_GUI_IMAGE_BUTTON_H_
#include "CConfigMap.h"
core::stringc CConfigMap::getConfig( const core::stringc& name )
{
core::map<core::stringc,core::stringc>::Node* node = Map.find(name);
if ( node == 0 )
return core::stringc();
return node->getValue();
}
s32 CConfigMap::getConfigAsInt( const core::stringc& name )
{
core::stringc cfg = getConfig(name);
if ( cfg.size() == 0 )
return 0;
s32 x = 0;
sscanf( cfg.c_str(), "%d", &x );
return x;
}
f32 CConfigMap::getConfigAsFloat( const core::stringc& name )
{
core::stringc cfg = getConfig(name);
if ( cfg.size() == 0 )
return 0;
f32 x = 0.0f;
sscanf( cfg.c_str(), "%f", &x );
return x;
}
core::vector2df CConfigMap::getConfigAsVector2df( const core::stringc& name )
{
core::stringc cfg = getConfig(name);
if ( cfg.size() == 0 )
return core::vector2df(0,0);
core::vector2df vec;
sscanf( cfg.c_str(), "%f , %f", &vec.X, &vec.Y );
return vec;
}
core::vector3df CConfigMap::getConfigAsVector3df( const core::stringc& name )
{
core::stringc cfg = getConfig(name);
if ( cfg.size() == 0 )
return core::vector3df(0,0,0);
core::vector3df vec;
sscanf( cfg.c_str(), "%f , %f , %f", &vec.X, &vec.Y, &vec.Z );
return vec;
}
bool CConfigMap::hasConfig( const core::stringc& name )
{
core::map<core::stringc,core::stringc>::Node* node = Map.find(name);
return ( node != 0 );
}
void CConfigMap::setConfig( const core::stringc& name, const core::stringc& value )
{
Map.set(name,value);
}
#ifndef CCONFIGMAP_H_
#define CCONFIGMAP_H_
#include <irrMap.h>
#include <irrString.h>
#include <irrTypes.h>
#include <vector2d.h>
#include <vector3d.h>
using namespace irr;
class CConfigMap
{
public:
core::stringc getConfig( const core::stringc& name );
s32 getConfigAsInt( const core::stringc& name );
f32 getConfigAsFloat( const core::stringc& name );
core::vector2df getConfigAsVector2df( const core::stringc& name );
core::vector3df getConfigAsVector3df( const core::stringc& name );
bool hasConfig( const core::stringc& name );
void setConfig( const core::stringc& name, const core::stringc& value );
private:
core::map<core::stringc,core::stringc> Map;
};
#endif
#include "CGUIProgressBar.h"
#include <IGUIEnvironment.h>
#include "CImageGUISkin.h"
#include <IGUIFont.h>
namespace irr
{
namespace gui
{
CGUIProgressBar::CGUIProgressBar( IGUIElement* parent, IGUIEnvironment* environment, const core::rect<s32>& rectangle, s32 id,bool bind )
: IGUIElement( EGUIET_ELEMENT, environment, parent, id, rectangle )
{
FilledRatio = 0.0f;
FillColor = video::SColor(255,255,0,0);
EmptyColor = video::SColor();
AutomaticTextFormat = L"%2.0f %%";
bindColorsToSkin = bind;
}
void CGUIProgressBar::setAutomaticText( const wchar_t* text )
{
AutomaticTextFormat = text? text:L"";
if ( AutomaticTextFormat != L"" )
{
wchar_t* buffer = new wchar_t[ AutomaticTextFormat.size() + 10 ];
swprintf( buffer, AutomaticTextFormat.size() + 10, AutomaticTextFormat.c_str(), 100*FilledRatio );
Text = buffer;
delete buffer;
}
}
void CGUIProgressBar::setFillColor( video::SColor fill )
{
FillColor = fill;
}
video::SColor CGUIProgressBar::getFillColor() const
{
return FillColor;
}
void CGUIProgressBar::setEmptyColor( video::SColor empty )
{
EmptyColor = empty;
}
video::SColor CGUIProgressBar::getEmptyColor() const
{
return EmptyColor;
}
void CGUIProgressBar::setProgress( f32 progress )
{
FilledRatio = progress;
if ( AutomaticTextFormat != L"" )
{
wchar_t* buffer = new wchar_t[ AutomaticTextFormat.size() + 10 ];
swprintf( buffer, AutomaticTextFormat.size() + 10, AutomaticTextFormat.c_str(), 100*FilledRatio );
Text = buffer;
delete buffer;
}
}
f32 CGUIProgressBar::getProgress() const
{
return FilledRatio;
}
void CGUIProgressBar::draw()
{
CImageGUISkin* skin = static_cast<CImageGUISkin*>( Environment->getSkin() );
// Madoc added these changes to let the progress bar get its fill colors from the skin
if(bindColorsToSkin) {
EmptyColor = ((gui::SImageGUISkinConfig)skin->getConfig()).ProgressBar.Color;
FillColor = ((gui::SImageGUISkinConfig)skin->getConfig()).ProgressBarFilled.Color;
}
// End Madoc changes
skin->drawHorizontalProgressBar( this, AbsoluteRect, &AbsoluteClippingRect, FilledRatio, FillColor, EmptyColor );
// Draw text in center
skin->getFont(EGDF_DEFAULT)->draw( Text.c_str(), AbsoluteRect, skin->getColor(EGDC_BUTTON_TEXT), true, true, &AbsoluteClippingRect );
}
}
}
#ifndef CGUIPROGRESSBAR_H_
#define CGUIPROGRESSBAR_H_
#include <IGUIElement.h>
#include <SColor.h>
namespace irr
{
namespace gui
{
/*!
* A horizontal progess bar. ONLY works with CImageGUISkin applied - will fail
* if another skin is used.
*/
class CGUIProgressBar : public IGUIElement
{
public:
// If you want your progress bar colors to be independent of the skin set bind to false -- Madoc
CGUIProgressBar( IGUIElement* parent, IGUIEnvironment* environment, const core::rect<s32>& rectangle, s32 id=-1 ,bool bind=true);
//! Automatically updates the progress bar's text every time the progress changes.
//! Set format to NULL or an empty string to disable automatic text.
void setAutomaticText( const wchar_t* format );
void setFillColor( video::SColor fill );
video::SColor getFillColor() const;
void setEmptyColor( video::SColor empty );
video::SColor getEmptyColor() const;
void setProgress( f32 progress );
f32 getProgress() const;
virtual void draw();
private:
video::SColor FillColor;
video::SColor EmptyColor;
bool bindColorsToSkin;
f32 FilledRatio;
core::stringw AutomaticTextFormat;
};
} // namespace gui
} // namespace irr
#endif
This diff is collapsed.
#ifndef __C_GUISKIN_SYSTEM_H_INCLUDED__
#define __C_GUISKIN_SYSTEM_H_INCLUDED__
#ifdef _WIN32
#include <irrlicht.h>
#endif
#include "CImageGUISkin.h"
#include "CGUIProgressBar.h"
//#include "SkinLoader.h"
#include "../CXMLRegistry/CXMLRegistry.h"
#ifndef _WIN32
// gcc dosnt do 'debug'
#ifndef _DEBUG
#define _DEBUG
#endif
#endif
#define SKINSYSTEM_SKINFILE "/skin.xml"
using namespace irr;
class CGUISkinSystem {
private :
IrrlichtDevice *device;
io::IFileSystem *fs;
io::path skinsPath;
core::array<core::stringw> skinsList;
CXMLRegistry *registry;
gui::CImageGUISkin* loadSkinFromFile(const c8 *skinfile);
void ParseGUIElementStyle(gui::SImageGUIElementStyle& elem, const core::stringc& name,bool nullcolors=false);
bool checkSkinColor(gui::EGUI_DEFAULT_COLOR colToSet,const wchar_t *context,gui::CImageGUISkin *skin);
bool checkSkinSize(gui::EGUI_DEFAULT_SIZE sizeToSet,const wchar_t *context,const wchar_t *key,gui::CImageGUISkin *skin);
bool loadProperty(core::stringw key,gui::CImageGUISkin *skin);
public:
// Constructor
// path = Path to skins
// dev = Irrlicht device
CGUISkinSystem(core::string<wchar_t> path,IrrlichtDevice *dev);
~CGUISkinSystem();
core::array<core::stringw> listSkins();
bool loadSkinList();
bool applySkin(const wchar_t *skinname);
gui::CGUIProgressBar *addProgressBar(gui::IGUIElement *parent,core::rect<s32> rect,bool bindColorsToSkin=true);
// Gets property from current skin
core::stringw getProperty(core::stringw key);
bool populateTreeView(gui::IGUITreeView *control,const core::stringc& skinname);
};
#endif
This diff is collapsed.
#ifndef CIMAGEGUISKIN_H_
#define CIMAGEGUISKIN_H_
#include <IGUISkin.h>
#include <irrString.h>
#include <irrMap.h>
#include <IGUISpriteBank.h>
namespace irr
{
namespace video
{
class IVideoDriver;
class ITexture;
}
namespace gui
{
struct SImageGUIElementStyle
{
struct SBorder
{
s32 Top, Left, Bottom, Right;
SBorder() : Top(0), Left(0), Bottom(0), Right(0) {}
};
SBorder SrcBorder;
SBorder DstBorder;
video::ITexture* Texture;
video::SColor Color;
SImageGUIElementStyle() : Texture(0), Color(255,255,255,255) {}
};
struct SImageGUISkinConfig
{
SImageGUIElementStyle SunkenPane, Window, Button, ButtonPressed, ButtonDisabled, ProgressBar, ProgressBarFilled, TabButton, TabButtonPressed, TabBody, MenuBar, MenuPane, MenuPressed, CheckBox, CheckBoxDisabled, ComboBox, ComboBoxDisabled;
video::SColor CheckBoxColor;
};
class CImageGUISkin : public IGUISkin
{
public:
CImageGUISkin( video::IVideoDriver* videoDriver, IGUISkin* fallbackSkin );
virtual ~CImageGUISkin();
void loadConfig( const SImageGUISkinConfig& config );
//! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const;
//! sets a default color
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor);
//! returns default color
virtual s32 getSize(EGUI_DEFAULT_SIZE size) const;
//! Returns a default text.
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const;
//! Sets a default text.
virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText);
//! sets a default size
virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size);
//! returns the default font
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT defaultFont) const;
//! sets a default font
virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT defaultFont);
//! returns the sprite bank
virtual IGUISpriteBank* getSpriteBank() const;
//! sets the sprite bank
virtual void setSpriteBank(IGUISpriteBank* bank);
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const;
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index);
virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat, bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
/* Updates for irrlicht 1.7 by Mamnarock
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
*/
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0,
core::rect<s32>* checkClientArea=0);
virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
virtual void draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0,s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT );
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0);
// Madoc - I had to add some things
// Exposes config so we can get the progress bar colors
virtual SImageGUISkinConfig getConfig() { return Config; }
// End Madoc adds
virtual void drawHorizontalProgressBar( IGUIElement* element, const core::rect<s32>& rectangle, const core::rect<s32>* clip,
f32 filledRatio, video::SColor fillColor, video::SColor emptyColor );
virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
const core::rect<s32>& pos, const core::rect<s32>* clip = 0);
virtual void setProperty(core::stringw key, core::stringw value);
virtual core::stringw getProperty(core::stringw key);
private:
void drawElementStyle( const SImageGUIElementStyle& elem, const core::rect<s32>& rect, const core::rect<s32>* clip, video::SColor* color=0 );
video::IVideoDriver* VideoDriver;
IGUISkin* FallbackSkin;
SImageGUISkinConfig Config;
core::map<core::stringw,core::stringw> properties;
};
}
}
#endif
#ifndef _CLIP_RECTS_H_
#define _CLIP_RECTS_H_
#include <rect.h>
namespace irr
{
//! Workaround for a bug in IVideoDriver::draw2DImage( ITexture* tex, rect<s32> dstRect, rect<s32> srcRect, rect<s32>* clip, SColor* colors, bool alpha )
//! It modifies dstRect and srcRect so the resulting dstRect is entirely inside the clipping rect.
//! srcRect is scaled so the same part of the image is displayed.
//! Returns false if dstRect is entirely outside clip, or true if at least some of it is inside.
inline bool clipRects( core::rect<s32>& dstRect, core::rect<s32>& srcRect, const core::rect<s32>& clip )
{
// Clip left side
if ( dstRect.UpperLeftCorner.X < clip.UpperLeftCorner.X )
{
s32 w = clip.UpperLeftCorner.X - dstRect.UpperLeftCorner.X;
f32 percentRemoved = (f32)w / (f32)dstRect.getWidth();
dstRect.UpperLeftCorner.X = clip.UpperLeftCorner.X;
srcRect.UpperLeftCorner.X += (s32)(percentRemoved * srcRect.getWidth());
}
// Clip top side
if ( dstRect.UpperLeftCorner.Y < clip.UpperLeftCorner.Y )
{
s32 w = clip.UpperLeftCorner.Y - dstRect.UpperLeftCorner.Y;
f32 percentRemoved = (f32)w / (f32)dstRect.getHeight();
dstRect.UpperLeftCorner.Y = clip.UpperLeftCorner.Y;
srcRect.UpperLeftCorner.Y += (s32)(percentRemoved * srcRect.getHeight());
}
// Clip right side
if ( dstRect.LowerRightCorner.X > clip.LowerRightCorner.X )
{
s32 w = dstRect.LowerRightCorner.X - clip.LowerRightCorner.X;
f32 percentRemoved = (f32)w / (f32)dstRect.getWidth();
dstRect.LowerRightCorner.X = clip.LowerRightCorner.X;
srcRect.LowerRightCorner.X -= (s32)(percentRemoved * srcRect.getWidth());
}
// Clip bottom side
if ( dstRect.LowerRightCorner.Y > clip.LowerRightCorner.Y )
{
s32 w = dstRect.LowerRightCorner.Y - clip.LowerRightCorner.Y;
f32 percentRemoved = (f32)w / (f32)dstRect.getHeight();
dstRect.LowerRightCorner.Y = clip.LowerRightCorner.Y;
srcRect.LowerRightCorner.Y -= (s32)(percentRemoved * srcRect.getHeight());
}
return ( dstRect.getWidth() > 0 && dstRect.getHeight() > 0 );
}
} // namespace irr
#endif
This diff is collapsed.
This diff is collapsed.
project (ygopro)
if (NOT WIN32 AND NOT APPLE)
include (FindX11)
endif ()
add_subdirectory (lzma)
set (AUTO_FILES_RESULT)
if (MSVC)
AutoFiles("." "res" "\\.(rc)$")
AutoFiles("." "src" "\\.(cpp|c|h)$" "CGUIButton.cpp|lzma/\\.*")
else ()
AutoFiles("." "src" "\\.(cpp|c|h)$" "lzma/\\.*")
endif ()
if (MSVC)
add_executable (ygopro WIN32 ${AUTO_FILES_RESULT})
set_target_properties (ygopro PROPERTIES
LINK_FLAGS /ENTRY:"mainCRTStartup"
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ygopro)
else ()
add_executable (ygopro ${AUTO_FILES_RESULT})
endif ()
target_link_libraries (ygopro ocgcore clzma)
if (MSVC)
target_link_libraries (ygopro irrlicht freetype sqlite3 event)
include_directories ( "../irrlicht/include" "../freetype/include" "../event/include" "../sqlite3" )
else ()
target_link_libraries (ygopro
${IRRLICHT_LIBRARIES}
${FREETYPE_LIBRARIES}
${SQLITE_LIBRARIES}
${LIBEVENT_LIBRARIES}
${OPENGL_gl_LIBRARY}
)
include_directories (
${IRRLICHT_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIR}
${SQLITE_INCLUDE_DIRS}
${LIBEVENT_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
)
target_link_libraries (ygopro ${CMAKE_THREAD_LIBS_INIT} ${DL_LIBRARIES})
endif ()
if (APPLE)
find_library(COCOA_LIBRARY Cocoa)
find_library(IOKIT_LIBRARY IOKit)
target_link_libraries(ygopro ${COCOA_LIBRARY} ${IOKIT_LIBRARY})
endif ()
if (USE_IRRKLANG)
add_definitions ( "-DYGOPRO_USE_IRRKLANG" )
if (MSVC)
target_link_libraries (ygopro ${IRRKLANG_DIR}/lib/Win32-visualStudio/irrKlang.lib)
elseif (CMAKE_SYSTEM MATCHES Linux)
target_link_libraries (ygopro ${IRRKLANG_DIR}/bin/linux-gcc-64/libIrrKlang.so)
endif ()
include_directories ( "${IRRKLANG_DIR}/include" )
endif ()
if (WIN32)
target_link_libraries (ygopro ws2_32 winmm gdi32 kernel32 user32 imm32 opengl32)
endif ()
#include "CXMLNode.h"
CXMLNODETYPE CXMLNode::getType() { return type; }
void CXMLNode::setType(CXMLNODETYPE newtype) { type = newtype; }
void CXMLNode::setName(const wchar_t* newname) { name = newname; }
const wchar_t* CXMLNode::getName() { return name.c_str(); }
CXMLNode *CXMLNode::getThis() { return this; }
void CXMLNode::setValue(const wchar_t* newvalue) {
value = newvalue;
}
CXMLNode *CXMLNode::getParent() {
return parent;
}
void CXMLNode::setParent(CXMLNode *newparent) {
parent = newparent;
}
/*
bool CXMLNode::getValueAsBool() {
if(!value.size()) return false;
if(value.equals_ignore_case((core::stringw)"true")) return true;
return false;
}
s32 CXMLNode::getValueAsInt() {
if(!value.size()) return 0;
return _wtoi(value.c_str());
}
const wchar_t* CXMLNode::getValueAsCStr() {
if(!value.size()) return false;
return value.c_str();
}
*/
/*
u16 CXMLNode::getChildCount() {
return children.getSize();
}
irr::core::list<CXMLNode*>::Iterator CXMLNode::getFirstChild() {
//if(children.empty()) return 0;
return children.begin();
}
irr::core::list<CXMLNode*>::Iterator CXMLNode::getLastChild() {
//if(children.empty()) return 0;
return children.getLast();
}
*/
const wchar_t* CXMLNode::getValue() {
return value.c_str();
}
void CXMLNode::addChild(CXMLNode *newchild) {
children.push_back(newchild);
}
void CXMLNode::drop() {
if(children.getSize() != 0) {
core::list<CXMLNode*>::Iterator it;
for( it = children.begin(); it != children.end(); it++ ) {
( *it )->drop();
}
children.clear();
}
}
CXMLNode *CXMLNode::findChildByName(const wchar_t *name) {
core::list<CXMLNode*>::Iterator it;
core::stringw tmp;
CXMLNode *node = NULL;
tmp = name;
for( it = children.begin(); it != children.end(); it++ ) {
if(tmp.equals_ignore_case((*it)->getName())) {
node = (*it);
break;
}
}
return node;
}
core::array<const wchar_t*> *CXMLNode::listChildrenByType(CXMLNODETYPE nodetype) {
core::array<const wchar_t*> *ret = new core::array<const wchar_t*>;
//core::stringw construct = L"";
core::list<CXMLNode*>::Iterator it;
for( it = children.begin(); it != children.end(); it++ ) {
if((*it)->getType() == nodetype) {
ret->push_front((*it)->getName());
}
}
return ret;
}
core::array<const wchar_t*> *CXMLNode::listNonNodeChildren() {
return listChildrenByType(CXMLNODETYPE_VALUE);
}
core::array<const wchar_t*> *CXMLNode::listNodeChildren() {
return listChildrenByType(CXMLNODETYPE_NODE);
}
void CXMLNode::populateTreeView(irr::gui::IGUITreeViewNode *node) {
irr::gui::IGUITreeViewNode *myNode;
irr::core::stringw myText;
core::list<CXMLNode*>::Iterator it;
// If I'm a value, I have nothing to add, my parent will do that
if(type == CXMLNODETYPE_VALUE) return;
// So I'm a node, if im not the toplevel node, write me
if(parent != NULL) {
//myText = L"(Key) ";
myText += getName();
myNode = node->addChildBack(myText.c_str());
}
else
myNode = node;
// If I dont have children, I'm done
if(children.empty()) return;
// setup my children
for( it = children.begin(); it != children.end(); it++ ) {
switch((*it)->getType()) {
case CXMLNODETYPE_NODE :
myText = L"";
myText += (core::stringw)(*it)->getName();
(*it)->populateTreeView(myNode);
break;
case CXMLNODETYPE_VALUE :
myText = L"";
myText += (core::stringw)(*it)->getName();
myText += L":";
myText += (core::stringw)(*it)->getValue();
myNode->addChildBack(myText.c_str());
}
}
}
void CXMLNode::writeOut(io::IXMLWriter* xml) {
core::array<core::stringw> names;
core::array<core::stringw> values;
core::list<CXMLNode*>::Iterator it;
bool nodeChildren = false;
// If I'm a value, I have nothing to write, I'll be written by my parent
if(type == CXMLNODETYPE_VALUE) return;
// If I'm a node with no values, which also means no children write as empty and return
if(children.empty()) {
xml->writeElement(name.c_str(),true);
xml->writeLineBreak();
return;
}
// Need to figure out myself first
for( it = children.begin(); it != children.end(); it++ ) {
// cache all my values for writing, and set a flag if I have node children, ie non empty
switch((*it)->getType()) {
case CXMLNODETYPE_VALUE:
names.push_front((core::stringw)(*it)->getName());
values.push_front((core::stringw)(*it)->getValue());
break;
case CXMLNODETYPE_NODE:
nodeChildren = true;
}
}
// At this point I just need to write myself
xml->writeElement(name.c_str(),nodeChildren?false:true,names,values);
xml->writeLineBreak();
// Now I need to see if I have to tell my node children to write
if(!nodeChildren) return;
for( it = children.begin(); it != children.end(); it++ ) {
// If I have a node child, tell it to write, recursion made easy!
if((*it)->getType() == CXMLNODETYPE_NODE) {
(*it)->writeOut(xml);
}
}
xml->writeClosingTag(name.c_str());
xml->writeLineBreak();
}
\ No newline at end of file
// Madoc 05/09
#ifndef __C_XMLNODE_H_INCLUDED__
#define __C_XMLNODE_H_INCLUDED__
#include <irrlicht.h>
using namespace irr;
enum CXMLNODETYPE {
CXMLNODETYPE_VALUE,
CXMLNODETYPE_NODE,
//CXMLNODETYPE_COMMENT
};
class CXMLNode {
public :
/* Decided to move this up to the registry object, reduce mem use.
s32 getValueAsInt();
const wchar_t* getValueAsCStr();
bool getValueAsBool();
*/
CXMLNODETYPE getType();
const wchar_t* getName();
const wchar_t* getValue();
void setType(CXMLNODETYPE newtype);
void setName(const wchar_t* newname);
void setValue(const wchar_t* newvalue);
void addChild(CXMLNode *newchild);
void writeOut(irr::io::IXMLWriter* xml);
void populateTreeView(irr::gui::IGUITreeViewNode *node);
//u16 getChildCount();
void drop();
/*
irr::core::list<CXMLNode*>::Iterator getFirstChild();
// get last is not get end point, this causes problems with iterators
// Screw it, I'll keep all pointers internal
irr::core::list<CXMLNode*>::Iterator getLastChild();
*/
// Careful with these, mem leak waiting to happen
// Maby I should steal IReferenceCounted from irrlicht, would at
// least give me autodetection of mem leaks
core::array<const wchar_t *> *listNonNodeChildren();
core::array<const wchar_t *> *listNodeChildren();
CXMLNode *getThis();
CXMLNode *findChildByName(const wchar_t *name);
CXMLNode *getParent();
void setParent(CXMLNode *newparent);
private :
CXMLNode *parent;
irr::core::stringw value;
irr::core::stringw name;
CXMLNODETYPE type;
irr::core::list<CXMLNode*> children;
irr::core::array<const wchar_t *> *listChildrenByType(CXMLNODETYPE nodetype);
};
#endif
This diff is collapsed.
// Madoc 05/09
#ifndef __C_XMLREGISTRY_H_INCLUDED__
#define __C_XMLREGISTRY_H_INCLUDED__
#include <irrlicht.h>
using namespace irr;
#include "CXMLNode.h"
//File->
// Node1->
// Name1/Value
// Node2->
// Name2/Value
// Oddity: Very little error checking, crashes if you look at it funny
// Oddity: When using setValue ala setValue("someindex",100); compiler cant tell if 100 is a bool or an int, silly compiler,
// casting to u16 works ala setValue("someindex",(u16)100); I see why, but its still silly, and casts are slow
class CXMLRegistry {
public:
CXMLRegistry(io::IFileSystem *fsys);
~CXMLRegistry();
bool loadFile(const c8 *fname, const c8 *path);
bool loadConfigFile(const c8 *fname);
bool writeFile(const c8 *fname, const c8 *path);
bool writeConfigFile(const c8 *fname);
const wchar_t *getValueAsCStr(const wchar_t *index,const wchar_t *context = 0);
// Dosnt work, just declare a stringc and assign the wchar_t to it
//const irr::c8 *getValueAsCharCStr(const wchar_t *index,const wchar_t *context = 0);
bool getValueAsBool(const wchar_t *index, const wchar_t *context = 0);
u16 getValueAsInt(const wchar_t *index, const wchar_t *context = 0);
// This one only takes a context because its going to read 4 childrens values
irr::core::rect<u32> getValueAsRect(const wchar_t *context = 0);
// This one only takes a context because its going to read 4 childrens values
video::SColor getValueAsColor(const wchar_t *context = 0);
irr::core::array<const wchar_t*> *listNonNodeChildren(const wchar_t *node,const wchar_t *context = 0);
irr::core::array<const wchar_t*> *listNodeChildren(const wchar_t *node,const wchar_t *context = 0);
bool setValue(const wchar_t *index, bool boolval, const wchar_t *context = 0);
bool setValue(const wchar_t *index, u16 intval, const wchar_t *context = 0);
bool setValue(const wchar_t *index, const wchar_t *txtval,const wchar_t *context = 0);
// Speed improvement, why search if we want multiple values from the same context
void setContext(const wchar_t *context);
bool isTopLevelNode(const wchar_t *node);
bool populateTreeView(irr::gui::IGUITreeView *control,const wchar_t *context = 0);
// TODO: These are trivial to do, just dont need them yet
// renameNode(context(?),TYPE)
// deleteNode(context(?) (CAREFUL WITH CHILDREN)
// addNode(context, value, type)
// CXMLNODETYPE_COMMENT
// Loading/saving of CDATA, easiest would be just save it in the value of
// the CXMLNODETYPE_NODE their accosicated with.
// make registry inherit node instead of containing an instance of it.
// context(?) might be tricky with CXMLNODETYPE_VALUE
//
//
private:
io::IFileSystem* fileSystem;
CXMLNode* registry;
CXMLNode* currentContext;
const wchar_t *convertBoolToText(bool boolval);
bool convertTextToBool(const wchar_t* textval);
CXMLNode *resolveContext(const wchar_t* context);
const irr::c8 *resolveConfigPath(const irr::c8 *fname);
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef EVENT_HANDLER_H
#define EVENT_HANDLER_H
#include "config.h"
#include "game.h"
#include "client_card.h"
#endif //EVENT_HANDLER_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
project (clzma)
set (AUTO_FILES_RESULT)
AutoFiles("." "src" "\\.(cpp|c|h)$")
add_library (clzma STATIC ${AUTO_FILES_RESULT})
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment