move to AS
This commit is contained in:
		
							parent
							
								
									73ce1879f1
								
							
						
					
					
						commit
						ca49a36f49
					
				| @ -1,8 +0,0 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <classpath> | ||||
| 	<classpathentry excluding=".svn/" kind="src" path="src"/> | ||||
| 	<classpathentry excluding=".svn/" kind="src" path="gen"/> | ||||
| 	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||||
| 	<classpathentry kind="lib" path="C:/Workplace/Projects/Android/EngineWrapper/jar/EngineWrapper.jar"/> | ||||
| 	<classpathentry kind="output" path="bin"/> | ||||
| </classpath> | ||||
							
								
								
									
										33
									
								
								.project
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								.project
									
									
									
									
									
								
							| @ -1,33 +0,0 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <projectDescription> | ||||
| 	<name>EngineWrapper</name> | ||||
| 	<comment></comment> | ||||
| 	<projects> | ||||
| 	</projects> | ||||
| 	<buildSpec> | ||||
| 		<buildCommand> | ||||
| 			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> | ||||
| 			<arguments> | ||||
| 			</arguments> | ||||
| 		</buildCommand> | ||||
| 		<buildCommand> | ||||
| 			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> | ||||
| 			<arguments> | ||||
| 			</arguments> | ||||
| 		</buildCommand> | ||||
| 		<buildCommand> | ||||
| 			<name>org.eclipse.jdt.core.javabuilder</name> | ||||
| 			<arguments> | ||||
| 			</arguments> | ||||
| 		</buildCommand> | ||||
| 		<buildCommand> | ||||
| 			<name>com.android.ide.eclipse.adt.ApkBuilder</name> | ||||
| 			<arguments> | ||||
| 			</arguments> | ||||
| 		</buildCommand> | ||||
| 	</buildSpec> | ||||
| 	<natures> | ||||
| 		<nature>com.android.ide.eclipse.adt.AndroidNature</nature> | ||||
| 		<nature>org.eclipse.jdt.core.javanature</nature> | ||||
| 	</natures> | ||||
| </projectDescription> | ||||
| @ -1,11 +0,0 @@ | ||||
| # This file is automatically generated by Android Tools. | ||||
| # Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||||
| #  | ||||
| # This file must be checked in Version Control Systems. | ||||
| #  | ||||
| # To customize properties used by the Ant build system use, | ||||
| # "build.properties", and override values to adapt the script to your | ||||
| # project structure. | ||||
| 
 | ||||
| # Project target. | ||||
| target=android-8 | ||||
| @ -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_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 -DTARGET_SALMON -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) | ||||
| @ -1,3 +0,0 @@ | ||||
| APP_STL  := gnustl_shared | ||||
| APP_CPPFLAGS += -fexceptions | ||||
| APP_CPPFLAGS += -frtti | ||||
| @ -1,11 +0,0 @@ | ||||
| #include "android_api.h" | ||||
| 
 | ||||
| #include "boost/thread.hpp" | ||||
| 
 | ||||
| #include "main_code.h" | ||||
| 
 | ||||
| JNIEXPORT void JNICALL Java_fishrungames_salmonjnitemplate_JniWrapper_Init(JNIEnv * env, jobject obj,  jint width, jint height) | ||||
| { | ||||
| 	JniInitApp<TMyApplication>(width, height, 320.f, 480.f); | ||||
| }	 | ||||
| 
 | ||||
| @ -1,23 +0,0 @@ | ||||
| #ifndef ANDROID_API_H_INCLUDED | ||||
| #define ANDROID_API_H_INCLUDED | ||||
| 
 | ||||
| #include <jni.h> | ||||
| #include <android/log.h> | ||||
| 
 | ||||
| #include <GLES/gl.h> | ||||
| #include <GLES2/gl2.h> | ||||
| #include <GLES2/gl2ext.h> | ||||
| 
 | ||||
| #include "boost/shared_ptr.hpp" | ||||
| 
 | ||||
| #include "main_code.h" | ||||
| 
 | ||||
| using namespace SE; | ||||
| 
 | ||||
| 
 | ||||
