diff --git a/README.md b/README.md index e1b8a6989..7ae2a02ee 100644 --- a/README.md +++ b/README.md @@ -88,10 +88,6 @@ framework heavily focused on the development of rich graphical user interfaces. * OpenAL audio engine with extendable file format support. Read and write support for OGG and Wav, and read support for MP3 and FLAC. -### Physics Module - -* Full OOP chipmunk physics wrapper. - ### System Module * Provides all the basics stuffs for the full multi-threading support of the library, file formats support for packing, clocks, resource manager, translator, and much more. @@ -146,7 +142,11 @@ framework heavily focused on the development of rich graphical user interfaces. * Programmable actions for nodes ( fade, rotate, move, scale, etc ). -### Maps Module +### Physics Module (optional) + +* Full OOP chipmunk physics wrapper. + +### Maps Module (optional) * Tiled Maps with software dynamic lights. diff --git a/bin/assets/colorschemes/terminalcolorschemes.conf b/bin/assets/colorschemes/terminalcolorschemes.conf index 5751012c3..c805fdacc 100644 --- a/bin/assets/colorschemes/terminalcolorschemes.conf +++ b/bin/assets/colorschemes/terminalcolorschemes.conf @@ -207,3 +207,9 @@ foreground=#e8e6ed background=#292a44 cursor=#b89bf9 palette=#12131e;#dd7755;#04dbb5;#f2e7b7;#7aa5ff;#bf9cf9;#56d3c2;#e4e3e9;#666699;#ff92cd;#01eac0;#fffca8;#69c0fa;#c17ff8;#8bfde1;#f4f2f9 + +[Rosé Pine] +foreground=#e0def4 +background=#191724 +cursor=#abb2bf +palette=#26233a;#eb6f92;#9ccfd8;#f6c177;#31748f;#c4a7e7;#ebbcba;#e0def4;#6e6a86;#eb6f92;#9ccfd8;#f6c177;#31748f;#c4a7e7;#ebbcba;#e0def4 diff --git a/include/eepp/ee.hpp b/include/eepp/ee.hpp index 5343ea11f..d7c684fb1 100644 --- a/include/eepp/ee.hpp +++ b/include/eepp/ee.hpp @@ -48,7 +48,4 @@ using namespace EE::Scene; using namespace EE::UI; using namespace EE::UI::Tools; -// Physics -#include -using namespace EE::Physics; #endif diff --git a/include/eepp/ui/uiwindow.hpp b/include/eepp/ui/uiwindow.hpp index 8d14c2b8c..35b321b3d 100644 --- a/include/eepp/ui/uiwindow.hpp +++ b/include/eepp/ui/uiwindow.hpp @@ -223,6 +223,7 @@ class EE_API UIWindow : public UIWidget { Vector2f mResizePos; bool mFrameBufferBound; + bool mWindowReady{ false }; bool mShowWhenReady{ false }; KeyBindings mKeyBindings; diff --git a/include/eepp/version.hpp b/include/eepp/version.hpp index b54db7111..03624d791 100644 --- a/include/eepp/version.hpp +++ b/include/eepp/version.hpp @@ -6,7 +6,7 @@ #define EEPP_MAJOR_VERSION 2 #define EEPP_MINOR_VERSION 5 -#define EEPP_PATCH_LEVEL 2 +#define EEPP_PATCH_LEVEL 3 #define EEPP_CODENAME "Bindu" /** The compiled version of the library */ diff --git a/premake4.lua b/premake4.lua index 4335dd82d..1dcd715c1 100644 --- a/premake4.lua +++ b/premake4.lua @@ -644,7 +644,6 @@ function add_static_links() end links { "SOIL2-static", - "chipmunk-static", "libzip-static", "jpeg-compressor-static", "zlib-static", @@ -818,7 +817,13 @@ end function eepp_module_maps_add() links { "eepp-maps-static" } defines { "EE_MAPS_STATIC" } - includedirs { "src/modules/maps/include/","src/modules/maps/src/" } + includedirs { "src/modules/maps/include/", "src/modules/maps/src/" } +end + +function eepp_module_physics_add() + links { "eepp-physics-static", "chipmunk-static" } + defines { "EE_PHYSICS_STATIC" } + includedirs { "src/modules/physics/include/", "src/modules/physics/src/" } end function build_eepp( build_name ) @@ -870,9 +875,7 @@ function build_eepp( build_name ) "src/eepp/ui/models/*.cpp", "src/eepp/ui/css/*.cpp", "src/eepp/ui/doc/*.cpp", - "src/eepp/ui/tools/*.cpp", - "src/eepp/physics/*.cpp", - "src/eepp/physics/constraints/*.cpp" + "src/eepp/ui/tools/*.cpp" } check_ssl_support() @@ -1010,7 +1013,7 @@ solution "eepp" set_targetdir("libs/" .. os.get_real() .. "/thirdparty/") files { "src/thirdparty/chipmunk/*.c", "src/thirdparty/chipmunk/constraints/*.c" } - includedirs { "include/eepp/thirdparty/chipmunk" } + includedirs { "src/modules/physics/include/eepp/thirdparty/chipmunk" } build_base_configuration( "chipmunk" ) project "jpeg-compressor-static" @@ -1099,7 +1102,7 @@ solution "eepp" kind "StaticLib" language "C++" set_targetdir("libs/" .. os.get_real() .. "/") - includedirs { "include", "src/modules/maps/include/","src/modules/maps/src/" } + includedirs { "include", "src/modules/maps/include/", "src/modules/maps/src/" } files { "src/modules/maps/src/**.cpp" } defines { "EE_MAPS_STATIC" } if not is_vs() then @@ -1113,7 +1116,7 @@ solution "eepp" kind "SharedLib" language "C++" set_targetdir("libs/" .. os.get_real() .. "/") - includedirs { "include", "src/modules/maps/include/","src/modules/maps/src/" } + includedirs { "include", "src/modules/maps/include/", "src/modules/maps/src/" } files { "src/modules/maps/src/**.cpp" } links { "eepp-shared" } defines { "EE_MAPS_EXPORTS" } @@ -1124,6 +1127,35 @@ solution "eepp" end build_base_cpp_configuration( "eepp-maps" ) + project "eepp-physics-static" + kind "StaticLib" + language "C++" + set_targetdir("libs/" .. os.get_real() .. "/") + includedirs { "include", "src/modules/physics/include/","src/modules/physics/src/" } + files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" } + defines { "EE_PHYSICS_STATIC" } + if not is_vs() then + buildoptions{ "-std=c++17" } + else + buildoptions{ "/std:c++17" } + end + build_base_cpp_configuration( "eepp-physics-static" ) + + project "eepp-physics" + kind "SharedLib" + language "C++" + set_targetdir("libs/" .. os.get_real() .. "/") + includedirs { "include", "src/modules/physics/include/","src/modules/physics/src/" } + files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" } + links { "chipmunk-static", "eepp-shared" } + defines { "EE_PHYSICS_EXPORTS" } + if not is_vs() then + buildoptions{ "-std=c++17" } + else + buildoptions{ "/std:c++17" } + end + build_base_cpp_configuration( "eepp-physics" ) + project "eterm-static" kind "StaticLib" language "C++" @@ -1187,11 +1219,12 @@ solution "eepp" files { "src/examples/vbo_fbo_batch/*.cpp" } build_link_configuration( "eepp-vbo-fbo-batch", true ) - project "eepp-physics" + project "eepp-physics-demo" set_kind() language "C++" files { "src/examples/physics/*.cpp" } - build_link_configuration( "eepp-physics", true ) + eepp_module_physics_add() + build_link_configuration( "eepp-physics-demo", true ) project "eepp-http-request" kind "ConsoleApp" @@ -1320,6 +1353,7 @@ solution "eepp" language "C++" files { "src/tests/test_all/*.cpp" } eepp_module_maps_add() + eepp_module_physics_add() build_link_configuration( "eepp-test", true ) project "eepp-ui-perf-test" diff --git a/premake5.lua b/premake5.lua index 454474c9f..a0b7a987e 100644 --- a/premake5.lua +++ b/premake5.lua @@ -548,7 +548,13 @@ end function eepp_module_maps_add() links { "eepp-maps-static" } defines { "EE_MAPS_STATIC" } - incdirs { "src/modules/maps/include/","src/modules/maps/src/" } + incdirs { "src/modules/maps/include/", "src/modules/maps/src/" } +end + +function eepp_module_physics_add() + links { "eepp-physics-static", "chipmunk-static" } + defines { "EE_PHYSICS_STATIC" } + incdirs { "src/modules/physics/include/", "src/modules/physics/src/" } end function build_eepp( build_name ) @@ -754,7 +760,7 @@ workspace "eepp" kind "StaticLib" targetdir("libs/" .. os.target() .. "/thirdparty/") files { "src/thirdparty/chipmunk/*.c", "src/thirdparty/chipmunk/constraints/*.c" } - incdirs { "include/eepp/thirdparty/chipmunk" } + incdirs { "src/modules/physics/include/eepp/thirdparty/chipmunk" } build_base_configuration( "chipmunk" ) filter "action:vs*" language "C++" @@ -862,6 +868,31 @@ workspace "eepp" filter "action:not vs*" buildoptions { "-Wall" } + project "eepp-physics-static" + kind "StaticLib" + language "C++" + cppdialect "C++17" + targetdir("libs/" .. os.target() .. "/") + incdirs { "include", "src/modules/physics/include/","src/modules/physics/src/" } + files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" } + defines { "EE_PHYSICS_STATIC" } + build_base_cpp_configuration( "eepp-physics-static" ) + filter "action:not vs*" + buildoptions { "-Wall" } + + project "eepp-physics" + kind "SharedLib" + language "C++" + cppdialect "C++17" + targetdir("libs/" .. os.target() .. "/") + incdirs { "include", "src/modules/physics/include/","src/modules/physics/src/" } + files { "src/modules/physics/src/**.cpp", "src/eepp/physics/constraints/*.cpp" } + links { "chipmunk-static", "eepp-shared" } + defines { "EE_PHYSICS_EXPORTS" } + build_base_cpp_configuration( "eepp-physics" ) + filter "action:not vs*" + buildoptions { "-Wall" } + project "eterm-static" kind "StaticLib" language "C++" @@ -869,6 +900,7 @@ workspace "eepp" targetdir("libs/" .. os.target() .. "/") incdirs { "include", "src/modules/eterm/include/","src/modules/eterm/src/" } files { "src/modules/eterm/src/**.cpp" } + links { "chipmunk-static" } build_base_cpp_configuration( "eterm" ) filter "action:not vs*" buildoptions { "-Wall" } @@ -923,11 +955,12 @@ workspace "eepp" files { "src/examples/vbo_fbo_batch/*.cpp" } build_link_configuration( "eepp-vbo-fbo-batch", true ) - project "eepp-physics" + project "eepp-physics-demo" set_kind() language "C++" files { "src/examples/physics/*.cpp" } - build_link_configuration( "eepp-physics", true ) + eepp_module_physics_add() + build_link_configuration( "eepp-physics-demo", true ) project "eepp-http-request" kind "ConsoleApp" @@ -1038,6 +1071,7 @@ workspace "eepp" language "C++" files { "src/tests/test_all/*.cpp" } eepp_module_maps_add() + eepp_module_physics_add() build_link_configuration( "eepp-test", true ) project "eepp-ui-perf-test" diff --git a/projects/android-project/app/build.gradle b/projects/android-project/app/build.gradle index 3c5b0a50c..c09fe8075 100644 --- a/projects/android-project/app/build.gradle +++ b/projects/android-project/app/build.gradle @@ -13,12 +13,12 @@ def getProcessesCountArg() { } android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" + compileSdkVersion 33 + buildToolsVersion "33.0.0" defaultConfig { applicationId "com.ensoft.eepp" - minSdkVersion 14 - targetSdkVersion 30 + minSdk 27 + targetSdkVersion 33 versionCode 1 versionName "1.0" ndk { @@ -75,7 +75,7 @@ android { externalNativeBuild { ndkBuild { arguments "APP_CFLAGS=-g -DDEBUG -DEE_DEBUG" - arguments "APP_CPPFLAGS=-std=c++14 -frtti -fexceptions" + arguments "APP_CPPFLAGS=-std=c++17 -frtti -fexceptions" arguments "APP_OPTIM=debug" } } @@ -84,7 +84,7 @@ android { externalNativeBuild { ndkBuild { arguments "APP_CFLAGS=-fno-strict-aliasing -O3 -s -DNDEBUG -ffast-math" - arguments "APP_CPPFLAGS=-std=c++14 -frtti -fexceptions" + arguments "APP_CPPFLAGS=-std=c++17 -frtti -fexceptions" } } minifyEnabled false @@ -102,6 +102,11 @@ android { lintOptions { abortOnError false } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + ndkVersion '25.1.8937393' } dependencies { diff --git a/projects/android-project/app/jni/Android.mk b/projects/android-project/app/jni/Android.mk index a8961f374..e62d070cd 100644 --- a/projects/android-project/app/jni/Android.mk +++ b/projects/android-project/app/jni/Android.mk @@ -60,6 +60,7 @@ LOCAL_CFLAGS := $(EEPP_C_FLAGS) LOCAL_C_INCLUDES := $(EEPP_C_INCLUDES) CORE_SRCS := tools/ecode/*.cpp \ + tools/ecode/plugins/*.cpp \ tools/ecode/plugins/autocomplete/*.cpp \ tools/ecode/plugins/linter/*.cpp \ tools/ecode/plugins/formatter/*.cpp \ @@ -111,7 +112,7 @@ CORE_SRCS := tests/test_all/*.cpp LOCAL_SRC_FILES := $(SDL_MAIN_PATH) $(foreach F, $(CORE_SRCS), $(addprefix $(dir $(F)),$(notdir $(wildcard $(LOCAL_PATH)/$(F))))) -LOCAL_STATIC_LIBRARIES := eepp-maps eepp +LOCAL_STATIC_LIBRARIES := eepp-physics eepp-maps eepp include $(BUILD_SHARED_LIBRARY) #************ full_test ************ diff --git a/projects/android-project/app/jni/eepp.mk b/projects/android-project/app/jni/eepp.mk index e9f5994e0..a9507a8d1 100644 --- a/projects/android-project/app/jni/eepp.mk +++ b/projects/android-project/app/jni/eepp.mk @@ -26,7 +26,10 @@ EEPP_C_INCLUDES := \ $(EEPP_BASE_PATH)/modules/eterm/include \ $(EEPP_BASE_PATH)/modules/eterm/src \ $(EEPP_BASE_PATH)/modules/maps/include \ - $(EEPP_BASE_PATH)/modules/maps/src + $(EEPP_BASE_PATH)/modules/maps/src \ + $(EEPP_BASE_PATH)/modules/physics/include \ + $(EEPP_BASE_PATH)/modules/physics/src \ + $(EEPP_BASE_PATH)/modules/physics/include/eepp/thirdparty/chipmunk/ EEPP_C_FLAGS := \ -Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit \ @@ -82,8 +85,6 @@ CODE_SRCS := \ window/backend/SDL2/*.cpp \ graphics/*.cpp \ graphics/renderer/*.cpp \ - physics/*.cpp \ - physics/constraints/*.cpp \ scene/*.cpp \ scene/actions/*.cpp \ ui/*.cpp \ @@ -97,7 +98,7 @@ LOCAL_C_INCLUDES := $(EEPP_C_INCLUDES) LOCAL_SRC_FILES := $(foreach F, $(CODE_SRCS), $(addprefix $(dir $(F)),$(notdir $(wildcard $(LOCAL_PATH)/$(F))))) -LOCAL_STATIC_LIBRARIES := chipmunk freetype libpng +LOCAL_STATIC_LIBRARIES := freetype libpng LOCAL_SHARED_LIBRARIES := SDL2 @@ -298,8 +299,8 @@ LOCAL_PATH := $(EEPP_MODULES_PATH) LOCAL_MODULE := eepp-maps LIBMAPS_SRCS := \ - maps/src/maps/*.cpp \ - maps/src/maps/mapeditor/*.cpp + maps/src/eepp/maps/*.cpp \ + maps/src/eepp/maps/mapeditor/*.cpp LOCAL_C_INCLUDES := $(EEPP_C_INCLUDES) $(EEPP_INC_PATH) LOCAL_CFLAGS := -Os @@ -309,6 +310,26 @@ LOCAL_SRC_FILES := $(foreach F, $(LIBMAPS_SRCS), $(addprefix $(dir $(F)),$(not include $(BUILD_STATIC_LIBRARY) #*************** MAPS *************** +#*************** PHYSICS *************** +include $(CLEAR_VARS) + +LOCAL_PATH := $(EEPP_MODULES_PATH) + +LOCAL_MODULE := eepp-physics + +LIBMAPS_SRCS := \ + physics/src/eepp/physics/*.cpp \ + physics/src/eepp/physics/constraints/*.cpp + +LOCAL_C_INCLUDES := $(EEPP_C_INCLUDES) $(EEPP_INC_PATH) +LOCAL_CFLAGS := -Os +LOCAL_STATIC_LIBRARIES := chipmunk + +LOCAL_SRC_FILES := $(foreach F, $(LIBMAPS_SRCS), $(addprefix $(dir $(F)),$(notdir $(wildcard $(LOCAL_PATH)/$(F))))) + +include $(BUILD_STATIC_LIBRARY) +#*************** PHYSICS *************** + #*************** ETERM *************** include $(CLEAR_VARS) diff --git a/projects/android-project/app/src/main/AndroidManifest.xml b/projects/android-project/app/src/main/AndroidManifest.xml index 775c6cc6b..148541719 100644 --- a/projects/android-project/app/src/main/AndroidManifest.xml +++ b/projects/android-project/app/src/main/AndroidManifest.xml @@ -10,8 +10,8 @@ android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="true" > + android:screenOrientation="landscape" + android:exported="true"> diff --git a/projects/android-project/build.gradle b/projects/android-project/build.gradle index b91458701..d0b4a62a0 100644 --- a/projects/android-project/build.gradle +++ b/projects/android-project/build.gradle @@ -2,18 +2,18 @@ buildscript { repositories { - jcenter() + mavenCentral() google() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:7.4.0' } } allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/projects/android-project/gradle/wrapper/gradle-wrapper.jar b/projects/android-project/gradle/wrapper/gradle-wrapper.jar index 8c0fb64a8..249e5832f 100644 Binary files a/projects/android-project/gradle/wrapper/gradle-wrapper.jar and b/projects/android-project/gradle/wrapper/gradle-wrapper.jar differ diff --git a/projects/android-project/gradle/wrapper/gradle-wrapper.properties b/projects/android-project/gradle/wrapper/gradle-wrapper.properties index 857ac358b..070cb702f 100644 --- a/projects/android-project/gradle/wrapper/gradle-wrapper.properties +++ b/projects/android-project/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Thu Mar 10 11:21:14 ART 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/projects/android-project/gradlew b/projects/android-project/gradlew index 9d82f7891..a69d9cb6c 100755 --- a/projects/android-project/gradlew +++ b/projects/android-project/gradlew @@ -1,74 +1,129 @@ -#!/usr/bin/env bash +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -77,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -85,76 +140,101 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/projects/android-project/gradlew.bat b/projects/android-project/gradlew.bat index aec99730b..53a6b238d 100644 --- a/projects/android-project/gradlew.bat +++ b/projects/android-project/gradlew.bat @@ -1,4 +1,20 @@ -@if "%DEBUG%" == "" @echo off +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -8,20 +24,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,44 +64,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index 381bf36e3..7d97d83d6 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -981,7 +981,7 @@ 2 - %{buildDir}../../../bin/eepp-physics-debug + %{buildDir}../../../bin/eepp-physics-demo-debug eepp-physics-debug ProjectExplorer.CustomExecutableRunConfiguration diff --git a/projects/linux/ee.includes b/projects/linux/ee.includes index abbae5bff..5d2a4794e 100644 --- a/projects/linux/ee.includes +++ b/projects/linux/ee.includes @@ -12,3 +12,5 @@ ../../src/modules/eterm/include/ ../../src/modules/maps/include/ ../../src/modules/maps/src/ +../../src/modules/physics/include/ +../../src/modules/physics/src/ diff --git a/src/eepp/ui/uiwindow.cpp b/src/eepp/ui/uiwindow.cpp index c77a78260..f9e6ccb9c 100644 --- a/src/eepp/ui/uiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -441,6 +441,8 @@ void UIWindow::forcedApplyStyle() { } void UIWindow::onWindowReady() { + mWindowReady = true; + forcedApplyStyle(); if ( mShowWhenReady ) { @@ -1120,8 +1122,12 @@ bool UIWindow::hide() { } void UIWindow::showWhenReady() { - hide(); - mShowWhenReady = true; + if ( mWindowReady ) { + show(); + } else { + hide(); + mShowWhenReady = true; + } } void UIWindow::onAlphaChange() { diff --git a/src/eepp/window/engine.cpp b/src/eepp/window/engine.cpp index 2c7c32bb7..a2be5d79c 100644 --- a/src/eepp/window/engine.cpp +++ b/src/eepp/window/engine.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -61,8 +60,6 @@ Engine::Engine() : } Engine::~Engine() { - Physics::PhysicsManager::destroySingleton(); - GlobalBatchRenderer::destroySingleton(); TextureAtlasManager::destroySingleton(); diff --git a/src/examples/physics/physics.cpp b/src/examples/physics/physics.cpp index 296bb263b..afe473842 100644 --- a/src/examples/physics/physics.cpp +++ b/src/examples/physics/physics.cpp @@ -1,4 +1,6 @@ #include +#include +using namespace EE::Physics; /** The physics module is a OOP wrapper for Chipmunk Physics. @@ -665,6 +667,8 @@ EE_MAIN_FUNC int main( int, char*[] ) { physicsDestroy(); } + PhysicsManager::destroySingleton(); + Engine::destroySingleton(); MemoryManager::showResults(); diff --git a/src/modules/maps/include/eepp/maps/base.hpp b/src/modules/maps/include/eepp/maps/base.hpp index 801be7e48..c8df1fe20 100644 --- a/src/modules/maps/include/eepp/maps/base.hpp +++ b/src/modules/maps/include/eepp/maps/base.hpp @@ -29,7 +29,7 @@ using namespace EE::System; #define EE_MAPS_API __declspec( dllimport ) #endif #else -#if ( __GNUC__ >= 4 ) +#if ( __GNUC__ >= 4 ) && !defined( EE_MAPS_API ) #define EE_MAPS_API __attribute__( ( visibility( "default" ) ) ) #endif #endif diff --git a/include/eepp/physics/arbiter.hpp b/src/modules/physics/include/eepp/physics/arbiter.hpp similarity index 97% rename from include/eepp/physics/arbiter.hpp rename to src/modules/physics/include/eepp/physics/arbiter.hpp index 9b9f99501..5df92bc5f 100644 --- a/include/eepp/physics/arbiter.hpp +++ b/src/modules/physics/include/eepp/physics/arbiter.hpp @@ -7,7 +7,7 @@ namespace EE { namespace Physics { -class EE_API Arbiter { +class EE_PHYSICS_API Arbiter { public: Arbiter( cpArbiter* arbiter ); diff --git a/include/eepp/physics/area.hpp b/src/modules/physics/include/eepp/physics/area.hpp similarity index 92% rename from include/eepp/physics/area.hpp rename to src/modules/physics/include/eepp/physics/area.hpp index b799bdda9..1a2391019 100644 --- a/include/eepp/physics/area.hpp +++ b/src/modules/physics/include/eepp/physics/area.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API Area { +class EE_PHYSICS_API Area { public: cpFloat forCircle( cpFloat r1, cpFloat r2 ); diff --git a/include/eepp/physics/base.hpp b/src/modules/physics/include/eepp/physics/base.hpp similarity index 56% rename from include/eepp/physics/base.hpp rename to src/modules/physics/include/eepp/physics/base.hpp index 70ec7e5f2..6ed29930b 100644 --- a/include/eepp/physics/base.hpp +++ b/src/modules/physics/include/eepp/physics/base.hpp @@ -21,4 +21,25 @@ using namespace EE::System; //! Some helpers for the wrapper ( most of them can be disabled in the settings ) #include +#ifndef EE_PHYSICS_STATIC +#if EE_PLATFORM == EE_PLATFORM_WIN +// Windows platforms +#ifdef EE_PHYSICS_EXPORTS +// From DLL side, we must export +#define EE_PHYSICS_API __declspec( dllexport ) +#else +// From client application side, we must import +#define EE_PHYSICS_API __declspec( dllimport ) +#endif +#else +#if ( __GNUC__ >= 4 ) && !defined( EE_PHYSICS_API ) +#define EE_PHYSICS_API __attribute__( ( visibility( "default" ) ) ) +#endif +#endif +#endif + +#endif + +#ifndef EE_PHYSICS_API +#define EE_PHYSICS_API #endif diff --git a/include/eepp/physics/body.hpp b/src/modules/physics/include/eepp/physics/body.hpp similarity index 99% rename from include/eepp/physics/body.hpp rename to src/modules/physics/include/eepp/physics/body.hpp index c68ed2cf0..50eb0951f 100644 --- a/include/eepp/physics/body.hpp +++ b/src/modules/physics/include/eepp/physics/body.hpp @@ -9,7 +9,7 @@ class Shape; class Constraint; class Arbiter; -class EE_API Body { +class EE_PHYSICS_API Body { public: typedef std::function ShapeIteratorFunc; typedef std::function ConstraintIteratorFunc; diff --git a/include/eepp/physics/constraints/constraint.hpp b/src/modules/physics/include/eepp/physics/constraints/constraint.hpp similarity index 95% rename from include/eepp/physics/constraints/constraint.hpp rename to src/modules/physics/include/eepp/physics/constraints/constraint.hpp index 9f5fd0854..fa4a19677 100644 --- a/include/eepp/physics/constraints/constraint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/constraint.hpp @@ -6,7 +6,7 @@ namespace EE { namespace Physics { -class EE_API Constraint { +class EE_PHYSICS_API Constraint { public: static void Free( Constraint* constraint ); diff --git a/include/eepp/physics/constraints/dampedrotaryspring.hpp b/src/modules/physics/include/eepp/physics/constraints/dampedrotaryspring.hpp similarity index 90% rename from include/eepp/physics/constraints/dampedrotaryspring.hpp rename to src/modules/physics/include/eepp/physics/constraints/dampedrotaryspring.hpp index 435fc9ff9..53ef38721 100644 --- a/include/eepp/physics/constraints/dampedrotaryspring.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/dampedrotaryspring.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API DampedRotarySpring : public Constraint { +class EE_PHYSICS_API DampedRotarySpring : public Constraint { public: DampedRotarySpring( Body* a, Body* b, cpFloat restAngle, cpFloat stiffness, cpFloat damping ); diff --git a/include/eepp/physics/constraints/dampedspring.hpp b/src/modules/physics/include/eepp/physics/constraints/dampedspring.hpp similarity index 93% rename from include/eepp/physics/constraints/dampedspring.hpp rename to src/modules/physics/include/eepp/physics/constraints/dampedspring.hpp index e3912ef68..ae330fe37 100644 --- a/include/eepp/physics/constraints/dampedspring.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/dampedspring.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API DampedSpring : public Constraint { +class EE_PHYSICS_API DampedSpring : public Constraint { public: DampedSpring( Body* a, Body* b, cVect anchr1, cVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping ); diff --git a/include/eepp/physics/constraints/gearjoint.hpp b/src/modules/physics/include/eepp/physics/constraints/gearjoint.hpp similarity index 88% rename from include/eepp/physics/constraints/gearjoint.hpp rename to src/modules/physics/include/eepp/physics/constraints/gearjoint.hpp index 65224d44b..891f7b638 100644 --- a/include/eepp/physics/constraints/gearjoint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/gearjoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API GearJoint : public Constraint { +class EE_PHYSICS_API GearJoint : public Constraint { public: GearJoint( Body* a, Body* b, cpFloat phase, cpFloat ratio ); diff --git a/include/eepp/physics/constraints/groovejoint.hpp b/src/modules/physics/include/eepp/physics/constraints/groovejoint.hpp similarity index 92% rename from include/eepp/physics/constraints/groovejoint.hpp rename to src/modules/physics/include/eepp/physics/constraints/groovejoint.hpp index b95539508..d5e5fea47 100644 --- a/include/eepp/physics/constraints/groovejoint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/groovejoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API GrooveJoint : public Constraint { +class EE_PHYSICS_API GrooveJoint : public Constraint { public: GrooveJoint( Body* a, Body* b, cVect groove_a, cVect groove_b, cVect anchr2 ); diff --git a/include/eepp/physics/constraints/pinjoint.hpp b/src/modules/physics/include/eepp/physics/constraints/pinjoint.hpp similarity index 92% rename from include/eepp/physics/constraints/pinjoint.hpp rename to src/modules/physics/include/eepp/physics/constraints/pinjoint.hpp index d748b90c4..6b4e7d995 100644 --- a/include/eepp/physics/constraints/pinjoint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/pinjoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API PinJoint : public Constraint { +class EE_PHYSICS_API PinJoint : public Constraint { public: PinJoint( Body* a, Body* b, cVect anchr1, cVect anchr2 ); diff --git a/include/eepp/physics/constraints/pivotjoint.hpp b/src/modules/physics/include/eepp/physics/constraints/pivotjoint.hpp similarity index 92% rename from include/eepp/physics/constraints/pivotjoint.hpp rename to src/modules/physics/include/eepp/physics/constraints/pivotjoint.hpp index 8cdcb64ca..3e02b6323 100644 --- a/include/eepp/physics/constraints/pivotjoint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/pivotjoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API PivotJoint : public Constraint { +class EE_PHYSICS_API PivotJoint : public Constraint { public: PivotJoint( Body* a, Body* b, cVect pivot ); diff --git a/include/eepp/physics/constraints/ratchetjoint.hpp b/src/modules/physics/include/eepp/physics/constraints/ratchetjoint.hpp similarity index 89% rename from include/eepp/physics/constraints/ratchetjoint.hpp rename to src/modules/physics/include/eepp/physics/constraints/ratchetjoint.hpp index 7ef0db4bf..becfe6579 100644 --- a/include/eepp/physics/constraints/ratchetjoint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/ratchetjoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API RatchetJoint : public Constraint { +class EE_PHYSICS_API RatchetJoint : public Constraint { public: RatchetJoint( Body* a, Body* b, cpFloat phase, cpFloat ratchet ); diff --git a/include/eepp/physics/constraints/rotarylimitjoint.hpp b/src/modules/physics/include/eepp/physics/constraints/rotarylimitjoint.hpp similarity index 87% rename from include/eepp/physics/constraints/rotarylimitjoint.hpp rename to src/modules/physics/include/eepp/physics/constraints/rotarylimitjoint.hpp index e00dce7a4..06fc7b7d4 100644 --- a/include/eepp/physics/constraints/rotarylimitjoint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/rotarylimitjoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API RotaryLimitJoint : public Constraint { +class EE_PHYSICS_API RotaryLimitJoint : public Constraint { public: RotaryLimitJoint( Body* a, Body* b, cpFloat min, cpFloat max ); diff --git a/include/eepp/physics/constraints/simplemotor.hpp b/src/modules/physics/include/eepp/physics/constraints/simplemotor.hpp similarity index 86% rename from include/eepp/physics/constraints/simplemotor.hpp rename to src/modules/physics/include/eepp/physics/constraints/simplemotor.hpp index 4a5d8a478..df5b8b837 100644 --- a/include/eepp/physics/constraints/simplemotor.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/simplemotor.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API SimpleMotor : public Constraint { +class EE_PHYSICS_API SimpleMotor : public Constraint { public: SimpleMotor( Body* a, Body* b, cpFloat rate ); diff --git a/include/eepp/physics/constraints/slidejoint.hpp b/src/modules/physics/include/eepp/physics/constraints/slidejoint.hpp similarity index 93% rename from include/eepp/physics/constraints/slidejoint.hpp rename to src/modules/physics/include/eepp/physics/constraints/slidejoint.hpp index 345341d68..444beb099 100644 --- a/include/eepp/physics/constraints/slidejoint.hpp +++ b/src/modules/physics/include/eepp/physics/constraints/slidejoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API SlideJoint : public Constraint { +class EE_PHYSICS_API SlideJoint : public Constraint { public: SlideJoint( Body* a, Body* b, cVect anchr1, cVect anchr2, cpFloat min, cpFloat max ); diff --git a/include/eepp/physics/moment.hpp b/src/modules/physics/include/eepp/physics/moment.hpp similarity index 94% rename from include/eepp/physics/moment.hpp rename to src/modules/physics/include/eepp/physics/moment.hpp index 0b36c0945..4f4a2dabb 100644 --- a/include/eepp/physics/moment.hpp +++ b/src/modules/physics/include/eepp/physics/moment.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API Moment { +class EE_PHYSICS_API Moment { public: static cpFloat forCircle( cpFloat m, cpFloat r1, cpFloat r2, cVect offset ); diff --git a/include/eepp/physics.hpp b/src/modules/physics/include/eepp/physics/physics.hpp similarity index 97% rename from include/eepp/physics.hpp rename to src/modules/physics/include/eepp/physics/physics.hpp index aaac013c4..8a8a2fe85 100644 --- a/include/eepp/physics.hpp +++ b/src/modules/physics/include/eepp/physics/physics.hpp @@ -24,5 +24,6 @@ #include #include #include +using namespace EE::Physics; #endif diff --git a/include/eepp/physics/physicshelper.hpp b/src/modules/physics/include/eepp/physics/physicshelper.hpp similarity index 100% rename from include/eepp/physics/physicshelper.hpp rename to src/modules/physics/include/eepp/physics/physicshelper.hpp diff --git a/include/eepp/physics/physicsmanager.hpp b/src/modules/physics/include/eepp/physics/physicsmanager.hpp similarity index 98% rename from include/eepp/physics/physicsmanager.hpp rename to src/modules/physics/include/eepp/physics/physicsmanager.hpp index 45121e6d7..0f1e8d9cc 100644 --- a/include/eepp/physics/physicsmanager.hpp +++ b/src/modules/physics/include/eepp/physics/physicsmanager.hpp @@ -11,7 +11,7 @@ class Shape; class Constraint; class Space; -class EE_API PhysicsManager { +class EE_PHYSICS_API PhysicsManager { SINGLETON_DECLARE_HEADERS( PhysicsManager ) public: diff --git a/include/eepp/physics/settings.hpp b/src/modules/physics/include/eepp/physics/settings.hpp similarity index 100% rename from include/eepp/physics/settings.hpp rename to src/modules/physics/include/eepp/physics/settings.hpp diff --git a/include/eepp/physics/shape.hpp b/src/modules/physics/include/eepp/physics/shape.hpp similarity index 98% rename from include/eepp/physics/shape.hpp rename to src/modules/physics/include/eepp/physics/shape.hpp index 618790e26..6d7281c9a 100644 --- a/include/eepp/physics/shape.hpp +++ b/src/modules/physics/include/eepp/physics/shape.hpp @@ -11,7 +11,7 @@ class ShapeSegment; class ShapePoly; class Space; -class EE_API Shape { +class EE_PHYSICS_API Shape { public: static void resetShapeIdCounter(); diff --git a/include/eepp/physics/shapecircle.hpp b/src/modules/physics/include/eepp/physics/shapecircle.hpp similarity index 91% rename from include/eepp/physics/shapecircle.hpp rename to src/modules/physics/include/eepp/physics/shapecircle.hpp index 1019ee9f8..f4575170f 100644 --- a/include/eepp/physics/shapecircle.hpp +++ b/src/modules/physics/include/eepp/physics/shapecircle.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API ShapeCircle : public Shape { +class EE_PHYSICS_API ShapeCircle : public Shape { public: static ShapeCircle* New( Physics::Body* body, cpFloat radius, cVect offset ); diff --git a/include/eepp/physics/shapecirclesprite.hpp b/src/modules/physics/include/eepp/physics/shapecirclesprite.hpp similarity index 85% rename from include/eepp/physics/shapecirclesprite.hpp rename to src/modules/physics/include/eepp/physics/shapecirclesprite.hpp index bdfe0cecd..fd47accce 100644 --- a/include/eepp/physics/shapecirclesprite.hpp +++ b/src/modules/physics/include/eepp/physics/shapecirclesprite.hpp @@ -1,5 +1,5 @@ -#ifndef CSHAPECIRCLESPRITE_HPP -#define CSHAPECIRCLESPRITE_HPP +#ifndef EE_PHYSICS_SHAPECIRCLESPRITE_HPP +#define EE_PHYSICS_SHAPECIRCLESPRITE_HPP #include @@ -12,7 +12,7 @@ using namespace EE::Graphics; namespace EE { namespace Physics { -class EE_API ShapeCircleSprite : public ShapeCircle { +class EE_PHYSICS_API ShapeCircleSprite : public ShapeCircle { public: static ShapeCircleSprite* New( Physics::Body* body, cpFloat radius, cVect offset, Sprite* Sprite, bool AutoDeleteSprite = false ); diff --git a/include/eepp/physics/shapepoint.hpp b/src/modules/physics/include/eepp/physics/shapepoint.hpp similarity index 93% rename from include/eepp/physics/shapepoint.hpp rename to src/modules/physics/include/eepp/physics/shapepoint.hpp index e89eefc74..57d155d0b 100644 --- a/include/eepp/physics/shapepoint.hpp +++ b/src/modules/physics/include/eepp/physics/shapepoint.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API ShapePoint : public Shape { +class EE_PHYSICS_API ShapePoint : public Shape { public: static ShapePoint* New( Physics::Body* body, cpFloat radius, cVect offset ); diff --git a/include/eepp/physics/shapepoly.hpp b/src/modules/physics/include/eepp/physics/shapepoly.hpp similarity index 94% rename from include/eepp/physics/shapepoly.hpp rename to src/modules/physics/include/eepp/physics/shapepoly.hpp index a8420be09..c8a1615ce 100644 --- a/include/eepp/physics/shapepoly.hpp +++ b/src/modules/physics/include/eepp/physics/shapepoly.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API ShapePoly : public Shape { +class EE_PHYSICS_API ShapePoly : public Shape { public: static ShapePoly* New( Physics::Body* body, int numVerts, cVect* verts, cVect offset ); diff --git a/include/eepp/physics/shapepolysprite.hpp b/src/modules/physics/include/eepp/physics/shapepolysprite.hpp similarity index 95% rename from include/eepp/physics/shapepolysprite.hpp rename to src/modules/physics/include/eepp/physics/shapepolysprite.hpp index 24639751c..193ecf3f4 100644 --- a/include/eepp/physics/shapepolysprite.hpp +++ b/src/modules/physics/include/eepp/physics/shapepolysprite.hpp @@ -12,7 +12,7 @@ using namespace EE::Graphics; namespace EE { namespace Physics { -class EE_API ShapePolySprite : public ShapePoly { +class EE_PHYSICS_API ShapePolySprite : public ShapePoly { public: static ShapePolySprite* New( Physics::Body* body, int numVerts, cVect* verts, cVect offset, Sprite* Sprite, bool AutoDeleteSprite = false ); diff --git a/include/eepp/physics/shapesegment.hpp b/src/modules/physics/include/eepp/physics/shapesegment.hpp similarity index 94% rename from include/eepp/physics/shapesegment.hpp rename to src/modules/physics/include/eepp/physics/shapesegment.hpp index 8c8eb6824..df3b5d820 100644 --- a/include/eepp/physics/shapesegment.hpp +++ b/src/modules/physics/include/eepp/physics/shapesegment.hpp @@ -5,7 +5,7 @@ namespace EE { namespace Physics { -class EE_API ShapeSegment : public Shape { +class EE_PHYSICS_API ShapeSegment : public Shape { public: static ShapeSegment* New( Physics::Body* body, cVect a, cVect b, cpFloat radius ); diff --git a/include/eepp/physics/space.hpp b/src/modules/physics/include/eepp/physics/space.hpp similarity index 99% rename from include/eepp/physics/space.hpp rename to src/modules/physics/include/eepp/physics/space.hpp index e9a76fffc..c003dc04a 100644 --- a/include/eepp/physics/space.hpp +++ b/src/modules/physics/include/eepp/physics/space.hpp @@ -10,7 +10,7 @@ namespace EE { namespace Physics { -class EE_API Space { +class EE_PHYSICS_API Space { public: typedef std::function CollisionBeginFunc; typedef std::function CollisionPreSolveFunc; diff --git a/include/eepp/thirdparty/chipmunk/chipmunk.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/chipmunk.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk.h diff --git a/include/eepp/thirdparty/chipmunk/chipmunk_ffi.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_ffi.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/chipmunk_ffi.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_ffi.h diff --git a/include/eepp/thirdparty/chipmunk/chipmunk_private.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_private.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/chipmunk_private.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_private.h diff --git a/include/eepp/thirdparty/chipmunk/chipmunk_types.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_types.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/chipmunk_types.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_types.h diff --git a/include/eepp/thirdparty/chipmunk/chipmunk_unsafe.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_unsafe.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/chipmunk_unsafe.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/chipmunk_unsafe.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpConstraint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpConstraint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpConstraint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpConstraint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpDampedRotarySpring.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpDampedRotarySpring.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpDampedRotarySpring.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpDampedRotarySpring.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpDampedSpring.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpDampedSpring.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpDampedSpring.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpDampedSpring.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpGearJoint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpGearJoint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpGearJoint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpGearJoint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpGrooveJoint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpGrooveJoint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpGrooveJoint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpGrooveJoint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpPinJoint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpPinJoint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpPinJoint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpPinJoint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpPivotJoint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpPivotJoint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpPivotJoint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpPivotJoint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpRatchetJoint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpRatchetJoint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpRatchetJoint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpRatchetJoint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpRotaryLimitJoint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpRotaryLimitJoint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpRotaryLimitJoint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpRotaryLimitJoint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpSimpleMotor.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpSimpleMotor.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpSimpleMotor.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpSimpleMotor.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/cpSlideJoint.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpSlideJoint.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/cpSlideJoint.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/cpSlideJoint.h diff --git a/include/eepp/thirdparty/chipmunk/constraints/util.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/util.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/constraints/util.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/constraints/util.h diff --git a/include/eepp/thirdparty/chipmunk/cpArbiter.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpArbiter.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpArbiter.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpArbiter.h diff --git a/include/eepp/thirdparty/chipmunk/cpBB.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpBB.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpBB.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpBB.h diff --git a/include/eepp/thirdparty/chipmunk/cpBody.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpBody.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpBody.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpBody.h diff --git a/include/eepp/thirdparty/chipmunk/cpPolyShape.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpPolyShape.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpPolyShape.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpPolyShape.h diff --git a/include/eepp/thirdparty/chipmunk/cpShape.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpShape.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpShape.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpShape.h diff --git a/include/eepp/thirdparty/chipmunk/cpSpace.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpSpace.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpSpace.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpSpace.h diff --git a/include/eepp/thirdparty/chipmunk/cpSpatialIndex.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpSpatialIndex.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpSpatialIndex.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpSpatialIndex.h diff --git a/include/eepp/thirdparty/chipmunk/cpVect.h b/src/modules/physics/include/eepp/thirdparty/chipmunk/cpVect.h similarity index 100% rename from include/eepp/thirdparty/chipmunk/cpVect.h rename to src/modules/physics/include/eepp/thirdparty/chipmunk/cpVect.h diff --git a/src/eepp/physics/arbiter.cpp b/src/modules/physics/src/eepp/physics/arbiter.cpp similarity index 100% rename from src/eepp/physics/arbiter.cpp rename to src/modules/physics/src/eepp/physics/arbiter.cpp diff --git a/src/eepp/physics/area.cpp b/src/modules/physics/src/eepp/physics/area.cpp similarity index 100% rename from src/eepp/physics/area.cpp rename to src/modules/physics/src/eepp/physics/area.cpp diff --git a/src/eepp/physics/body.cpp b/src/modules/physics/src/eepp/physics/body.cpp similarity index 100% rename from src/eepp/physics/body.cpp rename to src/modules/physics/src/eepp/physics/body.cpp diff --git a/src/eepp/physics/constraints/constraint.cpp b/src/modules/physics/src/eepp/physics/constraints/constraint.cpp similarity index 100% rename from src/eepp/physics/constraints/constraint.cpp rename to src/modules/physics/src/eepp/physics/constraints/constraint.cpp diff --git a/src/eepp/physics/constraints/dampedrotaryspring.cpp b/src/modules/physics/src/eepp/physics/constraints/dampedrotaryspring.cpp similarity index 100% rename from src/eepp/physics/constraints/dampedrotaryspring.cpp rename to src/modules/physics/src/eepp/physics/constraints/dampedrotaryspring.cpp diff --git a/src/eepp/physics/constraints/dampedspring.cpp b/src/modules/physics/src/eepp/physics/constraints/dampedspring.cpp similarity index 100% rename from src/eepp/physics/constraints/dampedspring.cpp rename to src/modules/physics/src/eepp/physics/constraints/dampedspring.cpp diff --git a/src/eepp/physics/constraints/gearjoint.cpp b/src/modules/physics/src/eepp/physics/constraints/gearjoint.cpp similarity index 100% rename from src/eepp/physics/constraints/gearjoint.cpp rename to src/modules/physics/src/eepp/physics/constraints/gearjoint.cpp diff --git a/src/eepp/physics/constraints/groovejoint.cpp b/src/modules/physics/src/eepp/physics/constraints/groovejoint.cpp similarity index 100% rename from src/eepp/physics/constraints/groovejoint.cpp rename to src/modules/physics/src/eepp/physics/constraints/groovejoint.cpp diff --git a/src/eepp/physics/constraints/pinjoint.cpp b/src/modules/physics/src/eepp/physics/constraints/pinjoint.cpp similarity index 100% rename from src/eepp/physics/constraints/pinjoint.cpp rename to src/modules/physics/src/eepp/physics/constraints/pinjoint.cpp diff --git a/src/eepp/physics/constraints/pivotjoint.cpp b/src/modules/physics/src/eepp/physics/constraints/pivotjoint.cpp similarity index 100% rename from src/eepp/physics/constraints/pivotjoint.cpp rename to src/modules/physics/src/eepp/physics/constraints/pivotjoint.cpp diff --git a/src/eepp/physics/constraints/ratchetjoint.cpp b/src/modules/physics/src/eepp/physics/constraints/ratchetjoint.cpp similarity index 100% rename from src/eepp/physics/constraints/ratchetjoint.cpp rename to src/modules/physics/src/eepp/physics/constraints/ratchetjoint.cpp diff --git a/src/eepp/physics/constraints/rotarylimitjoint.cpp b/src/modules/physics/src/eepp/physics/constraints/rotarylimitjoint.cpp similarity index 100% rename from src/eepp/physics/constraints/rotarylimitjoint.cpp rename to src/modules/physics/src/eepp/physics/constraints/rotarylimitjoint.cpp diff --git a/src/eepp/physics/constraints/simplemotor.cpp b/src/modules/physics/src/eepp/physics/constraints/simplemotor.cpp similarity index 100% rename from src/eepp/physics/constraints/simplemotor.cpp rename to src/modules/physics/src/eepp/physics/constraints/simplemotor.cpp diff --git a/src/eepp/physics/constraints/slidejoint.cpp b/src/modules/physics/src/eepp/physics/constraints/slidejoint.cpp similarity index 100% rename from src/eepp/physics/constraints/slidejoint.cpp rename to src/modules/physics/src/eepp/physics/constraints/slidejoint.cpp diff --git a/src/eepp/physics/moment.cpp b/src/modules/physics/src/eepp/physics/moment.cpp similarity index 100% rename from src/eepp/physics/moment.cpp rename to src/modules/physics/src/eepp/physics/moment.cpp diff --git a/src/eepp/physics/physicsmanager.cpp b/src/modules/physics/src/eepp/physics/physicsmanager.cpp similarity index 100% rename from src/eepp/physics/physicsmanager.cpp rename to src/modules/physics/src/eepp/physics/physicsmanager.cpp diff --git a/src/eepp/physics/shape.cpp b/src/modules/physics/src/eepp/physics/shape.cpp similarity index 100% rename from src/eepp/physics/shape.cpp rename to src/modules/physics/src/eepp/physics/shape.cpp diff --git a/src/eepp/physics/shapecircle.cpp b/src/modules/physics/src/eepp/physics/shapecircle.cpp similarity index 100% rename from src/eepp/physics/shapecircle.cpp rename to src/modules/physics/src/eepp/physics/shapecircle.cpp diff --git a/src/eepp/physics/shapecirclesprite.cpp b/src/modules/physics/src/eepp/physics/shapecirclesprite.cpp similarity index 100% rename from src/eepp/physics/shapecirclesprite.cpp rename to src/modules/physics/src/eepp/physics/shapecirclesprite.cpp diff --git a/src/eepp/physics/shapepoint.cpp b/src/modules/physics/src/eepp/physics/shapepoint.cpp similarity index 100% rename from src/eepp/physics/shapepoint.cpp rename to src/modules/physics/src/eepp/physics/shapepoint.cpp diff --git a/src/eepp/physics/shapepoly.cpp b/src/modules/physics/src/eepp/physics/shapepoly.cpp similarity index 100% rename from src/eepp/physics/shapepoly.cpp rename to src/modules/physics/src/eepp/physics/shapepoly.cpp diff --git a/src/eepp/physics/shapepolysprite.cpp b/src/modules/physics/src/eepp/physics/shapepolysprite.cpp similarity index 100% rename from src/eepp/physics/shapepolysprite.cpp rename to src/modules/physics/src/eepp/physics/shapepolysprite.cpp diff --git a/src/eepp/physics/shapesegment.cpp b/src/modules/physics/src/eepp/physics/shapesegment.cpp similarity index 100% rename from src/eepp/physics/shapesegment.cpp rename to src/modules/physics/src/eepp/physics/shapesegment.cpp diff --git a/src/eepp/physics/space.cpp b/src/modules/physics/src/eepp/physics/space.cpp similarity index 100% rename from src/eepp/physics/space.cpp rename to src/modules/physics/src/eepp/physics/space.cpp diff --git a/src/tests/test_all/test.cpp b/src/tests/test_all/test.cpp index c8857c267..f90f20b8f 100644 --- a/src/tests/test_all/test.cpp +++ b/src/tests/test_all/test.cpp @@ -213,6 +213,8 @@ void EETest::init() { if ( EE->isThreaded() ) launch(); } else { + PhysicsManager::destroySingleton(); + Engine::destroySingleton(); exit( 0 ); @@ -2549,6 +2551,8 @@ EE_MAIN_FUNC int main( int, char*[] ) { eeDelete( Test ); + PhysicsManager::destroySingleton(); + Engine::destroySingleton(); MemoryManager::showResults(); diff --git a/src/tests/test_all/test.hpp b/src/tests/test_all/test.hpp index 6aa14d00d..6e1e0c9ba 100644 --- a/src/tests/test_all/test.hpp +++ b/src/tests/test_all/test.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace Demo_Test { diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 865fc5baf..f120ea02d 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -6,6 +6,8 @@ #include "version.hpp" #include #include +#include +using json = nlohmann::json; #ifdef ECODE_USE_BACKWARD #if EE_PLATFORM == EE_PLATFORM_LINUX @@ -660,22 +662,97 @@ void App::setUIColorScheme( const ColorSchemePreference& colorScheme ) { mUISceneNode->setColorSchemePreference( colorScheme ); } +void App::checkForUpdatesResponse( Http::Response response ) { + auto updatesError = [&]() { + UIMessageBox* msg = UIMessageBox::New( + UIMessageBox::OK, i18n( "error_checking_version", "Failed checking for updates." ) ); + msg->setTitle( "Error" ); + msg->setCloseShortcut( { KEY_ESCAPE, 0 } ); + msg->showWhenReady(); + }; + + if ( response.getStatus() != Http::Response::Status::Ok || response.getBody().empty() ) { + updatesError(); + return; + } + + json j; + try { + j = json::parse( response.getBody(), nullptr, true, true ); + + if ( j.contains( "tag_name" ) ) { + auto tagName( j["tag_name"].get() ); + auto versionNum = ecode::Version::getVersionNumFromTag( tagName ); + if ( versionNum > ecode::Version::getVersionNum() ) { + auto name( j.value( "name", tagName ) ); + UIMessageBox* msg = UIMessageBox::New( + UIMessageBox::OK_CANCEL, + name + i18n( "ecode_updates_available", + " is available!\nDo you want to download it now?" ) + .unescape() ); + auto url( j.value( "html_url", "https://github.com/SpartanJ/ecode/releases/" ) ); + msg->addEventListener( Event::MsgBoxConfirmClick, [&, url, msg]( const Event* ) { + Engine::instance()->openURI( url ); + msg->closeWindow(); + } ); + msg->setTitle( "ecode" ); + msg->setCloseShortcut( { KEY_ESCAPE, 0 } ); + msg->showWhenReady(); + } else if ( versionNum < ecode::Version::getVersionNum() ) { + UIMessageBox* msg = UIMessageBox::New( + UIMessageBox::OK, + i18n( "ecode_unreleased_version", + "You are running an unreleased version of ecode!\nCurrent version: " ) + .unescape() + + ecode::Version::getVersionNumString() ); + msg->setTitle( "ecode" ); + msg->setCloseShortcut( { KEY_ESCAPE, 0 } ); + msg->showWhenReady(); + } else { + UIMessageBox* msg = UIMessageBox::New( + UIMessageBox::OK, i18n( "ecode_no_updates_available", + "There are currently no updates available." ) ); + msg->setTitle( "ecode" ); + msg->setCloseShortcut( { KEY_ESCAPE, 0 } ); + msg->showWhenReady(); + } + } else { + updatesError(); + } + } catch ( ... ) { + updatesError(); + } +} + +void App::checkForUpdates() { + Http::getAsync( + [&]( const Http&, Http::Request&, Http::Response& response ) { + mUISceneNode->runOnMainThread( + [&, response]() { checkForUpdatesResponse( response ); } ); + }, + "https://api.github.com/repos/SpartanJ/ecode/releases/latest", Seconds( 30 ) ); +} + UIMenu* App::createHelpMenu() { UIPopUpMenu* helpMenu = UIPopUpMenu::New(); helpMenu->add( i18n( "ecode_source", "ecode source code..." ), findIcon( "github" ) ) - ->setId( "ecode_source" ); - helpMenu->add( i18n( "about_ecode", "About ecode..." ) )->setId( "about_ecode" ); + ->setId( "ecode-source" ); + helpMenu->add( i18n( "check_for_updates", "Check for Updates..." ), findIcon( "refresh" ) ) + ->setId( "check-for-updates" ); + helpMenu->add( i18n( "about_ecode", "About ecode..." ) )->setId( "about-ecode" ); helpMenu->addEventListener( Event::OnItemClicked, [&]( const Event* event ) { const std::string& id = event->getNode()->getId(); - if ( "ecode_source" == id ) { + if ( "ecode-source" == id ) { Engine::instance()->openURI( "https://github.com/SpartanJ/ecode" ); - } else if ( "about_ecode" == id ) { - String msg( ecode::Version::getVersionName() + " (codename: \"" + + } else if ( "about-ecode" == id ) { + String msg( ecode::Version::getVersionFullName() + " (codename: \"" + ecode::Version::getCodename() + "\")" ); UIMessageBox* msgBox = UIMessageBox::New( UIMessageBox::OK, msg ); msgBox->setTitle( i18n( "about_ecode", "About ecode..." ) ); msgBox->show(); + } else if ( "check-for-updates" == id ) { + checkForUpdates(); } } ); return helpMenu; @@ -701,14 +778,14 @@ void App::setUIScaleFactor() { UIMessageBox::OK, i18n( "new_ui_scale_factor", "New UI scale factor assigned.\nPlease " "restart the application." ) ); - msg->show(); + msg->showWhenReady(); setFocusEditorOnClose( msg ); } else if ( mSplitter && mSplitter->getCurWidget() ) { mSplitter->getCurWidget()->setFocus(); } } else { UIMessageBox* msg = UIMessageBox::New( UIMessageBox::OK, "Invalid value!" ); - msg->show(); + msg->showWhenReady(); setFocusEditorOnClose( msg ); } } ); @@ -2290,7 +2367,9 @@ std::vector App::getUnlockedCommands() { "debug-draw-debug-data", "editor-set-line-breaking-column", "editor-set-line-spacing", - "editor-set-cursor-blinking-time" }; + "editor-set-cursor-blinking-time", + "check-for-updates", + "keybindings" }; } bool App::isUnlockedCommand( const std::string& command ) { @@ -3531,7 +3610,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe mConfig.context.SharedGLContext = true; mWindow = engine->createWindow( winSettings, mConfig.context ); - Log::info( "%s (codename: \"%s\") initializing", ecode::Version::getVersionName().c_str(), + Log::info( "%s (codename: \"%s\") initializing", ecode::Version::getVersionFullName().c_str(), ecode::Version::getCodename().c_str() ); if ( mWindow->isOpen() ) { @@ -3886,6 +3965,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe { "file-code", 0xecd1 }, { "cursor-pointer", 0xec09 }, { "drive", 0xedf8 }, + { "refresh", 0xf064 }, }; for ( const auto& icon : icons ) iconTheme->add( UIGlyphIcon::New( icon.first, iconFont, icon.second ) ); @@ -4148,7 +4228,7 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { } if ( version.Get() ) { - std::cout << ecode::Version::getVersionName() << '\n'; + std::cout << ecode::Version::getVersionFullName() << '\n'; return EXIT_SUCCESS; } diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp index 70126dcde..912d2e875 100644 --- a/src/tools/ecode/ecode.hpp +++ b/src/tools/ecode/ecode.hpp @@ -217,6 +217,7 @@ class App : public UICodeEditorSplitter::Client { t.setCommand( "editor-set-line-breaking-column", [&] { setLineBreakingColumn(); } ); t.setCommand( "editor-set-line-spacing", [&] { setLineSpacing(); } ); t.setCommand( "editor-set-cursor-blinking-time", [&] { setCursorBlinkingTime(); } ); + t.setCommand( "check-for-updates", [&] { checkForUpdates(); } ); mSplitter->registerSplitterCommands( t ); } @@ -232,6 +233,8 @@ class App : public UICodeEditorSplitter::Client { void setCursorBlinkingTime(); + void checkForUpdates(); + protected: EE::Window::Window* mWindow{ nullptr }; UISceneNode* mUISceneNode{ nullptr }; @@ -432,6 +435,8 @@ class App : public UICodeEditorSplitter::Client { void initPluginManager(); void onPluginEnabled( UICodeEditorPlugin* plugin ); + + void checkForUpdatesResponse( Http::Response response ); }; } // namespace ecode diff --git a/src/tools/ecode/version.cpp b/src/tools/ecode/version.cpp index 219ff4325..fa3190ab2 100644 --- a/src/tools/ecode/version.cpp +++ b/src/tools/ecode/version.cpp @@ -14,13 +14,39 @@ Uint32 Version::getVersionNum() { return ECODE_VERSIONNUM( ver.major, ver.minor, ver.patch ); } -std::string Version::getVersionName() { +std::string Version::getVersionNumString() { + Version ver = getVersion(); + return String::format( "%d.%d.%d", ver.major, ver.minor, ver.patch ); +} + +std::string Version::getVersionFullName() { Version ver = getVersion(); return String::format( "ecode version %d.%d.%d", ver.major, ver.minor, ver.patch ); } +std::string Version::getTagName() { + Version ver = getVersion(); + return String::format( "ecode-%d.%d.%d", ver.major, ver.minor, ver.patch ); +} + std::string Version::getCodename() { return std::string( ECODE_CODENAME ); } +Uint32 Version::getVersionNumFromTag( const std::string& tag ) { + auto tagPart = String::split( tag, '-' ); + if ( tagPart.size() == 2 ) { + auto versionPart = String::split( tagPart[1], '.' ); + if ( versionPart.size() == 3 ) { + Version ver; + if ( String::fromString( ver.major, versionPart[0] ) && + String::fromString( ver.minor, versionPart[1] ) && + String::fromString( ver.patch, versionPart[2] ) ) { + return ECODE_VERSIONNUM( ver.major, ver.minor, ver.patch ); + } + } + } + return 0; +} + } // namespace ecode diff --git a/src/tools/ecode/version.hpp b/src/tools/ecode/version.hpp index 5a87b97f6..323cc198e 100644 --- a/src/tools/ecode/version.hpp +++ b/src/tools/ecode/version.hpp @@ -8,7 +8,7 @@ using namespace EE; #define ECODE_MAJOR_VERSION 0 #define ECODE_MINOR_VERSION 4 -#define ECODE_PATCH_LEVEL 0 +#define ECODE_PATCH_LEVEL 1 #define ECODE_CODENAME "Vajra" /** The compiled version of the library */ @@ -30,9 +30,9 @@ namespace ecode { class Version { public: - Uint8 major; /**< major version */ - Uint8 minor; /**< minor version */ - Uint8 patch; /**< update version */ + Uint32 major; /**< major version */ + Uint32 minor; /**< minor version */ + Uint32 patch; /**< update version */ /** @return The linked version of the library */ static Version getVersion(); @@ -40,17 +40,24 @@ class Version { /** @return The linked version number of the library */ static Uint32 getVersionNum(); - /** @return The library version name: "eepp version major.minor.patch" */ - static std::string getVersionName(); + /** @return The linked version number of the library */ + static std::string getVersionNumString(); + + /** @return The library version name: "ecode version major.minor.patch" */ + static std::string getVersionFullName(); + + /** @return The library release tag name: "ecode-major.minor.patch" */ + static std::string getTagName(); /** @return The version codename */ static std::string getCodename(); /** @return The build time of the library */ - static inline std::string getBuildTime() { return std::string( __DATE__ ) + " " + std::string( __TIME__ ); } + + static Uint32 getVersionNumFromTag( const std::string& tag ); }; } // namespace ecode