Added support for Android Studio

This commit is contained in:
Vladislav Khorev 2017-01-10 07:10:36 +03:00
parent e4a7822385
commit 99a6b3728d
45 changed files with 1834 additions and 548 deletions

View File

@ -1,432 +0,0 @@
#Engine and libs path for Android projects
ENGINE_PATH = $(SalmonEnginePathCygwin)
BOOST_PATH = $(LibsPathCygwin)/boost_1_52_0
OGG_PATH = $(LibsPathCygwin)/libogg-1.3.0
VORBIS_PATH = $(LibsPathCygwin)/libvorbis-1.3.2
SQUIRREL_PATH = $(LibsPathCygwin)/sqplus
LIBPNG_PATH = $(LibsPathCygwin)/libpng_1.4.1_android
LIBJPEG_PATH = $(LibsPathCygwin)/jpeg-9
ZIP_PATH = $(LibsPathCygwin)/julienr-libzip-android/jni
#ENGINE_PATH = $(SalmonEnginePath)
#BOOST_PATH = $(LibsPath)/boost_1_52_0
#OGG_PATH = $(LibsPath)/libogg-1.3.0
#VORBIS_PATH = $(LibsPath)/libvorbis-1.3.2
#SQUIRREL_PATH = $(LibsPath)/sqplus
#LIBPNG_PATH = $(LibsPath)/libpng_1.4.1_android
#ZIP_PATH = $(LibsPath)/julienr-libzip-android/jni
#================== ZIP =================
LOCAL_PATH := $(ZIP_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := zip
LOCAL_SRC_FILES :=\
zip_add.c \
zip_add_dir.c \
zip_close.c \
zip_delete.c \
zip_dirent.c \
zip_entry_free.c \
zip_entry_new.c \
zip_err_str.c \
zip_error.c \
zip_error_clear.c \
zip_error_get.c \
zip_error_get_sys_type.c \
zip_error_strerror.c \
zip_error_to_str.c \
zip_fclose.c \
zip_file_error_clear.c \
zip_file_error_get.c \
zip_file_get_offset.c \
zip_file_strerror.c \
zip_filerange_crc.c \
zip_fopen.c \
zip_fopen_index.c \
zip_fread.c \
zip_free.c \
zip_get_archive_comment.c \
zip_get_archive_flag.c \
zip_get_file_comment.c \
zip_get_num_files.c \
zip_get_name.c \
zip_memdup.c \
zip_name_locate.c \
zip_new.c \
zip_open.c \
zip_rename.c \
zip_replace.c \
zip_set_archive_comment.c \
zip_set_archive_flag.c \
zip_set_file_comment.c \
zip_source_buffer.c \
zip_source_file.c \
zip_source_filep.c \
zip_source_free.c \
zip_source_function.c \
zip_source_zip.c \
zip_set_name.c \
zip_stat.c \
zip_stat_index.c \
zip_stat_init.c \
zip_strerror.c \
zip_unchange.c \
zip_unchange_all.c \
zip_unchange_archive.c \
zip_unchange_data.c
LOCAL_LDLIBS := -lz
#debug
#LOCAL_CFLAGS := -g -ggdb -O0
#LOCAL_LDLIBS += -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#================== PNG =================
LOCAL_PATH := $(LIBPNG_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := png_lib
LOCAL_SRC_FILES :=\
png.c \
pngerror.c \
pngget.c \
pngmem.c \
pngpread.c \
pngread.c \
pngrio.c \
pngrtran.c \
pngrutil.c \
pngset.c \
pngtrans.c \
pngwio.c \
pngwrite.c \
pngwtran.c \
pngwutil.c
LOCAL_LDLIBS := -lz
#debug
#LOCAL_CFLAGS := -g -ggdb -O0
#LOCAL_LDLIBS += -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#=============== JPEG =============
LOCAL_PATH := $(LIBJPEG_PATH)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LIBJPEG_PATH)
LOCAL_C_INCLUDES += $(LIBJPEG_PATH)/vc10
LOCAL_MODULE := jpeg
LOCAL_SRC_FILES :=\
jaricom.c\
jcapimin.c\
jcapistd.c\
jcarith.c\
jccoefct.c\
jccolor.c\
jcdctmgr.c\
jchuff.c\
jcinit.c\
jcmainct.c\
jcmarker.c\
jcmaster.c\
jcomapi.c\
jcparam.c\
jcprepct.c\
jcsample.c\
jctrans.c\
jdapimin.c\
jdapistd.c\
jdarith.c\
jdatadst.c\
jdatasrc.c\
jdcoefct.c\
jdcolor.c\
jddctmgr.c\
jdhuff.c\
jdinput.c\
jdmainct.c\
jdmarker.c\
jdmaster.c\
jdmerge.c\
jdpostct.c\
jdsample.c\
jdtrans.c\
jerror.c\
jfdctflt.c\
jfdctfst.c\
jfdctint.c\
jidctflt.c\
jidctfst.c\
jidctint.c\
jmemmgr.c\
jmemnobs.c\
jquant1.c\
jquant2.c\
jutils.c
LOCAL_LDLIBS :=
#debug
#LOCAL_CFLAGS := -g -ggdb -O0
#LOCAL_LDLIBS += -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#================== SQUIRREL =================
include $(CLEAR_VARS)
LOCAL_MODULE := squirrel
LOCAL_PATH := $(SQUIRREL_PATH)
LOCAL_C_INCLUDES := $(SQUIRREL_PATH)/include $(SQUIRREL_PATH)/sqplus/sqplus $(SQUIRREL_PATH)/squirrel $(SQUIRREL_PATH)/sqstdlib
LOCAL_SRC_FILES := squirrel/sqapi.cpp \
squirrel/sqbaselib.cpp \
squirrel/sqclass.cpp \
squirrel/sqcompiler.cpp \
squirrel/sqdebug.cpp \
squirrel/sqfuncstate.cpp \
squirrel/sqlexer.cpp \
squirrel/sqmem.cpp \
squirrel/sqobject.cpp \
squirrel/sqstate.cpp \
squirrel/sqtable.cpp \
squirrel/sqvm.cpp \
sqplus/SqPlus.cpp \
sqplus/SqPlusOCharBuf.cpp \
sqplus/SqPlusUtf8.cpp \
sqplus/SquirrelBindingsUtils.cpp \
sqplus/SquirrelObject.cpp \
sqplus/SquirrelVM.cpp \
sqstdlib/sqstdblob.cpp \
sqstdlib/sqstdio.cpp \
sqstdlib/sqstdmath.cpp \
sqstdlib/sqstdrex.cpp \
sqstdlib/sqstdstream.cpp \
sqstdlib/sqstdstring.cpp \
sqstdlib/sqstdsystem.cpp \
sqstdlib/sqstdaux.cpp \
#debug
#LOCAL_CFLAGS := -g -ggdb -O0
#LOCAL_LDLIBS := -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#================== OGG / VORBIS / VORBISFILE ===================
include $(CLEAR_VARS)
LOCAL_MODULE := vorbis
LOCAL_PATH := $(VORBIS_PATH)/lib
LOCAL_C_INCLUDES := $(VORBIS_PATH)/include
LOCAL_C_INCLUDES += $(VORBIS_PATH)/include/vorbis
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/src
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/books
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/modes
LOCAL_C_INCLUDES += $(OGG_PATH)/include
LOCAL_C_INCLUDES += $(OGG_PATH)/include/ogg
LOCAL_SRC_FILES := ../../libogg-1.3.0/src/framing.c ../../libogg-1.3.0/src/bitwise.c
LOCAL_SRC_FILES += mdct.c smallft.c block.c envelope.c window.c lsp.c \
lpc.c analysis.c synthesis.c psy.c info.c \
floor1.c floor0.c\
res0.c mapping0.c registry.c codebook.c sharedbook.c\
lookup.c bitrate.c
LOCAL_SRC_FILES += vorbisfile.c
#debug
#LOCAL_CFLAGS := -g -ggdb -O0
#LOCAL_LDLIBS := -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#================== BOOST ====================
LOCAL_PATH := $(BOOST_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := boost
LOCAL_C_INCLUDES := $(BOOST_PATH)
LOCAL_CFLAGS := -std=gnu++11 --std=c++11
#thread
LOCAL_SRC_FILES := /libs/thread/src/pthread/thread.cpp
LOCAL_SRC_FILES += /libs/thread/src/pthread/once.cpp
#signals
LOCAL_SRC_FILES += /libs/signals/src/connection.cpp
LOCAL_SRC_FILES += /libs/signals/src/named_slot_map.cpp
LOCAL_SRC_FILES += /libs/signals/src/signal_base.cpp
LOCAL_SRC_FILES += /libs/signals/src/slot.cpp
LOCAL_SRC_FILES += /libs/signals/src/trackable.cpp
#system
LOCAL_SRC_FILES += /libs/system/src/error_code.cpp
#regex
LOCAL_SRC_FILES += /libs/regex/src/c_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/cpp_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/cregex.cpp
LOCAL_SRC_FILES += /libs/regex/src/fileiter.cpp
LOCAL_SRC_FILES += /libs/regex/src/icu.cpp
LOCAL_SRC_FILES += /libs/regex/src/instances.cpp
LOCAL_SRC_FILES += /libs/regex/src/posix_api.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex_debug.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex_raw_buffer.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex_traits_defaults.cpp
LOCAL_SRC_FILES += /libs/regex/src/static_mutex.cpp
LOCAL_SRC_FILES += /libs/regex/src/usinstances.cpp
LOCAL_SRC_FILES += /libs/regex/src/w32_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/wc_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/wide_posix_api.cpp
LOCAL_SRC_FILES += /libs/regex/src/winstances.cpp
#date_time
LOCAL_SRC_FILES += /libs/date_time/src/gregorian/greg_month.cpp
LOCAL_SRC_FILES += /libs/date_time/src/gregorian/greg_weekday.cpp
LOCAL_SRC_FILES += /libs/date_time/src/gregorian/date_generators.cpp
#asio
#nothing
LOCAL_LDLIBS := -llog -Wl
#debug
#LOCAL_CFLAGS += -g -ggdb -O0
#LOCAL_LDLIBS += -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#============= SALMON ENGINE ================
LOCAL_PATH := $(ENGINE_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := SalmonEngine
LOCAL_CFLAGS := -DTARGET_ANDROID -std=gnu++11 --std=c++11
LOCAL_STATIC_LIBRARIES := boost
LOCAL_STATIC_LIBRARIES += ogg
LOCAL_STATIC_LIBRARIES += vorbis
LOCAL_STATIC_LIBRARIES += squirrel
LOCAL_STATIC_LIBRARIES += png_lib
LOCAL_STATIC_LIBRARIES += jpeg
LOCAL_STATIC_LIBRARIES += zip
LOCAL_SHARED_LIBRARIES := gnustl_shared
LOCAL_C_INCLUDES := $(BOOST_PATH)
LOCAL_C_INCLUDES += $(VORBIS_PATH)/include
LOCAL_C_INCLUDES += $(VORBIS_PATH)/include/vorbis
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/books
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/modes
LOCAL_C_INCLUDES += $(OGG_PATH)/include
LOCAL_C_INCLUDES += $(OGG_PATH)/include/ogg
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/include
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/sqplus
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/sqstdlib
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/squirrel
LOCAL_C_INCLUDES += $(LIBPNG_PATH)
LOCAL_C_INCLUDES += $(LIBJPEG_PATH)
LOCAL_C_INCLUDES += $(LIBJPEG_PATH)/vc10
LOCAL_C_INCLUDES += $(ZIP_PATH)
LOCAL_SRC_FILES := src/Utils/DataTypes/DataTypes.cpp
LOCAL_SRC_FILES += src/Utils/DataTypes/NewDataTypes.cpp
LOCAL_SRC_FILES += src/Utils/FileUtils/FileUtils.cpp
LOCAL_SRC_FILES += src/Utils/JniApi/JniApi.cpp
LOCAL_SRC_FILES += src/Utils/JniApi/JniApplication.cpp
LOCAL_SRC_FILES += src/Utils/Console/Console.cpp
LOCAL_SRC_FILES += src/Utils/SerializeInterface/SerializeInterface.cpp
LOCAL_SRC_FILES += src/Utils/Network/Network.cpp
LOCAL_SRC_FILES += src/Utils/PngHelper.cpp
LOCAL_SRC_FILES += src/Utils/JpegHelper.cpp
LOCAL_SRC_FILES += src/Utils/TgaLoader.cpp
LOCAL_SRC_FILES += src/Utils/SimpleTimer.cpp
LOCAL_SRC_FILES += src/Utils/ThreadUtils.cpp
LOCAL_SRC_FILES += src/TextureManager/SalmonTexture.cpp
LOCAL_SRC_FILES += src/ShaderManager/ShaderManager.cpp
LOCAL_SRC_FILES += src/FrameManager/FrameManager.cpp
LOCAL_SRC_FILES += src/LightManager/LightManager.cpp
LOCAL_SRC_FILES += src/SoundManager/SoundManagerAndroid.cpp
LOCAL_SRC_FILES += src/SoundManager/SoundManagerDataTypes.cpp
LOCAL_SRC_FILES += src/FontManager/FontManager.cpp
LOCAL_SRC_FILES += src/ScriptManager/ScriptManager.cpp
LOCAL_SRC_FILES += src/SmartValueManager/SmartValueManager.cpp
LOCAL_SRC_FILES += src/GUIManager/GUIManager.cpp
LOCAL_SRC_FILES += src/GUIManager/ButtonWidget.cpp
LOCAL_SRC_FILES += src/GUIManager/WidgetXmlParsers.cpp
LOCAL_SRC_FILES += src/HalibutAnimation/HalibutAnimation.cpp
LOCAL_SRC_FILES += src/ModelManager/ModelManager.cpp
LOCAL_SRC_FILES += src/ModelManager/NewModelManager.cpp
LOCAL_SRC_FILES += src/SimpleLand/SimpleLand.cpp
LOCAL_SRC_FILES += src/PhysicsManager/PhysicsManager.cpp
LOCAL_SRC_FILES += src/Render/RenderMisc.cpp
LOCAL_SRC_FILES += src/Render/RenderParams.cpp
LOCAL_SRC_FILES += src/Render/SalmonRender/BackgroundCubemap.cpp
LOCAL_SRC_FILES += src/Render/SalmonRender/SalmonRenderInterface.cpp
LOCAL_SRC_FILES += src/Render/SalmonRender/SalmonRenderGLES20.cpp
LOCAL_SRC_FILES += src/Render/SalmonRender/SalmonRenderAndroid.cpp
LOCAL_SRC_FILES += src/Render/SalmonRender/Cameras.cpp
LOCAL_SRC_FILES += src/Animation/SalmonAnimation.cpp
LOCAL_SRC_FILES += src/SalmonEngineAndroid.cpp
LOCAL_SRC_FILES += src/SalmonEngineInterface.cpp
LOCAL_LDLIBS := -lGLESv2
LOCAL_LDLIBS += -llog -Wl -lz
#debug
#LOCAL_CFLAGS += -g -ggdb -O0
#LOCAL_LDLIBS += -g -ggdb
#no -s cause no need stripping!!!!
include $(BUILD_SHARED_LIBRARY)

9
SalmonEngineAndroid/.gitignore vendored Executable file
View File

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Android\Android Studio\gradle\gradle-2.14.1" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="SvnBranchConfigurationManager">
<option name="mySupportsUserInfoFilter" value="true" />
</component>
</project>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/SalmonEngineAndroid.iml" filepath="$PROJECT_DIR$/SalmonEngineAndroid.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../libs/jpeg-9" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/julienr-libzip-android/jni" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/libogg-1.3.0/src" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/libpng_1.4.1_android" vcs="svn" />
<mapping directory="$PROJECT_DIR$/../../libs/libvorbis-1.3.2/lib" vcs="svn" />
</component>
</project>

1
SalmonEngineAndroid/app/.gitignore vendored Executable file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,372 @@
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds it for you.
# Gradle automatically packages shared libraries with your APK.
#ENGINE_PATH = $(SalmonEnginePathCygwin)
#BOOST_PATH = $(LibsPathCygwin)/boost_1_52_0
#OGG_PATH = $(LibsPathCygwin)/libogg-1.3.0
#VORBIS_PATH = $(LibsPathCygwin)/libvorbis-1.3.2
#SQUIRREL_PATH = $(LibsPathCygwin)/sqplus
#LIBPNG_PATH = $(LibsPathCygwin)/libpng_1.4.1_android
#LIBJPEG_PATH = $(LibsPathCygwin)/jpeg-9
#ZIP_PATH = $(LibsPathCygwin)/julienr-libzip-android/jni
set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../boost_1_63_0)
set(BOOST_GIL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/boost-gil-extension)
set(ZIP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/julienr-libzip-android/jni)
set(LIBPNG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libpng_1.4.1_android)
set(LIBJPEG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/jpeg-9")
set(SQUIRREL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/sqplus)
set(OGG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libogg-1.3.0)
set(VORBIS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libvorbis-1.3.2)
#include_directories(ZIP_PATH)
add_library(zip
${ZIP_PATH}/zip_add.c
${ZIP_PATH}/zip_add_dir.c
${ZIP_PATH}/zip_close.c
${ZIP_PATH}/zip_delete.c
${ZIP_PATH}/zip_dirent.c
${ZIP_PATH}/zip_entry_free.c
${ZIP_PATH}/zip_entry_new.c
${ZIP_PATH}/zip_err_str.c
${ZIP_PATH}/zip_error.c
${ZIP_PATH}/zip_error_clear.c
${ZIP_PATH}/zip_error_get.c
${ZIP_PATH}/zip_error_get_sys_type.c
${ZIP_PATH}/zip_error_strerror.c
${ZIP_PATH}/zip_error_to_str.c
${ZIP_PATH}/zip_fclose.c
${ZIP_PATH}/zip_file_error_clear.c
${ZIP_PATH}/zip_file_error_get.c
${ZIP_PATH}/zip_file_get_offset.c
${ZIP_PATH}/zip_file_strerror.c
${ZIP_PATH}/zip_filerange_crc.c
${ZIP_PATH}/zip_fopen.c
${ZIP_PATH}/zip_fopen_index.c
${ZIP_PATH}/zip_fread.c
${ZIP_PATH}/zip_free.c
${ZIP_PATH}/zip_get_archive_comment.c
${ZIP_PATH}/zip_get_archive_flag.c
${ZIP_PATH}/zip_get_file_comment.c
${ZIP_PATH}/zip_get_num_files.c
${ZIP_PATH}/zip_get_name.c
${ZIP_PATH}/zip_memdup.c
${ZIP_PATH}/zip_name_locate.c
${ZIP_PATH}/zip_new.c
${ZIP_PATH}/zip_open.c
${ZIP_PATH}/zip_rename.c
${ZIP_PATH}/zip_replace.c
${ZIP_PATH}/zip_set_archive_comment.c
${ZIP_PATH}/zip_set_archive_flag.c
${ZIP_PATH}/zip_set_file_comment.c
${ZIP_PATH}/zip_source_buffer.c
${ZIP_PATH}/zip_source_file.c
${ZIP_PATH}/zip_source_filep.c
${ZIP_PATH}/zip_source_free.c
${ZIP_PATH}/zip_source_function.c
${ZIP_PATH}/zip_source_zip.c
${ZIP_PATH}/zip_set_name.c
${ZIP_PATH}/zip_stat.c
${ZIP_PATH}/zip_stat_index.c
${ZIP_PATH}/zip_stat_init.c
${ZIP_PATH}/zip_strerror.c
${ZIP_PATH}/zip_unchange.c
${ZIP_PATH}/zip_unchange_all.c
${ZIP_PATH}/zip_unchange_archive.c
${ZIP_PATH}/zip_unchange_data.c
)
#include_directories(LIBPNG_PATH)
add_library(png
${LIBPNG_PATH}/png.c
${LIBPNG_PATH}/pngerror.c
${LIBPNG_PATH}/pngget.c
${LIBPNG_PATH}/pngmem.c
${LIBPNG_PATH}/pngpread.c
${LIBPNG_PATH}/pngread.c
${LIBPNG_PATH}/pngrio.c
${LIBPNG_PATH}/pngrtran.c
${LIBPNG_PATH}/pngrutil.c
${LIBPNG_PATH}/pngset.c
${LIBPNG_PATH}/pngtrans.c
${LIBPNG_PATH}/pngwio.c
${LIBPNG_PATH}/pngwrite.c
${LIBPNG_PATH}/pngwtran.c
${LIBPNG_PATH}/pngwutil.c
)
include_directories(${LIBJPEG_PATH}/vc10)
add_library(jpeg
${LIBJPEG_PATH}/jaricom.c
${LIBJPEG_PATH}/jcapimin.c
${LIBJPEG_PATH}/jcapistd.c
${LIBJPEG_PATH}/jcarith.c
${LIBJPEG_PATH}/jccoefct.c
${LIBJPEG_PATH}/jccolor.c
${LIBJPEG_PATH}/jcdctmgr.c
${LIBJPEG_PATH}/jchuff.c
${LIBJPEG_PATH}/jcinit.c
${LIBJPEG_PATH}/jcmainct.c
${LIBJPEG_PATH}/jcmarker.c
${LIBJPEG_PATH}/jcmaster.c
${LIBJPEG_PATH}/jcomapi.c
${LIBJPEG_PATH}/jcparam.c
${LIBJPEG_PATH}/jcprepct.c
${LIBJPEG_PATH}/jcsample.c
${LIBJPEG_PATH}/jctrans.c
${LIBJPEG_PATH}/jdapimin.c
${LIBJPEG_PATH}/jdapistd.c
${LIBJPEG_PATH}/jdarith.c
${LIBJPEG_PATH}/jdatadst.c
${LIBJPEG_PATH}/jdatasrc.c
${LIBJPEG_PATH}/jdcoefct.c
${LIBJPEG_PATH}/jdcolor.c
${LIBJPEG_PATH}/jddctmgr.c
${LIBJPEG_PATH}/jdhuff.c
${LIBJPEG_PATH}/jdinput.c
${LIBJPEG_PATH}/jdmainct.c
${LIBJPEG_PATH}/jdmarker.c
${LIBJPEG_PATH}/jdmaster.c
${LIBJPEG_PATH}/jdmerge.c
${LIBJPEG_PATH}/jdpostct.c
${LIBJPEG_PATH}/jdsample.c
${LIBJPEG_PATH}/jdtrans.c
${LIBJPEG_PATH}/jerror.c
${LIBJPEG_PATH}/jfdctflt.c
${LIBJPEG_PATH}/jfdctfst.c
${LIBJPEG_PATH}/jfdctint.c
${LIBJPEG_PATH}/jidctflt.c
${LIBJPEG_PATH}/jidctfst.c
${LIBJPEG_PATH}/jidctint.c
${LIBJPEG_PATH}/jmemmgr.c
${LIBJPEG_PATH}/jmemnobs.c
${LIBJPEG_PATH}/jquant1.c
${LIBJPEG_PATH}/jquant2.c
${LIBJPEG_PATH}/jutils.c
)
#LOCAL_PATH := $(VORBIS_PATH)/lib
#LOCAL_C_INCLUDES := $(VORBIS_PATH)/include
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/include/vorbis
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/src
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/books
#LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/modes
#LOCAL_C_INCLUDES += $(OGG_PATH)/include
#LOCAL_C_INCLUDES += $(OGG_PATH)/include/ogg
include_directories(${OGG_PATH}/include)
include_directories(${VORBIS_PATH}/include)
add_library(ogg
${OGG_PATH}/src/framing.c
${OGG_PATH}/src/bitwise.c
)
add_library(vorbis
${VORBIS_PATH}/lib/mdct.c
${VORBIS_PATH}/lib/smallft.c
${VORBIS_PATH}/lib/block.c
${VORBIS_PATH}/lib/envelope.c
${VORBIS_PATH}/lib/window.c
${VORBIS_PATH}/lib/lsp.c
${VORBIS_PATH}/lib/lpc.c
${VORBIS_PATH}/lib/analysis.c
${VORBIS_PATH}/lib/synthesis.c
${VORBIS_PATH}/lib/psy.c
${VORBIS_PATH}/lib/info.c
${VORBIS_PATH}/lib/floor1.c
${VORBIS_PATH}/lib/floor0.c
${VORBIS_PATH}/lib/res0.c
${VORBIS_PATH}/lib/mapping0.c
${VORBIS_PATH}/lib/registry.c
${VORBIS_PATH}/lib/codebook.c
${VORBIS_PATH}/lib/sharedbook.c
${VORBIS_PATH}/lib/lookup.c
${VORBIS_PATH}/lib/bitrate.c
${VORBIS_PATH}/lib/vorbisfile.c
)
include_directories(${BOOST_PATH})
add_library(boost
${BOOST_PATH}/libs/thread/src/pthread/thread.cpp
#thread
${BOOST_PATH}/libs/thread/src/pthread/thread.cpp
${BOOST_PATH}/libs/thread/src/pthread/once.cpp
#signals
${BOOST_PATH}/libs/signals/src/connection.cpp
${BOOST_PATH}/libs/signals/src/named_slot_map.cpp
${BOOST_PATH}/libs/signals/src/signal_base.cpp
${BOOST_PATH}/libs/signals/src/slot.cpp
${BOOST_PATH}/libs/signals/src/trackable.cpp
#system
${BOOST_PATH}/libs/system/src/error_code.cpp
#regex
${BOOST_PATH}/libs/regex/src/c_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/cpp_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/cregex.cpp
${BOOST_PATH}/libs/regex/src/fileiter.cpp
${BOOST_PATH}/libs/regex/src/icu.cpp
${BOOST_PATH}/libs/regex/src/instances.cpp
${BOOST_PATH}/libs/regex/src/posix_api.cpp
${BOOST_PATH}/libs/regex/src/regex.cpp
${BOOST_PATH}/libs/regex/src/regex_debug.cpp
${BOOST_PATH}/libs/regex/src/regex_raw_buffer.cpp
${BOOST_PATH}/libs/regex/src/regex_traits_defaults.cpp
${BOOST_PATH}/libs/regex/src/static_mutex.cpp
${BOOST_PATH}/libs/regex/src/usinstances.cpp
${BOOST_PATH}/libs/regex/src/w32_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/wc_regex_traits.cpp
${BOOST_PATH}/libs/regex/src/wide_posix_api.cpp
${BOOST_PATH}/libs/regex/src/winstances.cpp
#date_time
${BOOST_PATH}/libs/date_time/src/gregorian/greg_month.cpp
${BOOST_PATH}/libs/date_time/src/gregorian/greg_weekday.cpp
${BOOST_PATH}/libs/date_time/src/gregorian/date_generators.cpp
)
find_library( # Sets the name of the path variable.
z-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
z )
find_library( # Sets the name of the path variable.
GLESv2-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
GLESv2 )
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
include_directories(${BOOST_PATH})
include_directories(${LIBPNG_PATH})
include_directories(${LIBJPEG_PATH})
include_directories(${ZIP_PATH})
include_directories(${BOOST_GIL_PATH})
add_definitions(-DTARGET_ANDROID)
add_library( # Sets the name of the library.
engine
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
#testcpp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/DataTypes/DataTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/DataTypes/NewDataTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/FileUtils/FileUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/JniApi/JniApi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/JniApi/JniApplication.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/Console/Console.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/SerializeInterface/SerializeInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/Network/Network.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/PngHelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/JpegHelper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/TgaLoader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/SimpleTimer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Utils/ThreadUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/TextureManager/SalmonTexture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ShaderManager/ShaderManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/FrameManager/FrameManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/LightManager/LightManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SoundManager/SoundManagerAndroid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SoundManager/SoundManagerDataTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/FontManager/FontManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ScriptManager/ScriptManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SmartValueManager/SmartValueManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/GUIManager/GUIManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/GUIManager/ButtonWidget.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/GUIManager/WidgetXmlParsers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/HalibutAnimation/HalibutAnimation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ModelManager/ModelManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ModelManager/NewModelManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SimpleLand/SimpleLand.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/PhysicsManager/PhysicsManager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/RenderMisc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/RenderParams.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/BackgroundCubemap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/SalmonRenderInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/SalmonRenderGLES20.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/SalmonRenderAndroid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Render/SalmonRender/Cameras.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/Animation/SalmonAnimation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SalmonEngineAndroid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../src/SalmonEngineInterface.cpp
)
target_link_libraries(engine
${z-lib}
${log-lib}
${GLESv2-lib}
png
zip
boost
jpeg
ogg
vorbis
)

View File

@ -0,0 +1,38 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions -Wno-c++11-narrowing"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}

17
SalmonEngineAndroid/app/proguard-rules.pro vendored Executable file
View File

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,26 @@
package fishrungames.salmonengineandroid;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("fishrungames.salmonengineandroid", appContext.getPackageName());
}
}

View File

@ -0,0 +1,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fishrungames.salmonengineandroid">
<application android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:screenOrientation="landscape"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</application>
<uses-feature android:glEsVersion="0x00020000"/>
</manifest>

View File

@ -0,0 +1,3 @@
#include <jni.h>
#include <string>

View File

@ -0,0 +1,448 @@
package fishrungames.salmonengineandroid;
import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.opengl.GLSurfaceView;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.GestureDetector.SimpleOnGestureListener;
//import android.net.Uri;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
public class EngineWrapper {
static class CustomGestureListener extends SimpleOnGestureListener
{
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY)
{
EngineWrapper.OnFling(velocityX, velocityY, e2.getEventTime());
return true;
}
}
static class JniDestroyRunnable implements Runnable
{
public void run()
{
EngineWrapper.Destroy();
}
}
static ContextWrapper Instance = null;
static Map<String, Integer> FileMap = new HashMap<String, Integer>();
static Map<String, Integer> SoundMap = new HashMap<String, Integer>();
static Context context;
static SoundPool soundPool;
static MediaPlayer mp;
static GLSurfaceView mView;
static GestureDetector customGestureDetector = new GestureDetector(new CustomGestureListener());
public static void SetActivityInstance(ContextWrapper inst)
{
Instance = inst;
context = Instance.getBaseContext();
soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
mp = new MediaPlayer();
}
public static void SetView(GLSurfaceView view)
{
mView = view;
}
public static String GetApplicationDir()
{
return Instance.getFilesDir().getPath();
}
public static void AddToFileMap(String s, Integer i)
{
FileMap.put(s, i);
}
public synchronized static int OpenFile(String fileName)
{
String newFileName;
int i = fileName.lastIndexOf(".");
if (i == -1)
{
newFileName = fileName;
}
else
{
newFileName = fileName.substring(0, i);
}
if (!FileMap.containsKey(newFileName))
{
return 0;
}
Integer id = FileMap.get(newFileName);
try
{
InputStream is = Instance.getResources().openRawResource(id);
byte[] buffer = new byte[256];
int bytesRead;
CreateFile(is.available());
while ((bytesRead = is.read(buffer, 0, 256)) != -1)
{
WriteToFile(buffer, bytesRead);
}
} catch (Throwable t) {
ConsoleOut("Exception in FileWrapper::OpenFile!\n");
return 0;
}
return 1;
}
public static native void SetupEnviroment();
public static native void SetupApkFilePath(String s);
public static native void ConsoleOut(String s);
public static native void CreateFile(int fileSize);
public static native void WriteToFile(byte [] buffer, int bufferSize);
public static void LoadSound(String soundFileName)
{
if (SoundMap.containsKey(soundFileName))
{
return;
}
/*
String newFileName;
int i = soundFileName.lastIndexOf(".");
if (i == -1)
{
newFileName = soundFileName;
}
else
{
newFileName = soundFileName.substring(0, i);
}*/
//int soundId = soundPool.load(context, FileMap.get(newFileName), 1);
AssetFileDescriptor afd = null;
try
{
afd = Instance.getAssets().openFd(soundFileName);
} catch (IOException e)
{
e.printStackTrace();
}
int soundId = soundPool.load(afd, 1);
SoundMap.put(soundFileName, soundId);
}
public static void ReleaseAllSoundsAndMusic()
{
mp.stop();
mp.reset();
//soundPool.autoPause();
Enumeration<Integer> i = Collections.enumeration(SoundMap.values());
while(i.hasMoreElements())
{
soundPool.stop(i.nextElement());
}
SoundMap.clear();
}
public static void PauseAllSoundsAndMusic()
{
//NIU right now
soundPool.autoPause();
mp.pause();
}
public static void ResumeAllSoundsAndMusic()
{
//NIU right now
soundPool.autoResume();
mp.start();
}
public static void StopMusic()
{
mp.stop();
mp.reset();
}
public static void PlayMusic(String musicFileName)
{
InnerPlayMusic(musicFileName, false);
}
public static void PlayMusicLooped(String musicFileName)
{
InnerPlayMusic(musicFileName, true);
}
private static void InnerPlayMusic(String musicFileName, boolean looped)
{
/*
String newFileName;
int i = musicFileName.lastIndexOf(".");
if (i == -1)
{
newFileName = musicFileName;
}
else
{
newFileName = musicFileName.substring(0, i);
}
*/
try
{
//Uri path = Uri.parse("android.resource://"+Instance.getPackageName()+"/assets/"+newFileName);
AssetFileDescriptor afd = null;
try
{
afd = Instance.getAssets().openFd(musicFileName);
} catch (IOException e)
{
e.printStackTrace();
}
//mp.setDataSource(context, path);
mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
mp.prepare();
mp.setLooping(looped);
mp.start();
} catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void PlaySound(String soundFileName)
{
if (!SoundMap.containsKey(soundFileName))
{
return;
}
int soundId = SoundMap.get(soundFileName);
soundPool.play(soundId, 1,1,1,0,1);
}
public static void LoadSalmonEngineLibrary()
{
System.loadLibrary("engine");
}
static
{
//System.loadLibrary("gnustl_shared");
}
//Application methods
public static native void Update(long dt);
public static native void Destroy();
public static native int IsInited();
public static native void OnTapDown(float x, float y, long time);
public static native void OnTapUp(float x, float y, long time);
public static native void OnTapUpAfterMove(float x, float y, long time);
public static native void OnTapMove(float x, float y, long time);
public static native void OnFling(float velocityX, float velocityY, long time);
public static native void OnScroll(float distanceX, float distanceY, long time);
public static native void OnKeyPress(int keyCode);
public static void CallDestroy()
{
mView.queueEvent(new JniDestroyRunnable());
}
public static void ProcessKeyDown(int keyCode, KeyEvent event)
{
int ascii_keycode = keyCode;
if (keyCode == KeyEvent.KEYCODE_DEL)
{
ascii_keycode = 8; //Hack - getUnicodeChar does not recognize backspace
}
else
{
ascii_keycode = event.getUnicodeChar();
}
OnKeyPress(ascii_keycode);
}
static boolean IsScrolling = false;
static float PrevMovePosX = 0;
static float PrevMovePosY = 0;
static boolean EnableFlingGesture = false;
public static void ProcessTouchEvent(MotionEvent event)
{
if (EnableFlingGesture)
{
if (customGestureDetector.onTouchEvent(event))
{
return;
}
}
if (event.getAction() == MotionEvent.ACTION_MOVE)
{
float x = event.getX();
float y = (float) mView.getHeight() - event.getY();
float oldX = PrevMovePosX;
float oldY = (float) mView.getHeight() - PrevMovePosY;
float shiftX = x - oldX;
float shiftY = y - oldY;
if (Math.abs(shiftX) > 0.001f || Math.abs(shiftY) > 0.001f)
{
OnScroll(-shiftX, -shiftY, event.getEventTime());
}
PrevMovePosX = event.getX();
PrevMovePosY = event.getY();
IsScrolling = true;
}
if (event.getAction() == MotionEvent.ACTION_UP)
{
float x = event.getX();
float y = (float) mView.getHeight() - event.getY();
if (IsScrolling)
{
IsScrolling = false;
OnTapUpAfterMove(x, y, event.getEventTime());
}
else
{
OnTapUp(x, y, event.getEventTime());
}
}
if (event.getAction() == MotionEvent.ACTION_DOWN)
{
float x = event.getX();
float y = (float) mView.getHeight() - event.getY();
PrevMovePosX = event.getX();
PrevMovePosY = event.getY();
OnTapDown(x, y, event.getEventTime());
}
}
}

View File

@ -0,0 +1,289 @@
package fishrungames.salmonengineandroid;
import android.content.Context;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.util.Log;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
/*
This is a OpenGL View template. Do not change this code - derive your own class instead!!
*/
public class GLViewAncestor extends GLSurfaceView
{
private static String TAG = "GL2JNIView";
private static final boolean DEBUG = false;
public GLViewAncestor(Context context)
{
super(context);
}
public void init(boolean translucent, int depth, int stencil)
{
/*
* By default, GLSurfaceView() creates a RGB_565 opaque surface. If we
* want a translucent one, we should change the surface's format here,
* using PixelFormat.TRANSLUCENT for GL Surfaces is interpreted as any
* 32-bit surface with alpha by SurfaceFlinger.
*/
if (translucent)
{
this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
}
/*
* Setup the context factory for 2.0 rendering. See ContextFactory class
* definition below
*/
setEGLContextFactory(new ContextFactory());
/*
* We need to choose an EGLConfig that matches the format of our surface
* exactly. This is going to be done in our custom config chooser. See
* ConfigChooser class definition below.
*/
setEGLConfigChooser(translucent ? new ConfigChooser(8, 8, 8, 8, depth,
stencil) : new ConfigChooser(5, 6, 5, 0, depth, stencil));
}
private static class ContextFactory implements
GLSurfaceView.EGLContextFactory
{
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
@Override
public EGLContext createContext(EGL10 egl, EGLDisplay display,
EGLConfig eglConfig)
{
Log.w(TAG, "creating OpenGL ES 2.0 context");
checkEglError("Before eglCreateContext", egl);
int[] attrib_list =
{ EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
EGLContext context = egl.eglCreateContext(display, eglConfig,
EGL10.EGL_NO_CONTEXT, attrib_list);
checkEglError("After eglCreateContext", egl);
return context;
}
@Override
public void destroyContext(EGL10 egl, EGLDisplay display,
EGLContext context)
{
egl.eglDestroyContext(display, context);
}
}
private static void checkEglError(String prompt, EGL10 egl)
{
int error;
while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS)
{
Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
}
}
private static class ConfigChooser implements
GLSurfaceView.EGLConfigChooser
{
public ConfigChooser(int r, int g, int b, int a, int depth, int stencil)
{
mRedSize = r;
mGreenSize = g;
mBlueSize = b;
mAlphaSize = a;
mDepthSize = depth;
mStencilSize = stencil;
}
/*
* This EGL config specification is used to specify 2.0 rendering. We
* use a minimum size of 4 bits for red/green/blue, but will perform
* actual matching in chooseConfig() below.
*/
private static int EGL_OPENGL_ES2_BIT = 4;
private static int[] s_configAttribs2 =
{ EGL10.EGL_RED_SIZE, 4, EGL10.EGL_GREEN_SIZE, 4,
EGL10.EGL_BLUE_SIZE, 4, EGL10.EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT, EGL10.EGL_NONE };
@Override
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display)
{
/*
* Get the number of minimally matching EGL configurations
*/
int[] num_config = new int[1];
egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
int numConfigs = num_config[0];
if (numConfigs <= 0)
{
throw new IllegalArgumentException(
"No configs match configSpec");
}
/*
* Allocate then read the array of minimally matching EGL configs
*/
EGLConfig[] configs = new EGLConfig[numConfigs];
egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs,
num_config);
if (DEBUG)
{
printConfigs(egl, display, configs);
}
/*
* Now return the "best" one
*/
return chooseConfig(egl, display, configs);
}
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
EGLConfig[] configs)
{
for (EGLConfig config : configs)
{
int d = findConfigAttrib(egl, display, config,
EGL10.EGL_DEPTH_SIZE, 0);
int s = findConfigAttrib(egl, display, config,
EGL10.EGL_STENCIL_SIZE, 0);
// We need at least mDepthSize and mStencilSize bits
if (d < mDepthSize || s < mStencilSize)
continue;
// We want an *exact* match for red/green/blue/alpha
int r = findConfigAttrib(egl, display, config,
EGL10.EGL_RED_SIZE, 0);
int g = findConfigAttrib(egl, display, config,
EGL10.EGL_GREEN_SIZE, 0);
int b = findConfigAttrib(egl, display, config,
EGL10.EGL_BLUE_SIZE, 0);
int a = findConfigAttrib(egl, display, config,
EGL10.EGL_ALPHA_SIZE, 0);
if (r == mRedSize && g == mGreenSize && b == mBlueSize
&& a == mAlphaSize)
return config;
}
return null;
}
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
EGLConfig config, int attribute, int defaultValue)
{
if (egl.eglGetConfigAttrib(display, config, attribute, mValue))
{
return mValue[0];
}
return defaultValue;
}
private void printConfigs(EGL10 egl, EGLDisplay display,
EGLConfig[] configs)
{
int numConfigs = configs.length;
Log.w(TAG, String.format("%d configurations", numConfigs));
for (int i = 0; i < numConfigs; i++)
{
Log.w(TAG, String.format("Configuration %d:\n", i));
printConfig(egl, display, configs[i]);
}
}
private void printConfig(EGL10 egl, EGLDisplay display, EGLConfig config)
{
int[] attributes =
{
EGL10.EGL_BUFFER_SIZE,
EGL10.EGL_ALPHA_SIZE,
EGL10.EGL_BLUE_SIZE,
EGL10.EGL_GREEN_SIZE,
EGL10.EGL_RED_SIZE,
EGL10.EGL_DEPTH_SIZE,
EGL10.EGL_STENCIL_SIZE,
EGL10.EGL_CONFIG_CAVEAT,
EGL10.EGL_CONFIG_ID,
EGL10.EGL_LEVEL,
EGL10.EGL_MAX_PBUFFER_HEIGHT,
EGL10.EGL_MAX_PBUFFER_PIXELS,
EGL10.EGL_MAX_PBUFFER_WIDTH,
EGL10.EGL_NATIVE_RENDERABLE,
EGL10.EGL_NATIVE_VISUAL_ID,
EGL10.EGL_NATIVE_VISUAL_TYPE,
0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
EGL10.EGL_SAMPLES,
EGL10.EGL_SAMPLE_BUFFERS,
EGL10.EGL_SURFACE_TYPE,
EGL10.EGL_TRANSPARENT_TYPE,
EGL10.EGL_TRANSPARENT_RED_VALUE,
EGL10.EGL_TRANSPARENT_GREEN_VALUE,
EGL10.EGL_TRANSPARENT_BLUE_VALUE,
0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
EGL10.EGL_LUMINANCE_SIZE, EGL10.EGL_ALPHA_MASK_SIZE,
EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RENDERABLE_TYPE,
0x3042 // EGL10.EGL_CONFORMANT
};
String[] names =
{ "EGL_BUFFER_SIZE", "EGL_ALPHA_SIZE", "EGL_BLUE_SIZE",
"EGL_GREEN_SIZE", "EGL_RED_SIZE", "EGL_DEPTH_SIZE",
"EGL_STENCIL_SIZE", "EGL_CONFIG_CAVEAT",
"EGL_CONFIG_ID", "EGL_LEVEL", "EGL_MAX_PBUFFER_HEIGHT",
"EGL_MAX_PBUFFER_PIXELS", "EGL_MAX_PBUFFER_WIDTH",
"EGL_NATIVE_RENDERABLE", "EGL_NATIVE_VISUAL_ID",
"EGL_NATIVE_VISUAL_TYPE", "EGL_PRESERVED_RESOURCES",
"EGL_SAMPLES", "EGL_SAMPLE_BUFFERS",
"EGL_SURFACE_TYPE", "EGL_TRANSPARENT_TYPE",
"EGL_TRANSPARENT_RED_VALUE",
"EGL_TRANSPARENT_GREEN_VALUE",
"EGL_TRANSPARENT_BLUE_VALUE",
"EGL_BIND_TO_TEXTURE_RGB", "EGL_BIND_TO_TEXTURE_RGBA",
"EGL_MIN_SWAP_INTERVAL", "EGL_MAX_SWAP_INTERVAL",
"EGL_LUMINANCE_SIZE", "EGL_ALPHA_MASK_SIZE",
"EGL_COLOR_BUFFER_TYPE", "EGL_RENDERABLE_TYPE",
"EGL_CONFORMANT" };
int[] value = new int[1];
for (int i = 0; i < attributes.length; i++)
{
int attribute = attributes[i];
String name = names[i];
if (egl.eglGetConfigAttrib(display, config, attribute, value))
{
Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
} else
{
// Log.w(TAG, String.format(" %s: failed\n", name));
while (egl.eglGetError() != EGL10.EGL_SUCCESS)
;
}
}
}
// Subclasses can adjust these values:
protected int mRedSize;
protected int mGreenSize;
protected int mBlueSize;
protected int mAlphaSize;
protected int mDepthSize;
protected int mStencilSize;
private int[] mValue = new int[1];
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">SalmonEngineAndroid</string>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>

