diff --git a/game/Android.mk b/game/Android.mk new file mode 100755 index 0000000..066e5bb --- /dev/null +++ b/game/Android.mk @@ -0,0 +1,77 @@ +# 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_47_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 := SalmonJniTemplate +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/game/Application.mk b/game/Application.mk new file mode 100755 index 0000000..9bd01d8 --- /dev/null +++ b/game/Application.mk @@ -0,0 +1,3 @@ +APP_STL := gnustl_shared +APP_CPPFLAGS += -fexceptions +APP_CPPFLAGS += -frtti diff --git a/game/android_api.cpp b/game/android_api.cpp new file mode 100755 index 0000000..e075b7d --- /dev/null +++ b/game/android_api.cpp @@ -0,0 +1,10 @@ +#include "android_api.h" + +#include "main_code.h" + + +JNIEXPORT void JNICALL Java_fishrungames_asteroidgame_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height) +{ + JniInitApp(width, height, 480.f, 320.f); +} + diff --git a/game/android_api.h b/game/android_api.h new file mode 100755 index 0000000..7ba88d8 --- /dev/null +++ b/game/android_api.h @@ -0,0 +1,25 @@ +#ifndef ANDROID_API_H_INCLUDED +#define ANDROID_API_H_INCLUDED + +#include +#include + +#include +#include +#include + +#include "boost/shared_ptr.hpp" + +#include "main_code.h" + +#include "include/Engine.h" + +using namespace SE; + + +extern "C" { + JNIEXPORT void JNICALL Java_fishrungames_asteroidgame_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height); +}; + + +#endif diff --git a/game/main_code.cpp b/game/main_code.cpp new file mode 100755 index 0000000..0761fef --- /dev/null +++ b/game/main_code.cpp @@ -0,0 +1,567 @@ +#include "main_code.h" + +#ifdef TARGET_ANDROID +#include "android_api.h" +#endif + +#include +#include +#include +#include + +#include "include/Engine.h" + +#include "main_code.h" + +//Better move those to external config or something... +const cardinal CONST_LASER_TIMER = 200; +const int CONST_HIT_SCORE_POINTS = 100; +const float CONST_TIME_SCALE = 0.01f; + +const float CONST_PLAYER_ACCELERATION = 3.f; +const float CONST_VELOCITY_FADE = 0.95f; +const float CONST_LASER_VELOCITY = 100.f; + +const vec2 CONST_PLAYER_HALF_SIZE(30.f, 30.f); +const vec2 CONST_LASER_HALF_SIZE(10.f, 10.f); + + +const vec2 CONST_AST_POS1(40, 40); +const vec2 CONST_AST_POS2(40, 280); +const vec2 CONST_AST_POS3(440, 160); + + + +float HealthToScale(int health) +{ + return 0.5f + health * 0.3f; +} + +float HealthToHitDistance(int health) +{ + const float CONST_HIT_DISTANCE = 15.f; + + return max(CONST_HIT_DISTANCE * HealthToScale(health), 10.f); +} + +void TMyApplication::InnerInit() +{ + + *Console<<"Inner init go!\n"; + +#ifdef TARGET_ANDROID + ST::PathToResources = ""; +#endif +#ifdef TARGET_WIN32 +#ifdef NDEBUG + ST::PathToResources = "assets/"; +#else + ST::PathToResources = "../../../assets/"; +#endif +#endif +#ifdef TARGET_IOS + ST::PathToResources = "assets/"; +#endif + + RandomGenerator.seed(static_cast(std::time(0))); + + TapIsDown = false; + + ResourceManager->TexList.AddTexture(CONST_CONSOLE_TEX_NAME); + + ResourceManager->ShaderManager.AddShader("DefaultShader", "gui_transparent.vertex", "gui_transparent.fragment"); + + Renderer->PushShader("DefaultShader"); + + ResourceManager->FontManager.AddFont("droid_sans14", "droid_sans14_font_bitmap.bmp32", "droid_sans14_font_charmap.txt"); + ResourceManager->FontManager.PushFont("droid_sans14"); + + ResourceManager->TexList.Serialize(*FileToPropertyTree("textures.xml")); + + Renderer->PushProjectionMatrix(Renderer->GetScreenWidth(), Renderer->GetScreenHeight()); + + Level = 1; + Score = 0; + + InitLevel(); + + Player.RenderPair.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "shipTexture"; + Player.RenderPair.second.Data = MakeDataTriangleList(Player.Pos - CONST_PLAYER_HALF_SIZE, Player.Pos + CONST_PLAYER_HALF_SIZE); + Player.RenderPair.second.RefreshBuffer(); + + BackgroundRenderPair.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "backgroundTexture"; + BackgroundRenderPair.second.Data = MakeDataTriangleList(vec2(0,0), vec2(Renderer->GetScreenWidth(), Renderer->GetScreenHeight())); + BackgroundRenderPair.second.RefreshBuffer(); + + *Console<<"Inner init end!\n"; + + glDepthFunc(GL_LEQUAL); + +} + +void TMyApplication::InnerDeinit() +{ +} + + +void TMyApplication::InnerDraw() +{ + + glClearColor(0,0,0,1); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + //Draw background + TRenderParamsSetter renderParamSetter(BackgroundRenderPair.first); + + Renderer->DrawTriangleList(BackgroundRenderPair.second); + + + //Draw asteroids + BOOST_FOREACH(CAsteroidStruct& asteroid, Asteroids) + { + TRenderParamsSetter renderParamSetter(asteroid.RenderPair.first); + + Renderer->DrawTriangleList(asteroid.RenderPair.second); + } + + + //Draw player + if (GameState != GS_LOST) + { + TRenderParamsSetter renderParamSetter(Player.RenderPair.first); + Renderer->DrawTriangleList(Player.RenderPair.second); + } + + //Draw lasers + BOOST_FOREACH(CLaserStruct& laser, Lasers) + { + TRenderParamsSetter renderParamSetter(laser.RenderPair.first); + + Renderer->DrawTriangleList(laser.RenderPair.second); + } + + + //Draw texts + glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList[ResourceManager->FontManager.GetCurrentFontTextureName()]); + + Renderer->DrawTriangleList(LevelScoreText); + Renderer->DrawTriangleList(LevelMessageText); + +} + + +void TMyApplication::InnerUpdate(cardinal dt) +{ + float scaledTime = CONST_TIME_SCALE * dt; + + //Update Asteroids + BOOST_FOREACH(CAsteroidStruct& asteroid, Asteroids) + { + + float difAngle = asteroid.AngularVelocity * scaledTime; + + asteroid.Angle += difAngle; + + mat3 rotationMatrix = CreateZRotationMatrix(difAngle); + + MoveDataTriangleList(asteroid.RenderPair.second.Data, -vec3(asteroid.CenterPos, 0)); + RotateDataTriangleList(asteroid.RenderPair.second.Data, rotationMatrix); + MoveDataTriangleList(asteroid.RenderPair.second.Data, vec3(asteroid.CenterPos, 0)); + + + vec2 dif = asteroid.Velocity * scaledTime; + + vec2 newCenterPos = NormalizePos(asteroid.CenterPos + dif); + + dif = newCenterPos - asteroid.CenterPos; + + asteroid.CenterPos = newCenterPos; + + MoveDataTriangleList(asteroid.RenderPair.second.Data, vec3(dif, 0)); + + asteroid.RenderPair.second.RefreshBuffer(); + } + + + + UpdatePlayerPosition(scaledTime); + + + + //Shoot laser + LaserTimer.Update(dt); + + if (LaserTimer.IsOver()) + { + LaserTimer.SetTimer(CONST_LASER_TIMER); + + if (GameState == GS_PLAY) + { + AddNewLaser(); + } + } + + //Update lasers + BOOST_FOREACH(CLaserStruct& laser, Lasers) + { + vec2 dif = CONST_LASER_VELOCITY *laser.Dir * scaledTime; + MoveDataTriangleList(laser.RenderPair.second.Data, vec3(dif, 0)); + laser.Pos += dif; + + laser.RenderPair.second.RefreshBuffer(); + } + + //Do all checks... + ProcessLaserHit(); + + ProcessPlayerCollisions(); + + ClearUnusedLasers(); + + if (Asteroids.size() == 0 && GameState == GS_PLAY) + { + GameState = GS_WON; + RefreshScoreText(); + } + + +} + + +void TMyApplication::InnerOnTapDown(vec2 p) +{ + TapIsDown = true; + LastTap = p; +} + +void TMyApplication::InnerOnTapUp(vec2 p) +{ + TapIsDown = false; + + + if (GameState == GS_LOST) + { + Level = 1; + Score = 0; + InitLevel(); + } + else if (GameState == GS_WON) + { + Level++; + InitLevel(); + } +} + +void TMyApplication::InnerOnTapUpAfterMove(vec2 p) +{ + TapIsDown = false; +} + +void TMyApplication::InnerOnMove(vec2 shift) +{ + LastTap -= shift; +} + +void TMyApplication::InitLevel() +{ + GameState = GS_PLAY; + + LaserTimer.SetTimer(CONST_LASER_TIMER); + + Asteroids.clear(); + Lasers.clear(); + + CreateRandomAsteroid(CONST_AST_POS1, Level); + CreateRandomAsteroid(CONST_AST_POS2, Level); + CreateRandomAsteroid(CONST_AST_POS3, Level); + + Player.Angle = 0; + Player.Pos = vec2(Renderer->GetScreenWidth()/2, Renderer->GetScreenHeight()/2); + + RefreshScoreText(); + +} + +CAsteroidStruct TMyApplication::CreateAsteroid(vec2 pos, vec2 dir, int health) +{ + static const float CONST_TEX_COORD_SCALE = 0.01f; + static const float CONST_ANGULAR_VELOCITY_SCALE = 0.001f; + + static const boost::random::uniform_int_distribution<> velocityDistribution(5, 10); + + static const boost::random::uniform_int_distribution<> angularVelocityDistribution(0, 10); + + static const boost::random::uniform_int_distribution<> vertexNumberDistribution(5, 10); + static const boost::random::uniform_int_distribution<> vertexShiftDistribution(20, 30); + + CAsteroidStruct result; + + result.Health = health; + + result.CenterPos = pos; + + result.Angle = 0; + + result.AngularVelocity = angularVelocityDistribution(RandomGenerator) * CONST_ANGULAR_VELOCITY_SCALE; + + result.Velocity = velocityDistribution(RandomGenerator) * dir; + + int numberOfVertices = vertexNumberDistribution(RandomGenerator); + + std::vector distArr(numberOfVertices); + + for (int i=0; i(numberOfVertices); + + vec2 shift = distArr[i % numberOfVertices] * vec2(cosf(angle), sinf(angle)); + + vec2 texCoordShift = shift * CONST_TEX_COORD_SCALE; + + result.RenderPair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(vec3(pos, 0)); + result.RenderPair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(vec3(pos + prevShift, 0)); + result.RenderPair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(vec3(pos + shift, 0)); + + result.RenderPair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(vec2(0.5f, 0.5f)); + result.RenderPair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(vec2(0.5f, 0.5f) + prevTexCoordShift); + result.RenderPair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(vec2(0.5f, 0.5f) + texCoordShift); + + prevShift = shift; + prevTexCoordShift = texCoordShift; + } + + result.RenderPair.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "asteroidTexture"; + + result.RenderPair.second.RefreshBuffer(); + + return result; +} + + +void TMyApplication::CreateRandomAsteroid(vec2 pos, int health) +{ + + static const boost::random::uniform_int_distribution<> angleDistribution(0, 36); + + float randomAngle = angleDistribution(RandomGenerator) * pi / 18.f; + + Asteroids.push_back(CreateAsteroid(pos, vec2(cosf(randomAngle), sinf(randomAngle)), health)); +} + +void TMyApplication::CreateAsteroidParts(vec2 pos, int newHealth) +{ + static const boost::random::uniform_int_distribution<> CreateAsteroidParts(2, 5); + + static const boost::random::uniform_int_distribution<> angleDistribution(0, 36); + + float randomAngle = angleDistribution(RandomGenerator) * pi / 18.f; + + int number = CreateAsteroidParts(RandomGenerator); + + for (int i = 0; i < number; i++) + { + float partAngle = randomAngle + i * 2 * pi / static_cast(number); + Asteroids.push_back(CreateAsteroid(pos, vec2(cosf(partAngle), sinf(partAngle)), newHealth)); + } + +} + +vec2 TMyApplication::NormalizePos(vec2 pos) +{ + vec2 result = pos; + + while (result.v[0] < 0) + { + result.v[0] += Renderer->GetScreenWidth(); + } + + while (result.v[1] < 0) + { + result.v[1] += Renderer->GetScreenHeight(); + } + + while (result.v[0] >= Renderer->GetScreenWidth()) + { + result.v[0] -= Renderer->GetScreenWidth(); + } + + while (result.v[1] >= Renderer->GetScreenHeight()) + { + result.v[1] -= Renderer->GetScreenHeight(); + } + + return result; +} + +void TMyApplication::RefreshPlayerPos() +{ + Replace6PointsInTriangleList(Player.RenderPair.second.Data, 0, (-1) * CONST_PLAYER_HALF_SIZE, CONST_PLAYER_HALF_SIZE); + + mat3 rotationMatrix = CreateZRotationMatrix(Player.Angle); + + RotateDataTriangleList(Player.RenderPair.second.Data, rotationMatrix); + + MoveDataTriangleList(Player.RenderPair.second.Data, vec3(Player.Pos, 0)); + + Player.RenderPair.second.RefreshBuffer(); + +} + +void TMyApplication::AddNewLaser() +{ + CLaserStruct laser; + + float angle = Player.Angle; + + laser.Dir = vec2(cosf(angle), sinf(angle)); + + laser.Pos = Player.Pos; + + laser.RenderPair.second.Data = MakeDataTriangleList((-1) * CONST_LASER_HALF_SIZE, CONST_LASER_HALF_SIZE); + + mat3 rotationMatrix = CreateZRotationMatrix(angle); + + RotateDataTriangleList(laser.RenderPair.second.Data, rotationMatrix); + + MoveDataTriangleList(laser.RenderPair.second.Data, vec3(laser.Pos, 0)); + + laser.RenderPair.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "fireTexture"; + + laser.RenderPair.second.RefreshBuffer(); + + Lasers.push_back(laser); +} + +void TMyApplication::UpdatePlayerPosition(float scaledTime) +{ + + if (TapIsDown) + { + + vec2 dir = Normalize(LastTap - Player.Pos); + + Player.Velocity += CONST_PLAYER_ACCELERATION * scaledTime * dir; + + Player.Angle = acosf(DotProduct(dir, vec2(1, 0))); + + if (dir.v[1] < 0) + { + Player.Angle = -Player.Angle; + } + } + + Player.Pos += Player.Velocity * scaledTime; + + + Player.Velocity *= powf(CONST_VELOCITY_FADE, clamp(scaledTime, 0.f, 1.5f)); + + Player.Pos = NormalizePos(Player.Pos); + + RefreshPlayerPos(); + +} + +void TMyApplication::ProcessLaserHit() +{ + + for (auto laserItr = Lasers.begin(); laserItr != Lasers.end(); ) + { + for (auto astItr = Asteroids.begin(); astItr != Asteroids.end(); ) + { + + float realDistance = HealthToHitDistance(astItr->Health); + + if (fabs(laserItr->Pos.v[0] - astItr->CenterPos.v[0]) < realDistance && + fabs(laserItr->Pos.v[1] - astItr->CenterPos.v[1]) < realDistance) + { + laserItr = Lasers.erase(laserItr); + + if (astItr->Health > 0) + { + CreateAsteroidParts(astItr->CenterPos, astItr->Health - 1); + } + + astItr = Asteroids.erase(astItr); + + Score += CONST_HIT_SCORE_POINTS; + RefreshScoreText(); + + break; + + } + + + if (astItr != Asteroids.end()) + { + astItr++; + } + } + + if (laserItr != Lasers.end()) + { + laserItr++; + } + } + +} + +void TMyApplication::ProcessPlayerCollisions() +{ + + for (auto astItr = Asteroids.begin(); astItr != Asteroids.end(); astItr++) + { + float realDistance = HealthToHitDistance(astItr->Health); + + if (fabs(astItr->CenterPos.v[0] - Player.Pos.v[0]) < realDistance && fabs(astItr->CenterPos.v[1] - Player.Pos.v[1]) < realDistance) + { + GameState = GS_LOST; + RefreshScoreText(); + } + } +} + +void TMyApplication::ClearUnusedLasers() +{ + for (auto itr = Lasers.begin(); itr != Lasers.end(); ) + { + if (itr->Pos.v[0] < 0 || itr->Pos.v[1] < 0 || itr->Pos.v[0] > Renderer->GetScreenWidth() || itr->Pos.v[1] > Renderer->GetScreenHeight()) + { + itr = Lasers.erase(itr); + } + + if (itr != Lasers.end()) + { + itr++; + } + } +} + + +void TMyApplication::RefreshScoreText() +{ + LevelScoreText = ResourceManager->FontManager.DrawStringToVBO(vec2(10, 20), TTextBasicAreaParams(), "Score: "+ tostr(Score)); + + if (GameState == GS_PLAY) + { + LevelMessageText = ResourceManager->FontManager.DrawStringToVBO(vec2(10, 300), TTextBasicAreaParams(), "Now playing "+ tostr(Level) + " level"); + } + else if (GameState == GS_WON) + { + LevelMessageText = ResourceManager->FontManager.DrawStringToVBO(vec2(10, 300), TTextBasicAreaParams(), "You won! Tap on screen to start next level"); + } + else if (GameState == GS_LOST) + { + LevelMessageText = ResourceManager->FontManager.DrawStringToVBO(vec2(10, 300), TTextBasicAreaParams(), "You failed! Tap on screen to restart"); + } +} \ No newline at end of file diff --git a/game/main_code.h b/game/main_code.h new file mode 100755 index 0000000..828131d --- /dev/null +++ b/game/main_code.h @@ -0,0 +1,137 @@ +#ifndef MAIN_CODE_H_INCLUDED +#define MAIN_CODE_H_INCLUDED + + +#include +#include +#include + +#ifdef TARGET_ANDROID + +#include +#include +#include +#endif + +#include "boost/shared_ptr.hpp" +#include "boost/thread/thread.hpp" +#include "boost/assign.hpp" +#include "boost/bind.hpp" +#include "boost/asio.hpp" +#include "boost/signal.hpp" +#include "boost/random.hpp" + +#include "include/Engine.h" + +using namespace SE; + +struct CAsteroidStruct +{ + int Health; + float Angle; + float AngularVelocity; + vec2 CenterPos; + vec2 Velocity; + TRenderPair RenderPair; +}; + +struct CPlayer +{ + vec2 Pos; + float Angle; + vec2 Velocity; + TRenderPair RenderPair; +}; + + +struct CLaserStruct +{ + vec2 Pos; + vec2 Dir; + TRenderPair RenderPair; +}; + +enum CGameState +{ + GS_PLAY, + GS_WON, + GS_LOST +}; + +class TMyApplication : public TApplication +{ +protected: + + //Game elements + std::list Asteroids; + std::list Lasers; + CPlayer Player; + + //Minor + boost::random::mt19937 RandomGenerator; + bool TapIsDown; + vec2 LastTap; + TSimpleTimer LaserTimer; + + //Game score and state + CGameState GameState; + int Level; + int Score; + + //Static graphics + TTriangleList LevelScoreText; + TTriangleList LevelMessageText; + TRenderPair BackgroundRenderPair; + + + CAsteroidStruct CreateAsteroid(vec2 pos, vec2 dir, int health); + + void CreateRandomAsteroid(vec2 pos, int health); + + void CreateAsteroidParts(vec2 pos, int newHealth); + + vec2 NormalizePos(vec2 pos); + + void RefreshPlayerPos(); + + void AddNewLaser(); + void UpdatePlayerPosition(float scaledTime); + void ProcessLaserHit(); + void ProcessPlayerCollisions(); + void ClearUnusedLasers(); + + void RefreshScoreText(); + +public: + bool Inited; + + TMyApplication() : TApplication(), Inited(false) { } + + + virtual void InnerInit(); + + virtual void InnerDeinit(); + + virtual void InnerDraw(); + + virtual void InnerUpdate(cardinal dt); + + virtual void InnerOnTapDown(vec2 p); + + virtual void InnerOnTapUp(vec2 p); + + virtual void InnerOnTapUpAfterMove(vec2 p); + + virtual void InnerOnMove(vec2 shift); + + bool IsInited() { return Inited; } + + void InitLevel(); + + + + +}; + + +#endif diff --git a/proj.android-studio/.gitignore b/proj.android-studio/.gitignore new file mode 100755 index 0000000..cea3ef5 --- /dev/null +++ b/proj.android-studio/.gitignore @@ -0,0 +1,10 @@ +*.iml +.gradle +/local.properties +/.idea +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild 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..018e227 --- /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. + AsteroidGame + + # 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. + AsteroidGame + + # 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..672c1eb --- /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.asteroidgame" + 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/asteroidgame/ExampleInstrumentedTest.java b/proj.android-studio/app/src/androidTest/java/fishrungames/asteroidgame/ExampleInstrumentedTest.java new file mode 100755 index 0000000..ddd9183 --- /dev/null +++ b/proj.android-studio/app/src/androidTest/java/fishrungames/asteroidgame/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package fishrungames.asteroidgame; + +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.asteroidgame", appContext.getPackageName()); + } +} diff --git a/proj.android-studio/app/src/main/AndroidManifest.xml b/proj.android-studio/app/src/main/AndroidManifest.xml new file mode 100755 index 0000000..440440f --- /dev/null +++ b/proj.android-studio/app/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + diff --git a/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/GLView.java b/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/GLView.java new file mode 100755 index 0000000..278c26e --- /dev/null +++ b/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/GLView.java @@ -0,0 +1,74 @@ +package fishrungames.asteroidgame; + + +import java.util.Calendar; + +import android.content.Context; +import android.opengl.GLSurfaceView; + +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +import fishrungames.salmonengineandroid.GLViewAncestor; +import fishrungames.salmonengineandroid.EngineWrapper; +import fishrungames.asteroidgame.JniWrapper; + +class GLView extends GLViewAncestor +{ + static long lastTimeStamp; + static boolean gameIsInited = false; + + public GLView(Context context) + { + //Change this method? Don't forget to change method below! + super(context); + init(false, 0, 0); + } + + public GLView(Context context, boolean translucent, int depth, int stencil) + { + //Change this method? Don't forget to change method above! + super(context); + init(translucent, depth, stencil); + } + + public void init(boolean translucent, int depth, int stencil) + { + super.init(translucent, depth, stencil); + setRenderer(new Renderer()); + Calendar c = Calendar.getInstance(); + lastTimeStamp = c.getTimeInMillis(); + gameIsInited = true; + } + + private static class Renderer implements GLSurfaceView.Renderer + { + public void onDrawFrame(GL10 gl) + { + if (gameIsInited) + { + Calendar c = Calendar.getInstance(); + + long currentTimeStamp = c.getTimeInMillis(); + + EngineWrapper.Update(currentTimeStamp - lastTimeStamp); + + lastTimeStamp = currentTimeStamp; + } + } + + public void onSurfaceChanged(GL10 gl, int width, int height) + { + + + //JniWrapper.Destroy(); + + JniWrapper.Init(width,height); + } + + public void onSurfaceCreated(GL10 gl, EGLConfig config) + { + //Do nothing. + } + } +} \ No newline at end of file diff --git a/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/JniWrapper.java b/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/JniWrapper.java new file mode 100755 index 0000000..55ca79c --- /dev/null +++ b/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/JniWrapper.java @@ -0,0 +1,12 @@ +package fishrungames.asteroidgame; + +public class JniWrapper +{ + static { + System.loadLibrary("AsteroidGame"); + } + + + public static native void Init(int width, int height); + +} \ No newline at end of file diff --git a/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/MainActivity.java b/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/MainActivity.java new file mode 100755 index 0000000..0e0ba49 --- /dev/null +++ b/proj.android-studio/app/src/main/java/fishrungames/asteroidgame/MainActivity.java @@ -0,0 +1,94 @@ +package fishrungames.asteroidgame; + +import fishrungames.salmonengineandroid.EngineWrapper; + +//Deprecated +//import fishrungames.androidjnitemplate.R; + +import android.app.Activity; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.os.Bundle; + +import android.view.GestureDetector; +import android.view.KeyEvent; +import android.view.GestureDetector.SimpleOnGestureListener; +import android.view.MotionEvent; + + + +public class MainActivity extends Activity +{ + + GLView mView; + + @Override + protected void onCreate(Bundle icicle) + { + + super.onCreate(icicle); + + EngineWrapper.LoadSalmonEngineLibrary(); + + EngineWrapper.SetActivityInstance(this); + EngineWrapper.SetupEnviroment(); + + String apkFilePath = null; + ApplicationInfo appInfo = null; + PackageManager packMgmr = this.getPackageManager(); + try { + appInfo = packMgmr.getApplicationInfo("fishrungames.asteroidgame", 0); + } catch (NameNotFoundException e) { + + e.printStackTrace(); + throw new RuntimeException("Unable to locate assets, aborting..."); + } + apkFilePath = appInfo.sourceDir; + + EngineWrapper.SetupApkFilePath(apkFilePath); + + mView = new GLView(getApplication()); + + setContentView(mView); + + EngineWrapper.SetView(mView); + + } + + @Override + protected void onPause() + { + EngineWrapper.Destroy(); + super.onPause(); + mView.onPause(); + } + + @Override + protected void onResume() + { + //Don't write anything here! + super.onResume(); + mView.onResume(); + } + + @Override + protected void onStop() + { + //Don't write anything here! + super.onStop(); + } + + public boolean onKeyDown(int keyCode, KeyEvent event) + { + EngineWrapper.ProcessKeyDown(keyCode, event); + return super.onKeyDown(keyCode, event); + } + + public boolean onTouchEvent(MotionEvent event) + { + EngineWrapper.ProcessTouchEvent(event); + return true; + } + +} \ No newline at end of file diff --git a/proj.android-studio/app/src/main/res/drawable-hdpi/ic_menu_template.png b/proj.android-studio/app/src/main/res/drawable-hdpi/ic_menu_template.png new file mode 100755 index 0000000..1e28f93 Binary files /dev/null and b/proj.android-studio/app/src/main/res/drawable-hdpi/ic_menu_template.png differ diff --git a/proj.android-studio/app/src/main/res/drawable-ldpi/ic_menu_template.png b/proj.android-studio/app/src/main/res/drawable-ldpi/ic_menu_template.png new file mode 100755 index 0000000..6a93cf2 Binary files /dev/null and b/proj.android-studio/app/src/main/res/drawable-ldpi/ic_menu_template.png differ diff --git a/proj.android-studio/app/src/main/res/drawable-mdpi/ic_menu_template.png b/proj.android-studio/app/src/main/res/drawable-mdpi/ic_menu_template.png new file mode 100755 index 0000000..7c1cab2 Binary files /dev/null and b/proj.android-studio/app/src/main/res/drawable-mdpi/ic_menu_template.png differ diff --git a/proj.android-studio/app/src/main/res/values/strings.xml b/proj.android-studio/app/src/main/res/values/strings.xml new file mode 100755 index 0000000..b8fcfcd --- /dev/null +++ b/proj.android-studio/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + AndroidJniTemplate + diff --git a/proj.android-studio/app/src/test/java/fishrungames/asteroidgame/ExampleUnitTest.java b/proj.android-studio/app/src/test/java/fishrungames/asteroidgame/ExampleUnitTest.java new file mode 100755 index 0000000..51c4a3e --- /dev/null +++ b/proj.android-studio/app/src/test/java/fishrungames/asteroidgame/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package fishrungames.asteroidgame; + +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' + +