| extern "C" { | ||||
|     JNIEXPORT void JNICALL Java_fishrungames_salmonjnitemplate_JniWrapper_Init(JNIEnv * env, jobject obj,  jint width, jint height); | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| #endif | ||||
| @ -1,435 +0,0 @@ | ||||
| #include "main_code.h" | ||||
| 
 | ||||
| #ifdef TARGET_ANDROID | ||||
| #include "android_api.h" | ||||
| #endif | ||||
| 
 | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <math.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
| #include "include/Engine.h" | ||||
| 
 | ||||
| #include "main_code.h" | ||||
| 
 | ||||
| const int CONST_TUBE_COUNT = 6; | ||||
| 
 | ||||
| const int CONST_MAX_BOXES = 50; | ||||
| 
 | ||||
| const float CONST_VELOCITY = 2.f; | ||||
| 
 | ||||
| int countTubes = 0; | ||||
| 
 | ||||
| TFlexModel GenerateFlexModel(int i) | ||||
| { | ||||
| 	countTubes++; | ||||
| 
 | ||||
| 	if (countTubes <= 5) | ||||
| 	{ | ||||
| 		return ResourceManager->FlexModelManager.InstanciateModel("tube1.xml"); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		return ResourceManager->FlexModelManager.InstanciateModel("tube"+tostr(i+1)+".xml"); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| TFlexModel GeneratePhysicsModel(int i) | ||||
| { | ||||
| 	countTubes++; | ||||
| 
 | ||||
| 	if (countTubes <= 5) | ||||
| 	{ | ||||
| 		return ResourceManager->FlexModelManager.InstanciateModel("tube1_physics.xml"); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		return ResourceManager->FlexModelManager.InstanciateModel("tube"+tostr(i+1)+"_physics.xml"); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void TMyApplication::InnerInit() | ||||
| { | ||||
| 	 | ||||
| 	*Console<<"Inner init go!\n"; | ||||
| 
 | ||||
| #ifdef TARGET_ANDROID | ||||
|     ST::PathToResources = ""; | ||||
| #endif | ||||
| #ifdef TARGET_WIN32 | ||||
| #ifdef NDEBUG | ||||
| 	ST::PathToResources = "resources/"; | ||||
| #else | ||||
| 	ST::PathToResources = "../../../assets/"; | ||||
| #endif | ||||
| #endif | ||||
| #ifdef TARGET_IOS | ||||
|     ST::PathToResources = "assets/"; | ||||
| #endif | ||||
| 
 | ||||
| 	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->SoundManager.LoadMusic("level1ogg.ogg");
 | ||||
| 	 | ||||
|     //ResourceManager->SoundManager.LoadSound("shot.wav");
 | ||||
| 	 | ||||
| 	//Renderer->MovePhi(pi/6);
 | ||||
| 
 | ||||
| 	Renderer->Camera = TPitCamera(); | ||||
| 
 | ||||
| 	ResourceManager->LightManager.SetLightDirection(vec3(-1,0,-1)); | ||||
| 	ResourceManager->LightManager.SetLightColor(vec4(1,0,0,1)); | ||||
| 
 | ||||
| 	ResourceManager->TexList.AddTexture("pit.png"); | ||||
| 	ResourceManager->TexList.AddTexture("tube.png"); | ||||
| 	ResourceManager->TexList.AddTexture("tube_i.png"); | ||||
| 	//ResourceManager->FlexModelManager.LoadModelFromXml("model.xml");
 | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("box.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("pit.xml"); | ||||
| 
 | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube1.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube2.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube3.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube4.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube5.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube6.xml"); | ||||
| 
 | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube1_physics.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube2_physics.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube3_physics.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube4_physics.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube5_physics.xml"); | ||||
| 	ResourceManager->FlexModelManager.LoadModelFromXml("tube6_physics.xml"); | ||||
| 
 | ||||
| 	FlexModel = ResourceManager->FlexModelManager.InstanciateModel("pit.xml"); | ||||
| 
 | ||||
| 	 | ||||
| 	//FlexModel.MoveModel(vec3(0, -36.f, -105.f)); //Landscape screen
 | ||||
| 	FlexModel.MoveModel(vec3(0, -23.f, -50.f)); //Portrait screen
 | ||||
| 	FlexModel.ScaleModel(40.f); | ||||
| 	FlexModel.RefreshBuffer(); | ||||
| 
 | ||||
| 	TubeModelArr.resize(6); | ||||
| 	TubeBodyArr.resize(6); | ||||
| 
 | ||||
| 	for (size_t i = 0; i < TubeModelArr.size(); ++i) | ||||
| 	{ | ||||
| 		int modelNum = rand() % CONST_TUBE_COUNT; | ||||
| 		TubeModelArr[i] = GenerateFlexModel(modelNum); | ||||
| 		 | ||||
| 		TubeModelArr[i].PushModelDataTriangleList(); | ||||
| 		TubeModelArr[i].ScaleModel(25.4f); | ||||
| 		TubeModelArr[i].MoveModel(vec3(0, 0, -2500.f*i)); | ||||
| 
 | ||||
| 		TubeModelArr[i].RefreshBuffer(); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 		TubeBodyArr[i].AssignFromFlexModel(GeneratePhysicsModel(modelNum)); | ||||
| 		TubeBodyArr[i].Scale(25.4f); | ||||
| 		TubeBodyArr[i].Move(vec3(0, 0, -2500.f*i)); | ||||
| 
 | ||||
| 
 | ||||
| 		 | ||||
| 	} | ||||
| 	/*
 | ||||
| 	for (int i=0; i< CONST_MAX_BOXES; i++) | ||||
| 	{ | ||||
| 		BoxList.push_back(GenerateBox(i)); | ||||
| 	}*/ | ||||
| 
 | ||||
| 	//Uncomment to start music playing
 | ||||
| 	//ResourceManager->SoundManager.PlayMusic("level1ogg.ogg");
 | ||||
| 	 | ||||
| 	Velocity = CONST_VELOCITY; | ||||
| 
 | ||||
| 	PrevCamVec = boost::get<TPitCamera>(Renderer->Camera).CamVec; | ||||
| 
 | ||||
| 	RotateShift = vec2(0.f, 0.f); | ||||
| 
 | ||||
| 	*Console<<"Inner init end!\n"; | ||||
| } | ||||
| 
 | ||||
| void TMyApplication::InnerDeinit() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void TMyApplication::InnerDraw() | ||||
| { | ||||
|      | ||||
| 	glClearColor(0,0,0,1); | ||||
| 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | ||||
| 
 | ||||
| 	Renderer->PushPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 8500.f); | ||||
| 
 | ||||
| 	Renderer->PushMatrix(); | ||||
| 
 | ||||
|     Renderer->SetGLCamView(); | ||||
| 	 | ||||
| 	for (size_t i = 0; i < TubeModelArr.size(); ++i) | ||||
| 	{ | ||||
| 		TubeModelArr[i].Draw(); | ||||
| 	} | ||||
| 	 | ||||
| 	Renderer->PopMatrix(); | ||||
| 
 | ||||
| 	//Renderer->PopProjectionMatrix();
 | ||||
| 
 | ||||
| 	glClear(GL_DEPTH_BUFFER_BIT); | ||||
| 
 | ||||
| 	Renderer->PushMatrix(); | ||||
| 
 | ||||
| 	vec4 q; | ||||
| 
 | ||||
| 	vec3 camVec = boost::get<TPitCamera>(Renderer->Camera).CamVec; | ||||
| 
 | ||||
| 	vec4 camQuat = boost::get<TPitCamera>(Renderer->Camera).CameraQuat; | ||||
| 
 | ||||
| 	vec3 n = Normalize(CrossProduct(camVec, PrevCamVec)); | ||||
| 
 | ||||
| 	float cos_a = min(DotProduct(camVec, PrevCamVec), 1.f); | ||||
| 
 | ||||
| 	n = InverseQuat(camQuat) * vec4(n) * (camQuat); | ||||
| 
 | ||||
| 	float sin_a = sqrtf(1 - cos_a*cos_a); | ||||
| 
 | ||||
| 	if (sin_a > 0.001f) | ||||
| 	{ | ||||
| 
 | ||||
| 		q = vec4(n.v[0] * sin_a, n.v[1] * sin_a, n.v[2] * sin_a, cos_a); | ||||
| 		 | ||||
| 		Renderer->RotateMatrix(q); | ||||
| 	} | ||||
| 	FlexModel.Draw(); | ||||
| 
 | ||||
| 	Renderer->PopMatrix(); | ||||
| 
 | ||||
| 	Renderer->PopProjectionMatrix(); | ||||
| 
 | ||||
| 	 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void TMyApplication::InnerUpdate(cardinal dt) | ||||
| { | ||||
| 	vec3 camShift = boost::get<TPitCamera>(Renderer->Camera).CamShift; | ||||
| 
 | ||||
| 	vec3 camVec = boost::get<TPitCamera>(Renderer->Camera).CamVec; | ||||
| 
 | ||||
| 	camShift += camVec * (static_cast<float>(dt)*Velocity); | ||||
| 	 | ||||
| 	while (camShift.v[2] < -2500.f) | ||||
| 	{ | ||||
| 		camShift.v[2] += 2500.f; | ||||
| 
 | ||||
| 		TubeModelArr.erase(TubeModelArr.begin()); | ||||
| 		TFlexModel model; | ||||
| 		model = GenerateFlexModel(rand() % CONST_TUBE_COUNT); | ||||
| 		model.ScaleModel(25.4f); | ||||
| 		TubeModelArr.push_back(model); | ||||
| 
 | ||||
| 		for (size_t i = 0; i < TubeModelArr.size()-1; ++i) | ||||
| 		{ | ||||
| 			TubeModelArr[i].MoveModel(vec3(0, 0, 2500.f)); | ||||
| 			TubeModelArr[i].RefreshBuffer(); | ||||
| 		} | ||||
| 
 | ||||
| 		TubeModelArr[TubeModelArr.size()-1].MoveModel(vec3(0, 0, -2500.f*(TubeModelArr.size()-1))); | ||||
| 		TubeModelArr[TubeModelArr.size()-1].RefreshBuffer(); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 		TubeBodyArr.erase(TubeBodyArr.begin()); | ||||
| 		TVolumeBody body; | ||||
| 		body.AssignFromFlexModel(GeneratePhysicsModel(rand() % CONST_TUBE_COUNT)); | ||||
| 		body.Scale(25.4f); | ||||
| 		TubeBodyArr.push_back(body); | ||||
| 		 | ||||
| 		for (size_t i = 0; i < TubeBodyArr.size()-1; ++i) | ||||
| 		{ | ||||
| 			TubeBodyArr[i].Move(vec3(0, 0, 2500.f)); | ||||
| 		} | ||||
| 
 | ||||
| 		TubeBodyArr[TubeBodyArr.size()-1].Move(vec3(0, 0, -2500.f*(TubeBodyArr.size()-1))); | ||||
| 	 | ||||
| 	} | ||||
| 
 | ||||
| 	boost::get<TPitCamera>(Renderer->Camera).CamShift = camShift; | ||||
| 
 | ||||
| 	if (Velocity != 0) | ||||
| 	{ | ||||
| 
 | ||||
| 		vec3 a = boost::get<TPitCamera>(Renderer->Camera).CamShift; | ||||
| 		vec3 b = a + 100.f * boost::get<TPitCamera>(Renderer->Camera).CamVec; | ||||
| 
 | ||||
| 		if (a != b) | ||||
| 		{ | ||||
| 			BOOST_FOREACH(TVolumeBody& body, TubeBodyArr) | ||||
| 			{ | ||||
| 				if (body.CheckCollision(a,b)) | ||||
| 				{ | ||||
| 					Velocity = 0.f; | ||||
| 				} | ||||
| 			} | ||||
| 			/*
 | ||||
| 			BOOST_FOREACH(auto& i, BoxList) | ||||
| 			{ | ||||
| 				if (i.second.CheckCollision(a,b)) | ||||
| 				{ | ||||
| 					Velocity = 0.f; | ||||
| 				} | ||||
| 			}*/ | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	//const float CONST_ROTATE_SPEED = 0.0004f;
 | ||||
| 	const float CONST_ROTATE_SPEED = 0.001f; | ||||
| 
 | ||||
| 	float rotateShift = Length(RotateShift) * 0.01f / 2.f; | ||||
| 
 | ||||
| 	vec4 quat = vec4(RotateAxis.v[0] * sin(rotateShift*dt*CONST_ROTATE_SPEED), RotateAxis.v[1] * sin(rotateShift*dt*CONST_ROTATE_SPEED), RotateAxis.v[2] * sin(rotateShift*dt*CONST_ROTATE_SPEED), cos(rotateShift*dt*CONST_ROTATE_SPEED)); | ||||
| 
 | ||||
| 	boost::get<TPitCamera>(Renderer->Camera).RotateByQuat(quat); | ||||
| 
 | ||||
| 	boost::get<TPitCamera>(Renderer->Camera).CalcCamVec(); | ||||
| 
 | ||||
| 	UpdatePitVector(dt); | ||||
| 
 | ||||
| 
 | ||||
| 	OnUpdateSignal(); | ||||
| 
 | ||||
| 	OnUpdateSignal.disconnect_all_slots(); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void TMyApplication::InnerOnMove(vec2 shift) | ||||
| { | ||||
| 	 | ||||
| 	RotateShift += shift; | ||||
| 
 | ||||
| 	//float len = Length(shift);
 | ||||
| 
 | ||||
| 	vec3 rotation = Normalize(vec3(RotateShift, 0)); //Inverse
 | ||||
| 
 | ||||
| 	//rotation.v[1] =-rotation.v[1]; //Inverse
 | ||||
| 
 | ||||
| 	vec3 z = vec3(0,0,-1); | ||||
| 
 | ||||
| 	vec4 startQuat = boost::get<TPitCamera>(Renderer->Camera).CameraQuat; | ||||
| 
 | ||||
| 	RotateAxis = Normalize(CrossProduct(rotation, z)); | ||||
| 
 | ||||
| 	RotateAxis = startQuat * vec4(RotateAxis) * InverseQuat(startQuat); | ||||
| 	 | ||||
| 	//RotateShift = len * 0.01f / 2.f;
 | ||||
| 
 | ||||
| 	UpdatePitVector(0); | ||||
| } | ||||
| 
 | ||||
| void TMyApplication::InnerOnTapUp(vec2 p) | ||||
| { | ||||
| 	RotateShift = vec2(0.f, 0.f); | ||||
| 
 | ||||
| 	RotateAxis = vec3(0,0,0); | ||||
| 
 | ||||
| 	if (p.v[0] < 50 && p.v[1] < 50 && Velocity == 0) | ||||
| 	{ | ||||
| 		OnUpdateSignal.connect(boost::bind(&TMyApplication::RecreateLevel, this)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void TMyApplication::InnerOnTapUpAfterMove(vec2 p) | ||||
| { | ||||
| 	RotateShift = vec2(0.f, 0.f); | ||||
| 
 | ||||
| 	RotateAxis = vec3(0,0,0); | ||||
| } | ||||
| 
 | ||||
| void TMyApplication::OnMouseWheel(short int delta) | ||||
| { | ||||
| 	OnUpdateSignal.connect(boost::bind(&TMyApplication::RecreateLevel, this)); | ||||
| } | ||||
| 
 | ||||
| void TMyApplication::UpdatePitVector(cardinal dt) | ||||
| { | ||||
| 	 | ||||
| 	//Update pit vector
 | ||||
| 	vec3 camVec = boost::get<TPitCamera>(Renderer->Camera).CamVec; | ||||
| 
 | ||||
| 	vec4 q; | ||||
| 
 | ||||
| 	vec3 n = -Normalize(CrossProduct(camVec, PrevCamVec)); | ||||
| 
 | ||||
| 	float min_cos_a = min(DotProduct(camVec, PrevCamVec), 1.f); | ||||
| 
 | ||||
| 	const float diff_alpha = pi/96; | ||||
| 	 | ||||
| 	float angle = acos(min_cos_a); | ||||
| 
 | ||||
| 	 | ||||
| 	if (angle >= diff_alpha) | ||||
| 	{ | ||||
| 		//Correcting PrevCamVec;
 | ||||
| 
 | ||||
| 		min_cos_a = cosf(diff_alpha); | ||||
| 
 | ||||
| 		vec4 quat(-n.v[0]*sin(diff_alpha/2.f), -n.v[1]*sin(diff_alpha/2.f), -n.v[2]*sin(diff_alpha/2.f), cos(diff_alpha/2.f)); | ||||
| 
 | ||||
| 		PrevCamVec = quat * vec4(camVec) * InverseQuat(quat); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	//Catch up
 | ||||
| 
 | ||||
| 	const float omega = 0.0002f; | ||||
| 
 | ||||
| 	if (angle < omega*dt) | ||||
| 	{ | ||||
| 		PrevCamVec = camVec; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		vec4 delta_quat(n.v[0]*sin(omega * dt / 2.f), n.v[1]*sin(omega * dt / 2.f), n.v[2]*sin(omega * dt / 2.f), cos(omega * dt / 2.f)); | ||||
| 
 | ||||
| 		PrevCamVec = delta_quat * vec4(PrevCamVec) * InverseQuat(delta_quat); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	 | ||||
| } | ||||
| 
 | ||||
| void TMyApplication::RecreateLevel() | ||||
| { | ||||
| 	Velocity = CONST_VELOCITY; | ||||
| 	 | ||||
| 	boost::get<TPitCamera>(Renderer->Camera).CamShift = ZeroVec3; | ||||
| 
 | ||||
| 	for (size_t i = 0; i < 3; ++i) | ||||
| 	{ | ||||
| 		TubeModelArr[i] = GenerateFlexModel(0); | ||||
| 
 | ||||
| 		TubeModelArr[i].PushModelDataTriangleList(); | ||||
| 		TubeModelArr[i].ScaleModel(25.4f); | ||||
| 		TubeModelArr[i].MoveModel(vec3(0, 0, -2500.f*i)); | ||||
| 
 | ||||
| 		TubeModelArr[i].RefreshBuffer(); | ||||
| 
 | ||||
| 
 | ||||
| 		TubeBodyArr[i].AssignFromFlexModel(GeneratePhysicsModel(0)); | ||||
| 		TubeBodyArr[i].Scale(25.4f); | ||||
| 		TubeBodyArr[i].Move(vec3(0, 0, -2500.f*i)); | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
| @ -1,74 +0,0 @@ | ||||
| #ifndef MAIN_CODE_H_INCLUDED | ||||
| #define MAIN_CODE_H_INCLUDED | ||||
| 
 | ||||
| 
 | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <math.h> | ||||
| 
 | ||||
| #ifdef TARGET_ANDROID | ||||
| 
 | ||||
| #include <GLES/gl.h> | ||||
| #include <GLES2/gl2.h> | ||||
| #include <GLES2/gl2ext.h> | ||||
| #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 "include/Engine.h" | ||||
| 
 | ||||
| using namespace SE; | ||||
| 
 | ||||
| class TMyApplication : public TApplication | ||||
| { | ||||
| protected: | ||||
| 	 | ||||
| public: | ||||
| 	bool Inited; | ||||
| 
 | ||||
| 	float Velocity; | ||||
| 
 | ||||
| 	TFlexModel FlexModel; | ||||
| 
 | ||||
| 	std::vector<TFlexModel> TubeModelArr; | ||||
| 	std::vector<TVolumeBody> TubeBodyArr; | ||||
| 	//std::list<std::pair<TFlexModel, TVolumeBody>> BoxList;
 | ||||
| 
 | ||||
| 	vec3 PrevCamVec; | ||||
| 	vec3 RotateAxis; | ||||
| 	//float RotateShift;
 | ||||
| 	vec2 RotateShift; | ||||
| 
 | ||||
| 	boost::signal<void()> OnUpdateSignal; | ||||
| 
 | ||||
| 	TMyApplication() : TApplication(), Inited(false) { } | ||||
| 	 | ||||
|     virtual void InnerInit(); | ||||
|      | ||||
|     virtual void InnerDeinit(); | ||||
| 	 | ||||
| 	virtual void InnerDraw(); | ||||
| 	 | ||||
| 	virtual void InnerUpdate(cardinal dt); | ||||
| 	  | ||||
| 	bool IsInited() { return Inited; } | ||||
| 
 | ||||
| 	virtual void InnerOnMove(vec2 shift); | ||||
| 	virtual void InnerOnTapUp(vec2 p); | ||||
| 	virtual void InnerOnTapUpAfterMove(vec2 p); | ||||
| 
 | ||||
| 	virtual void OnMouseWheel(short int delta); | ||||
| 
 | ||||
| 	void UpdatePitVector(cardinal dt); | ||||
| 
 | ||||
| 	void RecreateLevel(); | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										1
									
								
								proj.android-studio/app/.gitignore
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										1
									
								
								proj.android-studio/app/.gitignore
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @ -0,0 +1 @@ | ||||
| /build | ||||
							
								
								
									
										96
									
								
								proj.android-studio/app/CMakeLists.txt
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										96
									
								
								proj.android-studio/app/CMakeLists.txt
									
									
									
									
									
										Executable file
									
								
							| @ -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. | ||||
|              Tunnel | ||||
| 
 | ||||
|              # 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. | ||||
|                        Tunnel | ||||
| 
 | ||||
|                        # Links the target library to the log library | ||||
|                        # included in the NDK. | ||||
|                        ${log-lib} ${GLESv2-lib} engine ) | ||||
							
								
								
									
										46
									
								
								proj.android-studio/app/build.gradle
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										46
									
								
								proj.android-studio/app/build.gradle
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,46 @@ | ||||
| apply plugin: 'com.android.application' | ||||
| 
 | ||||
| android { | ||||
|     compileSdkVersion 24 | ||||
|     buildToolsVersion "24.0.1" | ||||
|     defaultConfig { | ||||
|         applicationId "fishrungames.tunnel" | ||||
|         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') | ||||
| } | ||||
							
								
								
									
										17
									
								
								proj.android-studio/app/proguard-rules.pro
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								proj.android-studio/app/proguard-rules.pro
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @ -0,0 +1,17 @@ | ||||
| # Add project specific ProGuard rules here. | ||||
| # By default, the flags in this file are appended to flags specified | ||||
| # in C:\Android\sdk/tools/proguard/proguard-android.txt | ||||
| # You can edit the include path and order by changing the proguardFiles | ||||
| # directive in build.gradle. | ||||
| # | ||||
| # For more details, see | ||||
| #   http://developer.android.com/guide/developing/tools/proguard.html | ||||
| 
 | ||||
| # Add any project specific keep options here: | ||||
| 
 | ||||
| # If your project uses WebView with JS, uncomment the following | ||||
| # and specify the fully qualified class name to the JavaScript interface | ||||
| # class: | ||||
| #-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||||
| #   public *; | ||||
| #} | ||||
| @ -0,0 +1,26 @@ | ||||
| package fishrungames.tunnel; | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.support.test.InstrumentationRegistry; | ||||
| import android.support.test.runner.AndroidJUnit4; | ||||
| 
 | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| 
 | ||||
| import static org.junit.Assert.*; | ||||
| 
 | ||||
| /** | ||||
|  * Instrumentation test, which will execute on an Android device. | ||||
|  * | ||||
|  * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||||
|  */ | ||||
| @RunWith(AndroidJUnit4.class) | ||||
| public class ExampleInstrumentedTest { | ||||
|     @Test | ||||
|     public void useAppContext() throws Exception { | ||||
|         // Context of the app under test. | ||||
|         Context appContext = InstrumentationRegistry.getTargetContext(); | ||||
| 
 | ||||
|         assertEquals("fishrungames.salmonandroidtemplate", appContext.getPackageName()); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										78
									
								
								AndroidManifest.xml → proj.android-studio/app/src/main/AndroidManifest.xml
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										78
									
								
								AndroidManifest.xml → proj.android-studio/app/src/main/AndroidManifest.xml
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,39 +1,39 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!-- | ||||
| /* | ||||
| ** | ||||
| ** Copyright 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. | ||||
| */ | ||||
| --> | ||||
| 
 | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     package="fishrungames.salmonjnitemplate" android:versionCode="1" android:versionName="1.0.0"> | ||||
|     <application | ||||
|             android:icon="@drawable/ic_menu_template" android:label="Salmon Jni Template"> | ||||
|         <activity android:name="fishrungames.salmonjnitemplate.MainActivity" | ||||
|         		android:screenOrientation="portrait" | ||||
|                 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" | ||||
|             	android:launchMode="singleTask" | ||||
|             	android:configChanges="orientation|keyboardHidden" | ||||
|             	android:noHistory="true"> | ||||
|             <intent-filter> | ||||
|                 <action android:name="android.intent.action.MAIN" /> | ||||
|                 <category android:name="android.intent.category.LAUNCHER" /> | ||||
|             </intent-filter> | ||||
|         </activity> | ||||
|     </application> | ||||
|     <uses-feature android:glEsVersion="0x00020000"/> | ||||
|     <uses-sdk android:minSdkVersion="8"/> | ||||
| </manifest> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!-- | ||||
| /* | ||||
| ** | ||||
| ** Copyright 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. | ||||
| */ | ||||
| --> | ||||
| 
 | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     package="fishrungames.tunnel" android:versionCode="1" android:versionName="1.0.0"> | ||||
|     <application | ||||
|             android:icon="@drawable/ic_menu_template" android:label="Tunnel Game"> | ||||
|         <activity android:name="fishrungames.tunnel.MainActivity" | ||||
|         		android:screenOrientation="portrait" | ||||
|                 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" | ||||
|             	android:launchMode="singleTask" | ||||
|             	android:configChanges="orientation|keyboardHidden" | ||||
|             	android:noHistory="true"> | ||||
|             <intent-filter> | ||||
|                 <action android:name="android.intent.action.MAIN" /> | ||||
|                 <category android:name="android.intent.category.LAUNCHER" /> | ||||
|             </intent-filter> | ||||
|         </activity> | ||||
|     </application> | ||||
|     <uses-feature android:glEsVersion="0x00020000"/> | ||||
|     <uses-sdk android:minSdkVersion="8"/> | ||||
| </manifest> | ||||
							
								
								
									
										142
									
								
								src/fishrungames/salmonjnitemplate/GLView.java → proj.android-studio/app/src/main/java/fishrungames/tunnel/GLView.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										142
									
								
								src/fishrungames/salmonjnitemplate/GLView.java → proj.android-studio/app/src/main/java/fishrungames/tunnel/GLView.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,72 +1,72 @@ | ||||
| package fishrungames.salmonjnitemplate; | ||||
| 
 | ||||
| 
 | ||||
| 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.engine.GLViewAncestor; | ||||
| import fishrungames.engine.EngineWrapper; | ||||
| 
 | ||||
| 
 | ||||
| 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); | ||||
| 		init(false, 8, 0); //Add depth buffer! | ||||
| 	} | ||||
| 
 | ||||
| 	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.Init(width,height); | ||||
| 		} | ||||
| 
 | ||||
| 		public void onSurfaceCreated(GL10 gl, EGLConfig config) | ||||
| 		{ | ||||
| 			//Do nothing. | ||||
| 		} | ||||
| 	} | ||||
| package fishrungames.tunnel; | ||||
| 
 | ||||
| 
 | ||||
| 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; | ||||
| 
 | ||||
| 
 | ||||
| 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); | ||||
| 		init(false, 8, 0); //Add depth buffer! | ||||
| 	} | ||||
| 
 | ||||
| 	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.Init(width,height); | ||||
| 		} | ||||
| 
 | ||||
| 		public void onSurfaceCreated(GL10 gl, EGLConfig config) | ||||
| 		{ | ||||
| 			//Do nothing. | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										22
									
								
								src/fishrungames/salmonjnitemplate/JniWrapper.java → proj.android-studio/app/src/main/java/fishrungames/tunnel/JniWrapper.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										22
									
								
								src/fishrungames/salmonjnitemplate/JniWrapper.java → proj.android-studio/app/src/main/java/fishrungames/tunnel/JniWrapper.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,12 +1,12 @@ | ||||
| package fishrungames.salmonjnitemplate; | ||||
| 
 | ||||
| public class JniWrapper | ||||
| { | ||||
|     static { | ||||
|         System.loadLibrary("SalmonJniTemplate"); | ||||
|     } | ||||
| 
 | ||||
|     | ||||
|     public static native void Init(int width, int height); | ||||
|      | ||||
| package fishrungames.tunnel; | ||||
| 
 | ||||
| public class JniWrapper | ||||
| { | ||||
|     static { | ||||
|         System.loadLibrary("Tunnel"); | ||||
|     } | ||||
| 
 | ||||
|     | ||||
|     public static native void Init(int width, int height); | ||||
|      | ||||
| } | ||||
							
								
								
									
										222
									
								
								src/fishrungames/salmonjnitemplate/MainActivity.java → proj.android-studio/app/src/main/java/fishrungames/tunnel/MainActivity.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										222
									
								
								src/fishrungames/salmonjnitemplate/MainActivity.java → proj.android-studio/app/src/main/java/fishrungames/tunnel/MainActivity.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -1,112 +1,112 @@ | ||||
| package fishrungames.salmonjnitemplate; | ||||
| 
 | ||||
| import fishrungames.engine.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; | ||||
| /* | ||||
| import android.content.res.Resources; | ||||
| import android.content.res.XmlResourceParser; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Xml; | ||||
| import android.inputmethodservice.Keyboard; | ||||
| import android.inputmethodservice.KeyboardView; | ||||
| import android.view.ViewGroup.LayoutParams; | ||||
| import android.widget.LinearLayout; | ||||
| */ | ||||
| 
 | ||||
| //Deprecated | ||||
| //import java.lang.reflect.Field; | ||||
| 
 | ||||
| import java.lang.Math; | ||||
| 
 | ||||
| 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.salmonjnitemplate", 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.CallDestroy(); | ||||
| 		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; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| package fishrungames.tunnel; | ||||
| 
 | ||||
| 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; | ||||
| /* | ||||
| import android.content.res.Resources; | ||||
| import android.content.res.XmlResourceParser; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Xml; | ||||
| import android.inputmethodservice.Keyboard; | ||||
| import android.inputmethodservice.KeyboardView; | ||||
| import android.view.ViewGroup.LayoutParams; | ||||
| import android.widget.LinearLayout; | ||||
| */ | ||||
| 
 | ||||
| //Deprecated | ||||
| //import java.lang.reflect.Field; | ||||
| 
 | ||||
| import java.lang.Math; | ||||
| 
 | ||||
| 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.tunnel", 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.CallDestroy(); | ||||
| 		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; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB | 
| @ -1,4 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <string name="app_name">AndroidJniTemplate</string> | ||||
| </resources> | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <string name="app_name">AndroidJniTemplate</string> | ||||
| </resources> | ||||
| @ -0,0 +1,17 @@ | ||||
| package fishrungames.tunnel; | ||||
| 
 | ||||
| import org.junit.Test; | ||||
| 
 | ||||
| import static org.junit.Assert.*; | ||||
| 
 | ||||
| /** | ||||
|  * Example local unit test, which will execute on the development machine (host). | ||||
|  * | ||||
|  * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||||
|  */ | ||||
| public class ExampleUnitTest { | ||||
|     @Test | ||||
|     public void addition_isCorrect() throws Exception { | ||||
|         assertEquals(4, 2 + 2); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										23
									
								
								proj.android-studio/build.gradle
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								proj.android-studio/build.gradle
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,23 @@ | ||||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||||
| 
 | ||||
| buildscript { | ||||
|     repositories { | ||||
|         jcenter() | ||||
|     } | ||||
|     dependencies { | ||||
|         classpath 'com.android.tools.build:gradle:2.2.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 | ||||
| } | ||||
							
								
								
									
										17
									
								
								proj.android-studio/gradle.properties
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								proj.android-studio/gradle.properties
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,17 @@ | ||||
| # Project-wide Gradle settings. | ||||
| 
 | ||||
| # IDE (e.g. Android Studio) users: | ||||
| # Gradle settings configured through the IDE *will override* | ||||
| # any settings specified in this file. | ||||
| 
 | ||||
| # For more details on how to configure your build environment visit | ||||
| # http://www.gradle.org/docs/current/userguide/build_environment.html | ||||
| 
 | ||||
| # Specifies the JVM arguments used for the daemon process. | ||||
| # The setting is particularly useful for tweaking memory settings. | ||||
| org.gradle.jvmargs=-Xmx1536m | ||||
| 
 | ||||
| # When configured, Gradle will run in incubating parallel mode. | ||||
| # This option should only be used with decoupled projects. More details, visit | ||||
| # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||||
| # org.gradle.parallel=true | ||||
							
								
								
									
										
											BIN
										
									
								
								proj.android-studio/gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								proj.android-studio/gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										6
									
								
								proj.android-studio/gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								proj.android-studio/gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @ -0,0 +1,6 @@ | ||||
| #Mon Dec 28 10:00:20 PST 2015 | ||||
| distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
| zipStorePath=wrapper/dists | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip | ||||
							
								
								
									
										160
									
								
								proj.android-studio/gradlew
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										160
									
								
								proj.android-studio/gradlew
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @ -0,0 +1,160 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| ############################################################################## | ||||
| ## | ||||
| ##  Gradle start up script for UN*X | ||||
| ## | ||||
| ############################################################################## | ||||
| 
 | ||||
| # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||||
| DEFAULT_JVM_OPTS="" | ||||
| 
 | ||||
| APP_NAME="Gradle" | ||||
| APP_BASE_NAME=`basename "$0"` | ||||
| 
 | ||||
| # Use the maximum available, or set MAX_FD != -1 to use that value. | ||||
| MAX_FD="maximum" | ||||
| 
 | ||||
| warn ( ) { | ||||
|     echo "$*" | ||||
| } | ||||
| 
 | ||||
| die ( ) { | ||||
|     echo | ||||
|     echo "$*" | ||||
|     echo | ||||
|     exit 1 | ||||
| } | ||||
| 
 | ||||
| # OS specific support (must be 'true' or 'false'). | ||||
| cygwin=false | ||||
| msys=false | ||||
| darwin=false | ||||
| case "`uname`" in | ||||
|   CYGWIN* ) | ||||
|     cygwin=true | ||||
|     ;; | ||||
|   Darwin* ) | ||||
|     darwin=true | ||||
|     ;; | ||||
|   MINGW* ) | ||||
|     msys=true | ||||
|     ;; | ||||
| esac | ||||
| 
 | ||||
| # Attempt to set APP_HOME | ||||
| # Resolve links: $0 may be a link | ||||
| PRG="$0" | ||||
| # Need this for relative symlinks. | ||||
| while [ -h "$PRG" ] ; do | ||||
|     ls=`ls -ld "$PRG"` | ||||
|     link=`expr "$ls" : '.*-> \(.*\)$'` | ||||
|     if expr "$link" : '/.*' > /dev/null; then | ||||
|         PRG="$link" | ||||
|     else | ||||
|         PRG=`dirname "$PRG"`"/$link" | ||||
|     fi | ||||
| done | ||||
| SAVED="`pwd`" | ||||
| cd "`dirname \"$PRG\"`/" >/dev/null | ||||
| APP_HOME="`pwd -P`" | ||||
| cd "$SAVED" >/dev/null | ||||
| 
 | ||||
| CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | ||||
| 
 | ||||
| # Determine the Java command to use to start the JVM. | ||||
| if [ -n "$JAVA_HOME" ] ; then | ||||
|     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||||
|         # IBM's JDK on AIX uses strange locations for the executables | ||||
|         JAVACMD="$JAVA_HOME/jre/sh/java" | ||||
|     else | ||||
|         JAVACMD="$JAVA_HOME/bin/java" | ||||
|     fi | ||||
|     if [ ! -x "$JAVACMD" ] ; then | ||||
|         die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | ||||
| 
 | ||||
| Please set the JAVA_HOME variable in your environment to match the | ||||
| location of your Java installation." | ||||
|     fi | ||||
| else | ||||
|     JAVACMD="java" | ||||
|     which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||||
| 
 | ||||
| Please set the JAVA_HOME variable in your environment to match the | ||||
| location of your Java installation." | ||||
| fi | ||||
| 
 | ||||
| # Increase the maximum file descriptors if we can. | ||||
| if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then | ||||
|     MAX_FD_LIMIT=`ulimit -H -n` | ||||
|     if [ $? -eq 0 ] ; then | ||||
|         if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | ||||
|             MAX_FD="$MAX_FD_LIMIT" | ||||
|         fi | ||||
|         ulimit -n $MAX_FD | ||||
|         if [ $? -ne 0 ] ; then | ||||
|             warn "Could not set maximum file descriptor limit: $MAX_FD" | ||||
|         fi | ||||
|     else | ||||
|         warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | ||||
|     fi | ||||
| fi | ||||
| 
 | ||||
| # For Darwin, add options to specify how the application appears in the dock | ||||
| if $darwin; then | ||||
|     GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | ||||
| fi | ||||
| 
 | ||||
| # For Cygwin, switch paths to Windows format before running java | ||||
| if $cygwin ; then | ||||
|     APP_HOME=`cygpath --path --mixed "$APP_HOME"` | ||||
|     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | ||||
|     JAVACMD=`cygpath --unix "$JAVACMD"` | ||||
| 
 | ||||
|     # We build the pattern for arguments to be converted via cygpath | ||||
|     ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | ||||
|     SEP="" | ||||
|     for dir in $ROOTDIRSRAW ; do | ||||
|         ROOTDIRS="$ROOTDIRS$SEP$dir" | ||||
|         SEP="|" | ||||
|     done | ||||
|     OURCYGPATTERN="(^($ROOTDIRS))" | ||||
|     # Add a user-defined pattern to the cygpath arguments | ||||
|     if [ "$GRADLE_CYGPATTERN" != "" ] ; then | ||||
|         OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | ||||
|     fi | ||||
|     # Now convert the arguments - kludge to limit ourselves to /bin/sh | ||||
|     i=0 | ||||
|     for arg in "$@" ; do | ||||
|         CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | ||||
|         CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option | ||||
| 
 | ||||
|         if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition | ||||
|             eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | ||||
|         else | ||||
|             eval `echo args$i`="\"$arg\"" | ||||
|         fi | ||||
|         i=$((i+1)) | ||||
|     done | ||||
|     case $i in | ||||
|         (0) set -- ;; | ||||
|         (1) set -- "$args0" ;; | ||||
|         (2) set -- "$args0" "$args1" ;; | ||||
|         (3) set -- "$args0" "$args1" "$args2" ;; | ||||
|         (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | ||||
|         (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | ||||
|         (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | ||||
|         (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | ||||
|         (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | ||||
|         (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | ||||
|     esac | ||||
| fi | ||||
| 
 | ||||
| # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules | ||||
| function splitJvmOpts() { | ||||
|     JVM_OPTS=("$@") | ||||
| } | ||||
| eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS | ||||
| JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" | ||||
| 
 | ||||
| exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" | ||||
							
								
								
									
										90
									
								
								proj.android-studio/gradlew.bat
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										90
									
								
								proj.android-studio/gradlew.bat
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @ -0,0 +1,90 @@ | ||||
| @if "%DEBUG%" == "" @echo off | ||||
| @rem ########################################################################## | ||||
| @rem | ||||
| @rem  Gradle startup script for Windows | ||||
| @rem | ||||
| @rem ########################################################################## | ||||
| 
 | ||||
| @rem Set local scope for the variables with windows NT shell | ||||
| if "%OS%"=="Windows_NT" setlocal | ||||
| 
 | ||||
| @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||||
| set DEFAULT_JVM_OPTS= | ||||
| 
 | ||||
| set DIRNAME=%~dp0 | ||||
| if "%DIRNAME%" == "" set DIRNAME=. | ||||
| set APP_BASE_NAME=%~n0 | ||||
| set APP_HOME=%DIRNAME% | ||||
| 
 | ||||
| @rem Find java.exe | ||||
| if defined JAVA_HOME goto findJavaFromJavaHome | ||||
| 
 | ||||
| set JAVA_EXE=java.exe | ||||
| %JAVA_EXE% -version >NUL 2>&1 | ||||
| if "%ERRORLEVEL%" == "0" goto init | ||||
| 
 | ||||
| echo. | ||||
| echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||||
| echo. | ||||
| echo Please set the JAVA_HOME variable in your environment to match the | ||||
| echo location of your Java installation. | ||||
| 
 | ||||
| goto fail | ||||
| 
 | ||||
| :findJavaFromJavaHome | ||||
| set JAVA_HOME=%JAVA_HOME:"=% | ||||
| set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||||
| 
 | ||||
| if exist "%JAVA_EXE%" goto init | ||||
| 
 | ||||
| echo. | ||||
| echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||||
| echo. | ||||
| echo Please set the JAVA_HOME variable in your environment to match the | ||||
| echo location of your Java installation. | ||||
| 
 | ||||
| goto fail | ||||
| 
 | ||||
| :init | ||||
| @rem Get command-line arguments, handling Windowz variants | ||||
| 
 | ||||
| if not "%OS%" == "Windows_NT" goto win9xME_args | ||||
| if "%@eval[2+2]" == "4" goto 4NT_args | ||||
| 
 | ||||
| :win9xME_args | ||||
| @rem Slurp the command line arguments. | ||||
| set CMD_LINE_ARGS= | ||||
| set _SKIP=2 | ||||
| 
 | ||||
| :win9xME_args_slurp | ||||
| if "x%~1" == "x" goto execute | ||||
| 
 | ||||
| set CMD_LINE_ARGS=%* | ||||
| goto execute | ||||
| 
 | ||||
| :4NT_args | ||||
| @rem Get arguments from the 4NT Shell from JP Software | ||||
| set CMD_LINE_ARGS=%$ | ||||
| 
 | ||||
| :execute | ||||
| @rem Setup the command line | ||||
| 
 | ||||
| set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||||
| 
 | ||||
| @rem Execute Gradle | ||||
| "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% | ||||
| 
 | ||||
| :end | ||||
| @rem End local scope for the variables with windows NT shell | ||||
| if "%ERRORLEVEL%"=="0" goto mainEnd | ||||
| 
 | ||||
| :fail | ||||
| rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||||
| rem the _cmd.exe /c_ return code! | ||||
| if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 | ||||
| exit /b 1 | ||||
| 
 | ||||
| :mainEnd | ||||
| if "%OS%"=="Windows_NT" endlocal | ||||
| 
 | ||||
| :omega | ||||
							
								
								
									
										7
									
								
								proj.android-studio/settings.gradle
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								proj.android-studio/settings.gradle
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,7 @@ | ||||
| include ':SalmonEngineAndroid' | ||||
| project(':SalmonEngineAndroid').projectDir =new File(settingsDir, '../../engine/SalmonEngineAndroid/app') | ||||
| 
 | ||||
| 
 | ||||
| include ':app' | ||||
| 
 | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user