View File

@ -0,0 +1,17 @@
package fishrungames.salmonengineandroid;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

View File

@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

160
SalmonEngineAndroid/gradlew vendored Executable file
View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# 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
;;
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"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
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
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" ;;
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"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
SalmonEngineAndroid/gradlew.bat vendored Executable file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@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=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@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
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
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%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="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
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1 @@
include ':app'

26
include/ScriptManager/ScriptManager.h Normal file → Executable file
View File

@ -1,10 +1,12 @@
#ifndef SCRIPT_MANAGER_H_INCLUDED #ifndef SCRIPT_MANAGER_H_INCLUDED
#define SCRIPT_MANAGER_H_INCLUDED #define SCRIPT_MANAGER_H_INCLUDED
#include "sqplus.h" //#include "sqplus.h"
#include <iostream> #include <iostream>
#include <string> #include <string>
typedef char SQChar;
namespace SE namespace SE
{ {
@ -30,6 +32,7 @@ struct TScriptInfo
}; };
class TFunctionBinderInterface class TFunctionBinderInterface
{ {
public: public:
@ -47,9 +50,9 @@ public:
class TScriptManager : public TSerializeInterface class TScriptManager : public TSerializeInterface
{ {
protected: protected:
HSQUIRRELVM virtualMachine; //HSQUIRRELVM virtualMachine;
std::map<std::string, TScriptInfo> FuncInfoMap; //std::map<std::string, TScriptInfo> FuncInfoMap;
/*
template<typename T1,typename T2> template<typename T1,typename T2>
void RegisterFunc(T1& object, T2 method, const std::string& funcName) void RegisterFunc(T1& object, T2 method, const std::string& funcName)
{ {
@ -60,7 +63,7 @@ protected:
void RegisterFunc(T globalFunc, const std::string& funcName) void RegisterFunc(T globalFunc, const std::string& funcName)
{ {
SqPlus::RegisterGlobal(virtualMachine, globalFunc, _SC(funcName.c_str())); SqPlus::RegisterGlobal(virtualMachine, globalFunc, _SC(funcName.c_str()));
} }*/
public: public:
TScriptManager(); TScriptManager();
@ -75,20 +78,21 @@ public:
template<typename T1, typename T2> template<typename T1, typename T2>
void AddFunction(const std::string& shortName, TScriptInfo scriptInfo, T1& object, T2 method) void AddFunction(const std::string& shortName, TScriptInfo scriptInfo, T1& object, T2 method)
{ {
/*
AddFuncDescription(shortName, scriptInfo); AddFuncDescription(shortName, scriptInfo);
RegisterFunc(object, method, shortName); RegisterFunc(object, method, shortName);
RegisterFunc(object, method, scriptInfo.LongName); RegisterFunc(object, method, scriptInfo.LongName);
FuncInfoMap[shortName].Registered = true; FuncInfoMap[shortName].Registered = true;*/
} }
template<typename T> template<typename T>
void AddFunction(const std::string& shortName, TScriptInfo scriptInfo, T globalFunc) void AddFunction(const std::string& shortName, TScriptInfo scriptInfo, T globalFunc)
{ {
AddFuncDescription(shortName, scriptInfo); /*AddFuncDescription(shortName, scriptInfo);
RegisterFunc(globalFunc, shortName); RegisterFunc(globalFunc, shortName);
RegisterFunc(globalFunc, scriptInfo.LongName); RegisterFunc(globalFunc, scriptInfo.LongName);
FuncInfoMap[shortName].Registered = true; FuncInfoMap[shortName].Registered = true;*/
} }
void BindFunctionsFromObject(TFunctionBinderInterface* binderObject); void BindFunctionsFromObject(TFunctionBinderInterface* binderObject);
@ -103,9 +107,9 @@ public:
void SQ_Print(const SQChar *inString); //void SQ_Print(const SQChar *inString);
void SQ_PrintWidgetList(); //void SQ_PrintWidgetList();
void SQ_MoveWidget(const SQChar *widgetName, float x, float y); //void SQ_MoveWidget(const SQChar *widgetName, float x, float y);
//void SQ_PrintTextureList(); //void SQ_PrintTextureList();
//void SQ_PrintAnimationList(); //void SQ_PrintAnimationList();

4
include/SoundManager/SoundManagerDataTypes.h Normal file → Executable file
View File

@ -5,8 +5,8 @@
#ifdef TARGET_ANDROID #ifdef TARGET_ANDROID
#include <asm/page.h> //#include <asm/page.h>
#include <limits.h> //#include <limits.h>
#endif #endif
#include "boost/thread.hpp" #include "boost/thread.hpp"

4
include/Utils/Console/Console.h Normal file → Executable file
View File

@ -20,8 +20,8 @@ Use global variable Console like that:
#include <fstream> #include <fstream>
#endif #endif
#ifdef TARGET_ANDROID #ifdef TARGET_ANDROID
#include <asm/page.h> //#include <asm/page.h>
#include <limits.h> //#include <limits.h>
#include "boost/thread.hpp" #include "boost/thread.hpp"
#endif #endif

24
include/Utils/JniApi/JniApi.h Normal file → Executable file
View File

@ -12,6 +12,18 @@
#include <zlib.h> #include <zlib.h>
#include <zconf.h> #include <zconf.h>
extern "C" {
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_SetupEnviroment(JNIEnv* env, jobject thiz);
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_SetupApkFilePath(JNIEnv* env, jobject thiz, jstring s);
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_ConsoleOut(JNIEnv* env, jobject thiz, jstring s);
//All 2 deprecated
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_CreateFile(JNIEnv* env, jobject thiz, int fileSize);
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_WriteToFile(JNIEnv* env, jobject thiz, jbyteArray buffer, int bufferSize);
};
namespace SE namespace SE
{ {
@ -35,17 +47,7 @@ extern cardinal* FileArr;
extern int FileSize; extern int FileSize;
extern std::string ApkFilePath; extern std::string ApkFilePath;
extern "C" {
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_SetupEnviroment(JNIEnv* env, jobject thiz);
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_SetupApkFilePath(JNIEnv* env, jobject thiz, jstring s);
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_ConsoleOut(JNIEnv* env, jobject thiz, jstring s);
//All 2 deprecated
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_CreateFile(JNIEnv* env, jobject thiz, int fileSize);
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_WriteToFile(JNIEnv* env, jobject thiz, jbyteArray buffer, int bufferSize);
};
//Deprecated //Deprecated
void JniCallOpenFile(const std::string& fileName); void JniCallOpenFile(const std::string& fileName);

View File

@ -10,9 +10,9 @@ std::vector<TFunctionBinderInterface*> TFunctionBinderInterface::BinderList;
TScriptManager::TScriptManager() TScriptManager::TScriptManager()
{ {
SquirrelVM::Init(); //SquirrelVM::Init();
virtualMachine = SquirrelVM::GetVMPtr(); //virtualMachine = SquirrelVM::GetVMPtr();
//SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("Print")); //SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("Print"));
//SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("p")); //SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("p"));
@ -58,11 +58,12 @@ TScriptManager::TScriptManager()
TScriptManager::~TScriptManager() TScriptManager::~TScriptManager()
{ {
*Console<<"Script manager shutdown"; *Console<<"Script manager shutdown";
SquirrelVM::Shutdown(); //SquirrelVM::Shutdown();
} }
void TScriptManager::RunScript(const std::string& scriptCode) void TScriptManager::RunScript(const std::string& scriptCode)
{ {
/*
try try
{ {
SquirrelObject m = SquirrelVM::CompileBuffer(_T(scriptCode.c_str())); SquirrelObject m = SquirrelVM::CompileBuffer(_T(scriptCode.c_str()));
@ -73,13 +74,14 @@ void TScriptManager::RunScript(const std::string& scriptCode)
{ {
*Console<<"Script failed to run"; *Console<<"Script failed to run";
} }
*/
} }
void TScriptManager::BindBasicFunctions() void TScriptManager::BindBasicFunctions()
{ {
//Hack =D //Hack =D
/*
static bool alreadyBind = false; static bool alreadyBind = false;
if (!alreadyBind) if (!alreadyBind)
@ -103,7 +105,7 @@ void TScriptManager::BindBasicFunctions()
alreadyBind = true; alreadyBind = true;
} }
*/
} }
@ -111,13 +113,14 @@ void TScriptManager::BindBasicFunctions()
void TScriptManager::AddFuncDescription(const std::string& shortName, TScriptInfo scriptInfo) void TScriptManager::AddFuncDescription(const std::string& shortName, TScriptInfo scriptInfo)
{ {
/*
if (FuncInfoMap.count(shortName) > 0) if (FuncInfoMap.count(shortName) > 0)
{ {
//If this description is already exists //If this description is already exists
scriptInfo.Registered = FuncInfoMap[shortName].Registered; scriptInfo.Registered = FuncInfoMap[shortName].Registered;
} }
FuncInfoMap[shortName] = scriptInfo; FuncInfoMap[shortName] = scriptInfo;*/
} }
@ -125,12 +128,13 @@ void TScriptManager::AddFuncDescription(const std::string& shortName, TScriptInf
void TScriptManager::BindFunctionsFromObject(TFunctionBinderInterface* binderObject) void TScriptManager::BindFunctionsFromObject(TFunctionBinderInterface* binderObject)
{ {
binderObject->BindFunctions(); //binderObject->BindFunctions();
} }
void TScriptManager::PrintRegisteredFunctionList() void TScriptManager::PrintRegisteredFunctionList()
{ {
/*
std::map<std::string, TScriptInfo>::iterator i; std::map<std::string, TScriptInfo>::iterator i;
Console->PrintImmediate("========== Console function list ==========="); Console->PrintImmediate("========== Console function list ===========");
@ -141,20 +145,21 @@ void TScriptManager::PrintRegisteredFunctionList()
{ {
Console->PrintImmediate(i->first + " | " + i->second.ShortDescription); Console->PrintImmediate(i->first + " | " + i->second.ShortDescription);
} }
} }*/
} }
void TScriptManager::PrintFunctionInfo(const std::string& funcName) void TScriptManager::PrintFunctionInfo(const std::string& funcName)
{ {
/*
if (FuncInfoMap.count(funcName) > 0 && FuncInfoMap[funcName].Registered) if (FuncInfoMap.count(funcName) > 0 && FuncInfoMap[funcName].Registered)
{ {
Console->PrintImmediate( funcName + " | " + FuncInfoMap[funcName].LongName + " | " + FuncInfoMap[funcName].Description); Console->PrintImmediate( funcName + " | " + FuncInfoMap[funcName].LongName + " | " + FuncInfoMap[funcName].Description);
} }*/
} }
void TScriptManager::Serialize(boost::property_tree::ptree& propertyTree) void TScriptManager::Serialize(boost::property_tree::ptree& propertyTree)
{ {
/*
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, propertyTree.get_child("FunctionInfoList")) BOOST_FOREACH(boost::property_tree::ptree::value_type &v, propertyTree.get_child("FunctionInfoList"))
{ {
std::string shortName = v.second.get<std::string>("ShortName"); std::string shortName = v.second.get<std::string>("ShortName");
@ -163,20 +168,19 @@ void TScriptManager::Serialize(boost::property_tree::ptree& propertyTree)
std::string description = v.second.get<std::string>("Description"); std::string description = v.second.get<std::string>("Description");
AddFuncDescription(shortName, TScriptInfo(longName, shortDescription, description)); AddFuncDescription(shortName, TScriptInfo(longName, shortDescription, description));
} }*/
} }
//============================================= //=============================================
//============= Typical commands ============== //============= Typical commands ==============
//============================================= //=============================================
/*
void SQ_Print(const SQChar *inString) void SQ_Print(const SQChar *inString)
{ {
Console->PrintImmediate(std::string(inString)); Console->PrintImmediate(std::string(inString));
} }
/*
void SQ_PrintWidgetList() void SQ_PrintWidgetList()
{ {
ResourceManager->GUIManager.PrintWidgetList(); ResourceManager->GUIManager.PrintWidgetList();

0
src/TextureManager/SalmonTexture.cpp Normal file → Executable file
View File

12
src/Utils/Console/Console.cpp Normal file → Executable file
View File

@ -1,6 +1,13 @@
#include "include/Engine.h" #include "include/Engine.h"
#include "boost/date_time.hpp" #include "boost/date_time.hpp"
#ifdef TARGET_ANDROID
#include <android/log.h>
#define APPNAME "SalmonEngine"
#endif
namespace SE namespace SE
{ {
@ -225,6 +232,11 @@ TJavaConsole& TJavaConsole::operator<<(const std::string& s)
History += string_with_time_mark+endl; History += string_with_time_mark+endl;
CutHistory(); CutHistory();
__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "%s", string_with_time_mark.c_str());
return *this; return *this;

35
src/Utils/JniApi/JniApi.cpp Normal file → Executable file
View File

@ -7,7 +7,7 @@ namespace SE
JavaVM* JavaVirtualMachine = 0; JavaVM* JavaVirtualMachine = 0;
const std::string CONST_JAVA_FILESYSTEM_CLASS_NAME = "fishrungames/engine/EngineWrapper"; const std::string CONST_JAVA_FILESYSTEM_CLASS_NAME = "fishrungames/salmonengineandroid/EngineWrapper";
//Private data //Private data
@ -26,36 +26,37 @@ void CheckCommonExceptionWithMessage(const std::string& message);
//Deprecated //Deprecated
void JniCallOpenFile(const std::string& fileName); void JniCallOpenFile(const std::string& fileName);
}
//================================================== //==================================================
//=============== IMPLEMENTATION =================== //=============== IMPLEMENTATION ===================
//================================================== //==================================================
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_SetupEnviroment(JNIEnv* env, jobject thiz) extern "C" void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_SetupEnviroment(JNIEnv* env, jobject thiz)
{ {
int JVMResult; int JVMResult;
JVMResult = env->GetJavaVM(&JavaVirtualMachine); JVMResult = env->GetJavaVM(&SE::JavaVirtualMachine);
//TODO: Check if jmvresult != 0 //TODO: Check if jmvresult != 0
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_SetupApkFilePath(JNIEnv* env, jobject thiz, jstring s) extern "C" void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_SetupApkFilePath(JNIEnv* env, jobject thiz, jstring s)
{ {
const char *nativeString = env->GetStringUTFChars(s, 0); const char *nativeString = env->GetStringUTFChars(s, 0);
ApkFilePath = std::string(nativeString); SE::ApkFilePath = std::string(nativeString);
env->ReleaseStringUTFChars(s, nativeString); env->ReleaseStringUTFChars(s, nativeString);
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_ConsoleOut(JNIEnv* env, jobject thiz, jstring s) extern "C" void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_ConsoleOut(JNIEnv* env, jobject thiz, jstring s)
{ {
const char *nativeString = env->GetStringUTFChars(s, 0); const char *nativeString = env->GetStringUTFChars(s, 0);
*Console<<std::string("OUT OF JAVA: ")+nativeString; *SE::Console<<std::string("OUT OF JAVA: ")+nativeString;
env->ReleaseStringUTFChars(s, nativeString); env->ReleaseStringUTFChars(s, nativeString);
@ -63,21 +64,21 @@ JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_ConsoleOut(JNIEnv*
//Deprecated //Deprecated
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_CreateFile(JNIEnv* env, jobject thiz, int fileSize) extern "C" void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_CreateFile(JNIEnv* env, jobject thiz, int fileSize)
{ {
FileSize = fileSize; SE::FileSize = fileSize;
FileArr = new cardinal [fileSize % 4 == 0 ? fileSize/4 : fileSize/4 + 1]; SE::FileArr = new SE::cardinal [fileSize % 4 == 0 ? fileSize/4 : fileSize/4 + 1];
filePointer = 0; SE::filePointer = 0;
} }
//Deprecated //Deprecated
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_WriteToFile(JNIEnv* env, jobject thiz, jbyteArray buffer, int bufferSize) extern "C" void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_WriteToFile(JNIEnv* env, jobject thiz, jbyteArray buffer, int bufferSize)
{ {
JNIEnv* jenv; JNIEnv* jenv;
JavaVirtualMachine->GetEnv((void**)&jenv, JNI_VERSION_1_4); SE::JavaVirtualMachine->GetEnv((void**)&jenv, JNI_VERSION_1_4);
jenv->GetByteArrayRegion(buffer, 0, bufferSize, (jbyte*)((char*)FileArr + filePointer)); jenv->GetByteArrayRegion(buffer, 0, bufferSize, (jbyte*)((char*)SE::FileArr + SE::filePointer));
filePointer += bufferSize; SE::filePointer += bufferSize;
} }
@ -85,6 +86,10 @@ JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_WriteToFile(JNIEnv
//============== Private methods ==================== //============== Private methods ====================
//=================================================== //===================================================
namespace SE
{
jclass JniTryFindClass(const std::string& className) jclass JniTryFindClass(const std::string& className)
{ {

131
src/Utils/JniApi/JniApplication.cpp Normal file → Executable file
View File

@ -1,25 +1,25 @@
#include "include/Engine.h" #include "include/Engine.h"
namespace SE namespace SE {
TApplication *App = NULL;
boost::mutex InitLock;
bool Inited = false;
} // namespace SE
extern "C"
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_Update(JNIEnv * env, jobject obj, long dt)
{ {
SE::InitLock.lock();
TApplication* App = NULL;
boost::mutex InitLock;
bool Inited = false;
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_Update(JNIEnv * env, jobject obj, long dt)
{
InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OuterDraw(); SE::App->OuterDraw();
App->OuterUpdate(dt); SE::App->OuterUpdate(dt);
} }
@ -28,13 +28,14 @@ JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_Update(JNIEnv * en
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
JNIEXPORT int JNICALL Java_fishrungames_engine_EngineWrapper_IsInited(JNIEnv * env, jobject obj) extern "C"
JNIEXPORT int JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_IsInited(JNIEnv * env, jobject obj)
{ {
if (Inited) if (SE::Inited)
{ {
return 1; return 1;
} }
@ -45,23 +46,23 @@ JNIEXPORT int JNICALL Java_fishrungames_engine_EngineWrapper_IsInited(JNIEnv * e
} }
extern "C"
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_Destroy(JNIEnv * env, jobject obj) JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_Destroy(JNIEnv * env, jobject obj)
{ {
InitLock.lock(); SE::InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OuterDeinit(); SE::App->OuterDeinit();
delete App; delete SE::App;
App = NULL; SE::App = NULL;
DestroyEngine();
Inited = false; SE::DestroyEngine();
SE::Inited = false;
} }
} }
@ -69,7 +70,7 @@ JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_Destroy(JNIEnv * e
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
void DestroyThreaded() void DestroyThreaded()
@ -77,112 +78,118 @@ void DestroyThreaded()
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_OnTapDown(JNIEnv * env, jobject obj, float x, float y, long time) extern "C"
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_OnTapDown(JNIEnv * env, jobject obj, float x, float y, long time)
{ {
InitLock.lock(); SE::InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OuterOnTapDown(vec2(x,y)); SE::App->OuterOnTapDown(SE::vec2(x,y), time);
} }
} }
catch (...) catch (...)
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
extern "C"
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_OnTapUp(JNIEnv * env, jobject obj, float x, float y, long time) JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_OnTapUp(JNIEnv * env, jobject obj, float x, float y, long time)
{ {
InitLock.lock(); SE::InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OuterOnTapUp(vec2(x,y)); SE::App->OuterOnTapUp(SE::vec2(x,y), time);
} }
} }
catch (...) catch (...)
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_OnTapUpAfterMove(JNIEnv * env, jobject obj, jfloat x, jfloat y, long time) extern "C"
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_OnTapUpAfterMove(JNIEnv * env, jobject obj, jfloat x, jfloat y, long time)
{ {
InitLock.lock(); SE::InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OuterOnTapUpAfterMove(vec2(x,y)); SE::App->OuterOnTapUpAfterMove(SE::vec2(x,y), time);
} }
} }
catch (...) catch (...)
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_OnTapMove(JNIEnv * env, jobject obj, float x, float y, long time) extern "C"
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_OnTapMove(JNIEnv * env, jobject obj, float x, float y, long time)
{ {
InitLock.lock(); SE::InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OuterOnMove(vec2(x,y)); SE::App->OuterOnMove(SE::vec2(x,y), time);
} }
} }
catch (...) catch (...)
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_OnFling(JNIEnv * env, jobject obj, jfloat velocityX, jfloat velocityY, long time) extern "C"
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_OnFling(JNIEnv * env, jobject obj, jfloat velocityX, jfloat velocityY, long time)
{ {
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_OnScroll(JNIEnv * env, jobject obj, jfloat distanceX, jfloat distanceY, long time) extern "C"
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_OnScroll(JNIEnv * env, jobject obj, jfloat distanceX, jfloat distanceY, long time)
{ {
InitLock.lock(); SE::InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OuterOnMove(vec2(distanceX,distanceY)); SE::App->OuterOnMove(SE::vec2(distanceX,distanceY), time);
} }
} }
catch (...) catch (...)
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
JNIEXPORT void JNICALL Java_fishrungames_engine_EngineWrapper_OnKeyPress(JNIEnv * env, jobject obj, jint keyCode) extern "C"
JNIEXPORT void JNICALL Java_fishrungames_salmonengineandroid_EngineWrapper_OnKeyPress(JNIEnv * env, jobject obj, jint keyCode)
{ {
InitLock.lock(); SE::InitLock.lock();
try try
{ {
if (Inited) if (SE::Inited)
{ {
App->OnKeyPress(keyCode); SE::App->OnKeyPress(keyCode);
} }
} }
catch (...) catch (...)
{ {
throw; throw;
} }
InitLock.unlock(); SE::InitLock.unlock();
} }
} // namespace SE

0
src/Utils/JpegHelper.cpp Normal file → Executable file
View File