From 400193f457eb43f47aec50f34d3235e1e3eb12d6 Mon Sep 17 00:00:00 2001 From: "shakurov.airat" Date: Tue, 10 Jan 2017 18:10:05 +0500 Subject: [PATCH] delete files --- .classpath | 8 - .project | 33 - AndroidManifest.xml | 39 -- jni/Android.mk | 77 --- jni/Application.mk | 3 - jni/android_api.cpp | 10 - jni/android_api.h | 25 - jni/main_code.cpp | 567 ------------------ jni/main_code.h | 137 ----- res/drawable-hdpi/ic_menu_template.png | Bin 3527 -> 0 bytes res/drawable-ldpi/ic_menu_template.png | Bin 1460 -> 0 bytes res/drawable-mdpi/ic_menu_template.png | Bin 2111 -> 0 bytes res/values/strings.xml | 4 - .../salmonjnitemplate/GLView.java | 73 --- .../salmonjnitemplate/JniWrapper.java | 12 - .../salmonjnitemplate/MainActivity.java | 94 --- 16 files changed, 1082 deletions(-) delete mode 100644 .classpath delete mode 100644 .project delete mode 100644 AndroidManifest.xml delete mode 100644 jni/Android.mk delete mode 100644 jni/Application.mk delete mode 100644 jni/android_api.cpp delete mode 100644 jni/android_api.h delete mode 100644 jni/main_code.cpp delete mode 100644 jni/main_code.h delete mode 100644 res/drawable-hdpi/ic_menu_template.png delete mode 100644 res/drawable-ldpi/ic_menu_template.png delete mode 100644 res/drawable-mdpi/ic_menu_template.png delete mode 100644 res/values/strings.xml delete mode 100644 src/fishrungames/salmonjnitemplate/GLView.java delete mode 100644 src/fishrungames/salmonjnitemplate/JniWrapper.java delete mode 100644 src/fishrungames/salmonjnitemplate/MainActivity.java diff --git a/.classpath b/.classpath deleted file mode 100644 index 36de7ba..0000000 --- a/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index 4c7a50f..0000000 --- a/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - EngineWrapper - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/AndroidManifest.xml b/AndroidManifest.xml deleted file mode 100644 index cd9d963..0000000 --- a/AndroidManifest.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/jni/Android.mk b/jni/Android.mk deleted file mode 100644 index d648ff4..0000000 --- a/jni/Android.mk +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2009 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -LPATH := $(call my-dir) - -ENGINE_PATH = $(SalmonEnginePathCygwin) - -BOOST_PATH = $(LibsPathCygwin)/boost_1_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/jni/Application.mk b/jni/Application.mk deleted file mode 100644 index 22476ec..0000000 --- a/jni/Application.mk +++ /dev/null @@ -1,3 +0,0 @@ -APP_STL := gnustl_shared -APP_CPPFLAGS += -fexceptions -APP_CPPFLAGS += -frtti diff --git a/jni/android_api.cpp b/jni/android_api.cpp deleted file mode 100644 index 7e723d8..0000000 --- a/jni/android_api.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "android_api.h" - -#include "main_code.h" - - -JNIEXPORT void JNICALL Java_fishrungames_salmonjnitemplate_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height) -{ - JniInitApp(width, height, 480.f, 320.f); -} - diff --git a/jni/android_api.h b/jni/android_api.h deleted file mode 100644 index c195e7f..0000000 --- a/jni/android_api.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef ANDROID_API_H_INCLUDED -#define ANDROID_API_H_INCLUDED - -#include -#include - -#include -#include -#include - -#include "boost/shared_ptr.hpp" - -#include "main_code.h" - -#include "include/Engine.h" - -using namespace SE; - - -extern "C" { - JNIEXPORT void JNICALL Java_fishrungames_salmonjnitemplate_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height); -}; - - -#endif diff --git a/jni/main_code.cpp b/jni/main_code.cpp deleted file mode 100644 index 0c2cb71..0000000 --- a/jni/main_code.cpp +++ /dev/null @@ -1,567 +0,0 @@ -#include "main_code.h" - -#ifdef TARGET_ANDROID -#include "android_api.h" -#endif - -#include -#include -#include -#include - -#include "include/Engine.h" - -#include "main_code.h" - -//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/jni/main_code.h b/jni/main_code.h deleted file mode 100644 index 5fc2e23..0000000 --- a/jni/main_code.h +++ /dev/null @@ -1,137 +0,0 @@ -#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/res/drawable-hdpi/ic_menu_template.png b/res/drawable-hdpi/ic_menu_template.png deleted file mode 100644 index 1e28f93d8bf36cfbf1dff6efe4b4e1d0983dd616..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3527 zcmV;&4LI_NP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv000d(NklieUA6VXP(jj(-Y7W&=b%T&=b%T z&=b%T&=b%T&=b%T&=dF;0*8AKKOfi{_!plBpQ!zf`>*;o`8MFS!n?uyjOSfX2ah`* zKmA_9i;>5y2q?WWx)Zv}s#0r)LtNoh&=5VdWt=`Suwa)d$?+qxx zSPd}da7wR#t3O3{MbhcP)097vPuHfdQH834N+wI_{OEa#=!_shnsLA7o^E^1_D$=n z)&@EaDs?1v<-z8I=2-MtP+Jhi_Qq27cs5n3s;F+dZjoxIYpHm$n2z=xCBU3?y6Kc^ zbIs;8v&&|>38_F?U=ZCM{U`5x-h(0SA(S9bpq%j>;hJ()Ih9X6CX8KIU8l>+%M>S% zBhNdYgZ35neilU*FX*I;&W)aX5peQ+8+|G9ej-U{q*SY_C4i&C$-+e{nk*ug7*`h3 z#j%SN)*hzbTeJ6uWr^iSIteJIC+3f?^{x~CE&g<7;0(#8WmG;{P8s7FlsTTcNLdfE zh@~0N7|Wo<{zUS+>!q+Qx819g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F*;o1}rU$rXV#!QH|GGj7SqPtOQ`4``0myNH2m@G0%>QKT)(fuz z^lE7NyJjg+fMdXrjE%qKkozG3{Rn_w1)$deXd~eKgatqw0qAuA;xKvzfYxLFS^!!J zILq_T%sOXx{etua^aS(-^aS(-^aS(-^aP$t;QxTmKE9O#>rDUv002ovPDHLkV1hz% BkiY-{ diff --git a/res/drawable-ldpi/ic_menu_template.png b/res/drawable-ldpi/ic_menu_template.png deleted file mode 100644 index 6a93cf262ac93c29c5e5e9a6351cb91254a24143..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1460 zcmV;l1xxygP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv000FeNkl#9E$f(gS{x;_%S=j#(jm9YwVBq;;Kbp?_x<`R#jau+3OXs7mfS6Im29@IwL-VI z8}#dX-woG|)%5Z7yhu~z2YwTULJp%l)paX%TL!NI44Ve%+Uz1}f8Gx2d9^pDKZeIP zu;28HD8abkwAdzI?C^Aec1;Vlo?56~tA)C?I&xmIQUPg}G+lIG^t*l$lrWU=y>wdY zy}5D|id;pYS<>uMvRDFYry7J-p^-nt_fOg42IJ0RPTV<;98k@xpwL+eg)Rg~)q)DL z?b(n#n%u)13#cZKhd zGDStiKaO9u19{!vZN0qfpG!q*B|#%*@H7SFc*W5(>w^$;cQ#gY%OD!Dvuw>d4!P ziI2%QKVN^I7SbFN#LzQ-VBTW})7$9Z;q!--2q89+NNj<~$0E^WFj6KKTg@`rv@<7X z#)YE=*R<*B7JhQ_(3kP?{Rb&K_@6e)&Ylj;%$)cf-B4s@StoOIXT22_Pq!NyR((31 z2b!AP+xYxap_o|`2*zp?68gW5it0Y_T11tWKBY+{Q=bWi6ThG<9<_SjheE(;+<<|B z7ce;Zf*ehz4XCeQ1*Ouyk&-f`<#LUunM@t^!Br^i@1Z+M=*(hSnG;%DJzy|+p{HkK zm)_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{)LEq0U-{g)e=&}jntwQfHc8zH=?zOs9E8-=A)15e~-26 zv6kPX^p}PB`c?^ieRUf_=7WHMxw&zJ2?CyqViXy$X@~i>i@(9Zri5+>9%dUjS&6+ p{VDl%1bOFp9q>Bfb>NvD_&0Z)CI#|c81Mi9002ovPDHLkV1j%I4U+%> diff --git a/res/values/strings.xml b/res/values/strings.xml deleted file mode 100644 index 33d1455..0000000 --- a/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - AndroidJniTemplate - diff --git a/src/fishrungames/salmonjnitemplate/GLView.java b/src/fishrungames/salmonjnitemplate/GLView.java deleted file mode 100644 index 0536d75..0000000 --- a/src/fishrungames/salmonjnitemplate/GLView.java +++ /dev/null @@ -1,73 +0,0 @@ -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); - } - - 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/src/fishrungames/salmonjnitemplate/JniWrapper.java b/src/fishrungames/salmonjnitemplate/JniWrapper.java deleted file mode 100644 index e7022b8..0000000 --- a/src/fishrungames/salmonjnitemplate/JniWrapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package fishrungames.salmonjnitemplate; - -public class JniWrapper -{ - static { - System.loadLibrary("SalmonJniTemplate"); - } - - - public static native void Init(int width, int height); - -} \ No newline at end of file diff --git a/src/fishrungames/salmonjnitemplate/MainActivity.java b/src/fishrungames/salmonjnitemplate/MainActivity.java deleted file mode 100644 index 85b05c2..0000000 --- a/src/fishrungames/salmonjnitemplate/MainActivity.java +++ /dev/null @@ -1,94 +0,0 @@ -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; - - - -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.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