diff --git a/.classpath b/.classpath deleted file mode 100644 index 5bdb3d8..0000000 --- a/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index d1ffe54..0000000 --- a/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - SLWP - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/jni/Android.mk b/jni/Android.mk deleted file mode 100644 index caf8206..0000000 --- a/jni/Android.mk +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2009 The Android Open Source Project -# -# 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 -# -# http://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. -# - - -LPATH := $(call my-dir) - -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 - -ZIP_PATH = $(LibsPathCygwin)/julienr-libzip-android/jni - -#====== ENGINE AND LIBS ===================== - -include $(ENGINE_PATH)/Android_Salmon_Engine.mk - -#================= THE GAME ======================= - - -LOCAL_PATH:= $(LPATH) - -include $(CLEAR_VARS) - -LOCAL_CFLAGS := -DTARGET_ANDROID -DNOSOUND -std=gnu++11 --std=c++11 -LOCAL_STATIC_LIBRARIES := boost -LOCAL_STATIC_LIBRARIES += squirrel -LOCAL_STATIC_LIBRARIES += png_lib -LOCAL_STATIC_LIBRARIES += zip -LOCAL_SHARED_LIBRARIES := SalmonEngine -LOCAL_SHARED_LIBRARIES += gnustl_shared -LOCAL_C_INCLUDES := $(ENGINE_PATH) -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)/squirrel -LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/sqstdlib -LOCAL_C_INCLUDES += $(LIBPNG_PATH) -LOCAL_C_INCLUDES += $(ZIP_PATH) -LOCAL_MODULE := SalmonWallpaper -LOCAL_SRC_FILES := main_code.cpp -LOCAL_SRC_FILES += android_api.cpp - -LOCAL_LDLIBS := -lGLESv2 -LOCAL_LDLIBS += -llog -Wl - -#debug -#LOCAL_CFLAGS += -g -ggdb -O0 -#LOCAL_LDLIBS += -g -ggdb - -include $(BUILD_SHARED_LIBRARY) diff --git a/jni/Application.mk b/jni/Application.mk deleted file mode 100644 index b096c4c..0000000 --- a/jni/Application.mk +++ /dev/null @@ -1,3 +0,0 @@ -APP_STL := gnustl_shared -APP_CPPFLAGS += -fexceptions -APP_CPPFLAGS += -frtti \ No newline at end of file diff --git a/jni/android_api.cpp b/jni/android_api.cpp deleted file mode 100644 index e154036..0000000 --- a/jni/android_api.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "android_api.h" - -#include "main_code.h" -#include "boost\thread.hpp" - -TAndroidApplication* Application = NULL; - - -float lastOffsetX = 0.5f; - -const float CONST_ANGLE_SHIFT = 45.f; - -int TimeOfDayPref = 0; -bool SnowPref = false; - -bool OffsetChanged = false; - -JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetTimeOfDayPref(JNIEnv * env, jobject obj, jint timeofday) -{ - TimeOfDayPref = timeofday; -} -JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetSnowPref(JNIEnv * env, jobject obj, jboolean snow) -{ - SnowPref = snow; -} - -JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height) -{ - - Application = JniInitApp(width, height, 800.f, 480.f); - - boost::get(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f); - Application->SkyTexShift = lastOffsetX*0.01f; - - -} - - -JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetOffset(JNIEnv * env, jobject obj, jfloat offsetX, jfloat offsetY) -{ - - if (Renderer != NULL) - { - OffsetChanged = true; - Application->SkyTexShift = offsetX*0.01f; - lastOffsetX = offsetX; - boost::get(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f); - } -} diff --git a/jni/android_api.h b/jni/android_api.h deleted file mode 100644 index 117ed80..0000000 --- a/jni/android_api.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef ANDROID_API_H_INCLUDED -#define ANDROID_API_H_INCLUDED - -#include -#include - -#include -#include -#include - -#include "boost/shared_ptr.hpp" - -#include "main_code.h" - -using namespace SE; - -extern "C" { - - JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetTimeOfDayPref(JNIEnv * env, jobject obj, jint timeofday); - - JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetSnowPref(JNIEnv * env, jobject obj, jboolean snow); - - JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height); - - JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetOffset(JNIEnv * env, jobject obj, jfloat offsetX, jfloat offsetY); - - }; - - -#endif diff --git a/jni/main_code.cpp b/jni/main_code.cpp deleted file mode 100644 index aa5c306..0000000 --- a/jni/main_code.cpp +++ /dev/null @@ -1,550 +0,0 @@ -#include "main_code.h" -#ifdef TARGET_ANDROID -#include "android_api.h" -#endif -#include -#include -#include -#include - -#include "include/Engine.h" - -#include "main_code.h" - -bool makeShot = true; - - -extern int TimeOfDayPref; -extern bool SnowPref; - -extern float lastOffsetX; - -#ifdef TARGET_WIN32 -int TimeOfDayPref = 0; -bool SnowPref = false; - -#else -extern int TimeOfDayPref; -extern bool SnowPref; - -#endif - - -boost::mutex m2; - - -class LoadingQueueVisitor : public boost::static_visitor -{ -public: - void operator()(boost::function f) const - { - f(); - } - - void operator()(boost::function f) const - { - f(); - } - - void operator()(boost::function f) const - { - f(); - } -}; - -TAndroidApplication::TAndroidApplication() - : TApplication() - , Inited(false) - , Loaded(false) - , LiteModel(NULL) - , WaterTimer(0) - , SnowTimer(0) - , CloudTimer(0) - , SkyTexShift(0) - , WaveDir(false) -{ -} - - -void TAndroidApplication::Serialize(boost::property_tree::ptree& propertyTree) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, propertyTree.get_child("Ices")) - { - - std::string modelName = v.second.get("ModelName"); - float posx = v.second.get("PosX"); - float posz = v.second.get("PosZ"); - - float angle = v.second.get("Angle", 0.f); - float scale = v.second.get("Scale", 1.f); - - mat3 m(vec4(0, cos(angle*pi/360.f), 0, sin(angle*pi/360.f))); - - IceModel.push_back(TLiteModel()); - IceModel[IceModel.size()-1].LoadModel(modelName); - IceModel[IceModel.size()-1].RotateModel(m); - IceModel[IceModel.size()-1].ScaleModel(scale); - IceModel[IceModel.size()-1].MoveModel(vec3(posx, 0, posz)); - - - IceModel[IceModel.size()-1].UpdateVBO(); - - - - } -} - - - -void TAndroidApplication::LoadModels() -{ - mat3 m(vec4(0,1*sin(pi/8 + pi/2),0,1*cos(pi/8 + pi/2))); - - LiteModel = new TLiteModel; - LiteModel->LoadModel("mountain.lm1"); - LiteModel->ScaleModel(0.5f); - LiteModel->RotateModel(m); - LiteModel->MoveModel(vec3(0, 0, 0)); - LiteModel->UpdateVBO(); - - std::shared_ptr p = FileToPropertyTree("ices.xml"); - - Serialize(*p); - -} - -void TAndroidApplication::AddFrameBuffers() -{ - ResourceManager->FrameManager.AddFrameRenderBuffer("WaterFrame", 256, 256); - ResourceManager->FrameManager.AddFrameRenderBuffer("ScreenshotFrame", 512, 512); - -} - -void TAndroidApplication::DrawSceneWithoutWater(bool inv) -{ - - - Renderer->PushProjectionMatrix(1,1); - Renderer->LoadIdentity(); - - if (inv) - { - - - if (TimeOfDayPref == 2) - { - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky_night.png"]); - } - else - { - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]); - } - Renderer->DrawRect(vec2(0.0f, 0.56f), vec2(1.f, 0.f), vec2(0.5f + SkyTexShift, 0.f), vec2(1.f + SkyTexShift, 1.f)); - - if (TimeOfDayPref == 1) - { - glClear(GL_DEPTH_BUFFER_BIT); - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]); - Renderer->DrawRect(vec2(0.0f, 0.56f), vec2(4.f, 0.f), vec2(0.0f + SkyTexShift + CloudTimer, 0.f), vec2(1.f + SkyTexShift + CloudTimer, 0.5f)); - } - } - else - { - if (TimeOfDayPref == 2) - { - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky_night.png"]); - } - else - { - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]); - } - Renderer->DrawRect(vec2(0.0f, 0.54f), vec2(1.f, 1.f), vec2(0.5f + SkyTexShift, 0.f), vec2(1.f + SkyTexShift, 1.f)); - - if (TimeOfDayPref == 1) - { - glClear(GL_DEPTH_BUFFER_BIT); - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]); - Renderer->DrawRect(vec2(0.0f, 0.54f), vec2(4.f, 1.f), vec2(0.0f + SkyTexShift + CloudTimer, 0.f), vec2(1.f + SkyTexShift + CloudTimer, 0.5f)); - } - } - - - - Renderer->PopProjectionMatrix(); - - glClear(GL_DEPTH_BUFFER_BIT); - Renderer->SetGLCamView(); - - if (inv) - { - Renderer->TranslateMatrix(vec3(0,0.1f,0)); - Renderer->ScaleMatrix(vec3(1, -1, 1)); - } - - Renderer->PushShader("SimplelightShader"); - - vec3 dayColor = vec3(0,0,0); - vec3 nightColor = vec3(0, 0.1f, 0.2f); - - if (TimeOfDayPref == 0) - { - RenderUniform3fv("TimeOfDayColor", dayColor.v); - RenderUniform1f("TimeOfDayCoef1", 0.75f); - RenderUniform1f("TimeOfDayCoef2", 0.25f); - } - else - if (TimeOfDayPref == 1) - { - RenderUniform3fv("TimeOfDayColor", dayColor.v); - RenderUniform1f("TimeOfDayCoef1", 0.5f); - RenderUniform1f("TimeOfDayCoef2", 0.25f); - } - else - { - RenderUniform3fv("TimeOfDayColor", nightColor.v); - RenderUniform1f("TimeOfDayCoef1", 0.0f); - RenderUniform1f("TimeOfDayCoef2", 0.4f); - } - - - Renderer->PushPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 450.f); - - LiteModel->DrawVBO(); - - for (int i=0; iPopProjectionMatrix(); - - Renderer->PopShader(); -} - -void TAndroidApplication::DrawSnow() -{ - - Renderer->PushProjectionMatrix(1,1); - - Renderer->LoadIdentity(); - - const float multiply_x = 4; - const float multiply_y = 2; - - Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f), vec2(-SkyTexShift, SnowTimer), vec2(multiply_x - SkyTexShift, multiply_y + SnowTimer)); - glClear(GL_DEPTH_BUFFER_BIT); - Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f), vec2(SnowTimer*0.7f+0.3f - SkyTexShift, SnowTimer+0.7f), vec2(multiply_x - SkyTexShift + SnowTimer*0.7f+0.3f, multiply_y + SnowTimer+0.7f)); - glClear(GL_DEPTH_BUFFER_BIT); - Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f), vec2(SnowTimer*0.4f+0.7f - SkyTexShift, SnowTimer+0.3f), vec2(multiply_x - SkyTexShift + SnowTimer*0.4f+0.7f, multiply_y + SnowTimer+0.3f)); - - Renderer->PopProjectionMatrix(); -} - -void TAndroidApplication::DrawAllScene(bool toScreen) -{ - glClearColor(0.f, 0.f, 0.f, 1.0f); - //glClearColor(1.f, 1.f, 1.f, 1.0f); - glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - - Renderer->PushMatrix(); - Renderer->SetGLCamView(); - - Renderer->PushShader("ClipShader"); - - - Renderer->SwitchToFrameBuffer("WaterFrame"); - Renderer->SetGLCamView(); - Renderer->ScaleMatrix(vec3(1, -1, 1)); - - - glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - - DrawSceneWithoutWater(true); - - Renderer->ScaleMatrix(vec3(1, -1, 1)); - - if (toScreen) - { - Renderer->SwitchToScreen(); - } - else - { - Renderer->SwitchToFrameBuffer("ScreenshotFrame"); - } - - Renderer->SetGLCamView(); - - Renderer->PushShader("NormShader"); - RenderUniform1f("Time", WaterTimer); - if (Renderer->GetScreenWidth() < 600) - { - RenderUniform1f("WaterScale", 0.7f); - } - else - { - RenderUniform1f("WaterScale", 1.f); - } - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["water_nmap.png"]); - glActiveTexture(GL_TEXTURE0); - if (toScreen) - { - Renderer->SetFullScreenViewport(); - } - else - { - Renderer->SetFrameViewport("ScreenshotFrame"); - } - Renderer->DrawFramePartScreen("WaterFrame", vec2(0, 0), vec2(1.f, 0.54f)); - Renderer->PopShader(); - - glClear(GL_DEPTH_BUFFER_BIT); - - Renderer->SetGLCamView(); - - - DrawSceneWithoutWater(false); - - glClear(GL_DEPTH_BUFFER_BIT); - - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["snow.png"]); - - if (SnowPref) - { - DrawSnow(); - } - - Renderer->PopShader(); - - Renderer->PopMatrix(); -} - -void TAndroidApplication::InnerInit() -{ - m2.lock(); - - CheckGlError(); - - glEnable(GL_BLEND); - - *Console<<"Inner init go!\n"; - -#ifdef TARGET_ANDROID - ST::PathToResources = ""; -#endif -#ifdef TARGET_WIN32 - ST::PathToResources = "../../assets/"; -#endif - ResourceManager->ShaderManager.AddShader("DefaultShader", "gui_transparent.vertex", "gui_transparent.fragment"); - Renderer->PushShader("DefaultShader"); - - LoadingQueue.push_back(boost::function(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "ClipShader", "gui_transparent_clip.vertex", "gui_transparent_clip.fragment"))); - LoadingQueue.push_back(boost::function(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "NormShader", "test_norm.vertex", "test_norm.fragment"))); - LoadingQueue.push_back(boost::function(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "ParallaxShader", "test_parallax.vertex", "test_parallax.fragment"))); - LoadingQueue.push_back(boost::function(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "SimplelightShader", "test_simplelight.vertex", "test_simplelight.fragment"))); - - if (IsFileExistsInUserData("file.bmp")) - { - ResourceManager->TexList.AddTextureFromUserdata("file.bmp", "ScreenshotTexture"); - } - else - { - ResourceManager->TexList.AddTexture("file.bmp", "ScreenshotTexture"); - } - - LoadingQueue.push_back(boost::function(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "console_bkg.bmp", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "water_nmap.png", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "sky.png", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "sky_night.png", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "snow.png", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "final_cloud.png", ""))); - - - LoadingQueue.push_back(boost::function(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "mountain.lm1", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice1.lm1", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice2.lm1", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice3.lm1", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice4.lm1", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice5.lm1", ""))); - LoadingQueue.push_back(boost::function(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice6.lm1", ""))); - - LoadingQueue.push_back(boost::function(boost::bind(&TAndroidApplication::LoadModels, this))); - LoadingQueue.push_back(boost::function(boost::bind(&TAndroidApplication::AddFrameBuffers, this))); - - - - //LoadModels(); - - CheckGlError(); - - - boost::get(Renderer->Camera).MovePhi(pi/32); - - - if (Renderer->GetScreenWidth() > Renderer->GetScreenHeight()) - { - boost::get(Renderer->Camera).MoveDist(30.f); - } - - else - { - boost::get(Renderer->Camera).MoveDist(45.f); - } - - boost::get(Renderer->Camera).CalcCamVec(); - - CheckGlError(); - - ResourceManager->LightManager.SetLightOn(); - - ResourceManager->LightManager.SetLightDirection(vec3(1, -1, 0)); - - //AddFrameBuffers(); - - //Renderer->SetPerspectiveFullScreenViewport(); - - if (Renderer->GetScreenWidth() < Renderer->GetScreenHeight()) - { - Renderer->SetMatrixWidth(480); - Renderer->SetMatrixHeight(800); - } - - Renderer->PushPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 400.f); - - *Console<<"Inner init end!\n"; - - m2.unlock(); -} - - - -void TAndroidApplication::InnerDeinit() -{ - m2.lock(); - Inited = false; - Loaded = false; - - makeShot = true; - LoadingQueue.clear(); - - if (LiteModel != NULL) - { - LiteModel->FreeModel(); - delete LiteModel; - LiteModel = NULL; - } - - IceModel.clear(); - - SimpleLand = std::shared_ptr(); - SimpleLandInv = std::shared_ptr(); - m2.unlock(); -} - - -void TAndroidApplication::InnerDraw() -{ - m2.lock(); - if (!Loaded) - { - glClearColor(0.f, 0.f, 0.f, 1.0f); - glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["ScreenshotTexture"]); - Renderer->PushProjectionMatrix(1,1); - Renderer->LoadIdentity(); - Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f)); - Renderer->PopProjectionMatrix(); - - } - else - { - - - DrawAllScene(true); - - if (makeShot) - { - makeShot = false; - - Renderer->SwitchToFrameBuffer("ScreenshotFrame"); - - DrawAllScene(false); - - ResourceManager->TexList.SaveTexDataToPlainBmpToUserData("file.bmp", ResourceManager->FrameManager.ReadFromBufferToTexData("ScreenshotFrame")); - - Renderer->SwitchToScreen(); - - } - } - m2.unlock(); - -} - - -void TAndroidApplication::InnerUpdate(cardinal dt) -{ - - if (!Loaded) - { - - boost::apply_visitor( LoadingQueueVisitor(), *LoadingQueue.begin() ); - LoadingQueue.erase(LoadingQueue.begin()); - - if (LoadingQueue.size() == 0) - { - Loaded = true; - } - } - else - { - - - if (WaveDir) - { - WaterTimer += dt/1000.f; - if (WaterTimer >= 10 * pi) - { - WaveDir = false; - WaterTimer = 10 * pi; - } - } - else - { - WaterTimer -= dt/1000.f; - if (WaterTimer < 0) - { - WaveDir = true; - WaterTimer = 0; - } - } - - CloudTimer += dt / 60000.f; - - while (CloudTimer >= 1.f) - { - CloudTimer -= 1.f; - } - - - SnowTimer += dt/3000.f; - - while (SnowTimer > 10.f) - { - SnowTimer -= 10.f; - } - } - -} - -void TAndroidApplication::InnerOnMove(vec2 shift) -{ - - shift = vec2(shift.v[0]*Renderer->GetMatrixWidth()/static_cast(Renderer->GetScreenWidth()), shift.v[1]*Renderer->GetMatrixHeight()/static_cast(Renderer->GetScreenHeight())); - - boost::get(Renderer->Camera).MoveAlpha(-pi*shift.v[0]*0.1f); -} - -void TAndroidApplication::OnMouseDown(TMouseState& mouseState) -{ - -} \ No newline at end of file diff --git a/jni/main_code.h b/jni/main_code.h deleted file mode 100644 index 71494fc..0000000 --- a/jni/main_code.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef GL_CODE_H_INCLUDED -#define GL_CODE_H_INCLUDED - -#ifdef TARGET_ANDROID -//#include "android_api.h" -#endif - -#include -#include -#include - -#ifdef TARGET_ANDROID -#include -#include -#include -#endif - -#include "boost/shared_ptr.hpp" -#include "boost/thread/thread.hpp" -#include "boost/asio.hpp" -#include "boost/signal.hpp" -#include "boost/assign.hpp" -#include "boost/variant.hpp" -#include "boost/function.hpp" -#include "boost/bind.hpp" - -#include "include/Engine.h" - -using namespace SE; - -class TAndroidApplication : public TApplication, public TSerializeInterface -{ -protected: - - void LoadModels(); - void AddFrameBuffers(); - -public: - bool Inited; - bool Loaded; - - std::vector, boost::function, boost::function > > LoadingQueue; - - TLiteModel* LiteModel; - - float WaterTimer; - float SnowTimer; - float CloudTimer; - float SkyTexShift; - bool WaveDir; - - std::vector IceModel; - - std::shared_ptr SimpleLand; - - std::shared_ptr SimpleLandInv; - - TAndroidApplication(); - - virtual void InnerInit(); - - virtual void InnerDeinit(); - - virtual void InnerDraw(); - - virtual void InnerUpdate(cardinal dt); - - virtual void InnerOnMove(vec2 shift); - - virtual void OnMouseDown(TMouseState& mouseState); - - bool IsInited() { return Inited; } - - void DrawSceneWithoutWater(bool inv); - void DrawSnow(); - void DrawAllScene(bool toScreen); - - - virtual void Serialize(boost::property_tree::ptree& propertyTree); - - //void DrawSceneWithoutWaterFrame(); - - -}; - - -//static void checkGlError(const std::string& op); - - -#endif diff --git a/proj.android-studio/app/.gitignore b/proj.android-studio/app/.gitignore new file mode 100755 index 0000000..796b96d --- /dev/null +++ b/proj.android-studio/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/proj.android-studio/app/CMakeLists.txt b/proj.android-studio/app/CMakeLists.txt new file mode 100755 index 0000000..616d1b1 --- /dev/null +++ b/proj.android-studio/app/CMakeLists.txt @@ -0,0 +1,96 @@ +# 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. + + +add_definitions(-DTARGET_ANDROID) + +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") + + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../engine) + +include_directories(${BOOST_PATH}) +include_directories(${LIBPNG_PATH}) +include_directories(${LIBJPEG_PATH}) +include_directories(${ZIP_PATH}) + +include_directories(${BOOST_GIL_PATH}) + +add_library( engine + SHARED + IMPORTED ) + +set_target_properties( # Specifies the target library. + engine + + # Specifies the parameter you want to define. + PROPERTIES IMPORTED_LOCATION + + # Provides the path to the library you want to import. + ${CMAKE_CURRENT_SOURCE_DIR}/build/intermediates/exploded-aar/proj.android-studio/SalmonEngineAndroid/unspecified/jni/${ANDROID_ABI}/libengine.so ) + + + + +add_library( # Sets the name of the library. + MountainWallpaper + + # 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. + ${CMAKE_CURRENT_SOURCE_DIR}/../../game/android_api.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../game/main_code.cpp + ) + + + +# Searches for a specified prebuilt library and stores the path as a +# variable. Because system libraries are included in the search path by +# default, you only need to specify the name of the public NDK library +# you want to add. CMake verifies that the library exists before +# completing its build. + +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 ) + +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 ) + + +# Specifies libraries CMake should link to your target library. You +# can link multiple libraries, such as libraries you define in the +# build script, prebuilt third-party libraries, or system libraries. + +target_link_libraries( # Specifies the target library. + MountainWallpaper + + # Links the target library to the log library + # included in the NDK. + ${log-lib} ${GLESv2-lib} engine ) diff --git a/proj.android-studio/app/build.gradle b/proj.android-studio/app/build.gradle new file mode 100755 index 0000000..22c835e --- /dev/null +++ b/proj.android-studio/app/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 24 + buildToolsVersion "24.0.1" + defaultConfig { + applicationId "fishrungames.mountainwallpaper" + minSdkVersion 15 + targetSdkVersion 24 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + externalNativeBuild { + cmake { + cppFlags "-std=c++11 -frtti -fexceptions -fsigned-char -Wno-c++11-narrowing" + } + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + externalNativeBuild { + cmake { + path "CMakeLists.txt" + } + } + sourceSets { + main { + assets.srcDirs = ['../../assets/'] + } + } +} + +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' + + compile project(':SalmonEngineAndroid') +} diff --git a/proj.android-studio/app/proguard-rules.pro b/proj.android-studio/app/proguard-rules.pro new file mode 100755 index 0000000..8a2f402 --- /dev/null +++ b/proj.android-studio/app/proguard-rules.pro @@ -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 *; +#} diff --git a/proj.android-studio/app/src/androidTest/java/fishrungames/salmonandroidtemplate/ExampleInstrumentedTest.java b/proj.android-studio/app/src/androidTest/java/fishrungames/salmonandroidtemplate/ExampleInstrumentedTest.java new file mode 100755 index 0000000..c282df4 --- /dev/null +++ b/proj.android-studio/app/src/androidTest/java/fishrungames/salmonandroidtemplate/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package fishrungames.salmonandroidtemplate; + +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 Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("fishrungames.salmonandroidtemplate", appContext.getPackageName()); + } +} diff --git a/AndroidManifest.xml b/proj.android-studio/app/src/main/AndroidManifest.xml old mode 100644 new mode 100755 similarity index 80% rename from AndroidManifest.xml rename to proj.android-studio/app/src/main/AndroidManifest.xml index fb8df99..c4cf77e --- a/AndroidManifest.xml +++ b/proj.android-studio/app/src/main/AndroidManifest.xml @@ -3,10 +3,10 @@ - + - - + + diff --git a/src/fishrungames/mountainwallpaper/GLWallpaperService.java b/proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/GLWallpaperService.java old mode 100644 new mode 100755 similarity index 98% rename from src/fishrungames/mountainwallpaper/GLWallpaperService.java rename to proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/GLWallpaperService.java index e872099..45a91ad --- a/src/fishrungames/mountainwallpaper/GLWallpaperService.java +++ b/proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/GLWallpaperService.java @@ -18,7 +18,7 @@ import android.service.wallpaper.WallpaperService; import android.util.Log; import android.view.SurfaceHolder; -import fishrungames.engine.EngineWrapper; +import fishrungames.salmonengineandroid.EngineWrapper; public class GLWallpaperService extends WallpaperService { @@ -186,7 +186,7 @@ public class GLWallpaperService extends WallpaperService { * * * This interface must be implemented by clients wishing to call - * {@link GLWallpaperService#setEGLContextFactory(EGLContextFactory)} + * {@link GLWallpaperService.GLEngine#setEGLContextFactory(EGLContextFactory)} */ interface EGLContextFactory { EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig); @@ -234,7 +234,7 @@ class ES20ContextFactory implements EGLContextFactory { * * * This interface must be implemented by clients wishing to call - * {@link GLWallpaperService#setEGLWindowSurfaceFactory(EGLWindowSurfaceFactory)} + * {@link GLWallpaperService.GLEngine#setEGLWindowSurfaceFactory(EGLWindowSurfaceFactory)} */ interface EGLWindowSurfaceFactory { EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display, @@ -297,8 +297,8 @@ class EglHelper { /** * Initialize EGL for a given configuration spec. - * - * @param configSpec + * + * configSpec */ public void start() { String instanceId = ""; diff --git a/src/fishrungames/mountainwallpaper/JniWrapper.java b/proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/JniWrapper.java old mode 100644 new mode 100755 similarity index 75% rename from src/fishrungames/mountainwallpaper/JniWrapper.java rename to proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/JniWrapper.java index 7454035..a25670b --- a/src/fishrungames/mountainwallpaper/JniWrapper.java +++ b/proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/JniWrapper.java @@ -1,27 +1,25 @@ -package fishrungames.mountainwallpaper; - -public class JniWrapper -{ - - static - { - System.loadLibrary("SalmonWallpaper"); - } - - public static void LoadLibrary() - { - //To force loading libraries - } - - public static native void SetTimeOfDayPref(int timeofday); - - public static native void SetSnowPref(boolean snow); - - - public static native void Init(int width, int height); - - public static native void SetOffset(float offsetX, float offsetY); - - public static native void SetOrientation(int isLandscape); - -} +package fishrungames.mountainwallpaper; + +public class JniWrapper +{ + + static + { + System.loadLibrary("MountainWallpaper"); + } + + public static void LoadLibrary() + { + //To force loading libraries + } + + public static native void SetTimeOfDayPref(int timeofday); + + public static native void SetSnowPref(boolean snow); + + + public static native void Init(int width, int height); + + public static native void SetOffset(float offsetX, float offsetY); + +} diff --git a/src/fishrungames/mountainwallpaper/MountainWallpaperService.java b/proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/MountainWallpaperService.java old mode 100644 new mode 100755 similarity index 98% rename from src/fishrungames/mountainwallpaper/MountainWallpaperService.java rename to proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/MountainWallpaperService.java index 5b4139b..ad9577a --- a/src/fishrungames/mountainwallpaper/MountainWallpaperService.java +++ b/proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/MountainWallpaperService.java @@ -19,7 +19,7 @@ import android.view.SurfaceHolder; //import com.seb.SLWP.SLWP.GlEngine.DownloadTask; -import fishrungames.engine.EngineWrapper; +import fishrungames.salmonengineandroid.EngineWrapper; public class MountainWallpaperService extends GLWallpaperService implements OnSharedPreferenceChangeListener { diff --git a/src/fishrungames/mountainwallpaper/Prefs.java b/proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/Prefs.java similarity index 100% rename from src/fishrungames/mountainwallpaper/Prefs.java rename to proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/Prefs.java diff --git a/res/drawable-hdpi/icon.png b/proj.android-studio/app/src/main/res/drawable-hdpi/icon.png old mode 100644 new mode 100755 similarity index 100% rename from res/drawable-hdpi/icon.png rename to proj.android-studio/app/src/main/res/drawable-hdpi/icon.png diff --git a/res/drawable-ldpi/icon.png b/proj.android-studio/app/src/main/res/drawable-ldpi/icon.png old mode 100644 new mode 100755 similarity index 100% rename from res/drawable-ldpi/icon.png rename to proj.android-studio/app/src/main/res/drawable-ldpi/icon.png diff --git a/res/drawable-mdpi/icon.png b/proj.android-studio/app/src/main/res/drawable-mdpi/icon.png old mode 100644 new mode 100755 similarity index 100% rename from res/drawable-mdpi/icon.png rename to proj.android-studio/app/src/main/res/drawable-mdpi/icon.png diff --git a/res/drawable/notificon.png b/proj.android-studio/app/src/main/res/drawable/notificon.png old mode 100644 new mode 100755 similarity index 100% rename from res/drawable/notificon.png rename to proj.android-studio/app/src/main/res/drawable/notificon.png diff --git a/res/drawable/thumb.jpg b/proj.android-studio/app/src/main/res/drawable/thumb.jpg old mode 100644 new mode 100755 similarity index 100% rename from res/drawable/thumb.jpg rename to proj.android-studio/app/src/main/res/drawable/thumb.jpg diff --git a/res/layout/main.xml b/proj.android-studio/app/src/main/res/layout/main.xml old mode 100644 new mode 100755 similarity index 100% rename from res/layout/main.xml rename to proj.android-studio/app/src/main/res/layout/main.xml diff --git a/res/layout/prefliste.xml b/proj.android-studio/app/src/main/res/layout/prefliste.xml old mode 100644 new mode 100755 similarity index 100% rename from res/layout/prefliste.xml rename to proj.android-studio/app/src/main/res/layout/prefliste.xml diff --git a/res/values-cs/strings.xml b/proj.android-studio/app/src/main/res/values-cs/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-cs/strings.xml rename to proj.android-studio/app/src/main/res/values-cs/strings.xml diff --git a/res/values-de/strings.xml b/proj.android-studio/app/src/main/res/values-de/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-de/strings.xml rename to proj.android-studio/app/src/main/res/values-de/strings.xml diff --git a/res/values-es/strings.xml b/proj.android-studio/app/src/main/res/values-es/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-es/strings.xml rename to proj.android-studio/app/src/main/res/values-es/strings.xml diff --git a/res/values-fr/strings.xml b/proj.android-studio/app/src/main/res/values-fr/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-fr/strings.xml rename to proj.android-studio/app/src/main/res/values-fr/strings.xml diff --git a/res/values-it/strings.xml b/proj.android-studio/app/src/main/res/values-it/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-it/strings.xml rename to proj.android-studio/app/src/main/res/values-it/strings.xml diff --git a/res/values-nl/strings.xml b/proj.android-studio/app/src/main/res/values-nl/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-nl/strings.xml rename to proj.android-studio/app/src/main/res/values-nl/strings.xml diff --git a/res/values-pt/strings.xml b/proj.android-studio/app/src/main/res/values-pt/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-pt/strings.xml rename to proj.android-studio/app/src/main/res/values-pt/strings.xml diff --git a/res/values-ru/strings.xml b/proj.android-studio/app/src/main/res/values-ru/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values-ru/strings.xml rename to proj.android-studio/app/src/main/res/values-ru/strings.xml diff --git a/res/values/strings.xml b/proj.android-studio/app/src/main/res/values/strings.xml old mode 100644 new mode 100755 similarity index 100% rename from res/values/strings.xml rename to proj.android-studio/app/src/main/res/values/strings.xml diff --git a/res/xml/preferences.xml b/proj.android-studio/app/src/main/res/xml/preferences.xml old mode 100644 new mode 100755 similarity index 100% rename from res/xml/preferences.xml rename to proj.android-studio/app/src/main/res/xml/preferences.xml diff --git a/res/xml/wallpaper.xml b/proj.android-studio/app/src/main/res/xml/wallpaper.xml old mode 100644 new mode 100755 similarity index 100% rename from res/xml/wallpaper.xml rename to proj.android-studio/app/src/main/res/xml/wallpaper.xml diff --git a/proj.android-studio/app/src/test/java/fishrungames/salmonandroidtemplate/ExampleUnitTest.java b/proj.android-studio/app/src/test/java/fishrungames/salmonandroidtemplate/ExampleUnitTest.java new file mode 100755 index 0000000..49c0291 --- /dev/null +++ b/proj.android-studio/app/src/test/java/fishrungames/salmonandroidtemplate/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package fishrungames.salmonandroidtemplate; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/proj.android-studio/build.gradle b/proj.android-studio/build.gradle new file mode 100755 index 0000000..74b2ab0 --- /dev/null +++ b/proj.android-studio/build.gradle @@ -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.3' + + // 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 +} diff --git a/proj.android-studio/gradle.properties b/proj.android-studio/gradle.properties new file mode 100755 index 0000000..aac7c9b --- /dev/null +++ b/proj.android-studio/gradle.properties @@ -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 diff --git a/proj.android-studio/gradle/wrapper/gradle-wrapper.jar b/proj.android-studio/gradle/wrapper/gradle-wrapper.jar new file mode 100755 index 0000000..13372ae Binary files /dev/null and b/proj.android-studio/gradle/wrapper/gradle-wrapper.jar differ diff --git a/proj.android-studio/gradle/wrapper/gradle-wrapper.properties b/proj.android-studio/gradle/wrapper/gradle-wrapper.properties new file mode 100755 index 0000000..04e285f --- /dev/null +++ b/proj.android-studio/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/proj.android-studio/gradlew b/proj.android-studio/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/proj.android-studio/gradlew @@ -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 "$@" diff --git a/proj.android-studio/gradlew.bat b/proj.android-studio/gradlew.bat new file mode 100755 index 0000000..8a0b282 --- /dev/null +++ b/proj.android-studio/gradlew.bat @@ -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 diff --git a/proj.android-studio/settings.gradle b/proj.android-studio/settings.gradle new file mode 100755 index 0000000..f82ab8b --- /dev/null +++ b/proj.android-studio/settings.gradle @@ -0,0 +1,7 @@ +include ':SalmonEngineAndroid' +project(':SalmonEngineAndroid').projectDir =new File(settingsDir, '../../engine/SalmonEngineAndroid/app') + + +include ':app' + +