move to AS
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry exported="true" 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
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>SLWP</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,77 +0,0 @@
|
||||
# Copyright (C) 2009 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
LPATH := $(call my-dir)
|
||||
|
||||
ENGINE_PATH = $(SalmonEnginePathCygwin)
|
||||
|
||||
BOOST_PATH = $(LibsPathCygwin)/boost_1_52_0
|
||||
|
||||
OGG_PATH = $(LibsPathCygwin)/libogg-1.3.0
|
||||
|
||||
VORBIS_PATH = $(LibsPathCygwin)/libvorbis-1.3.2
|
||||
|
||||
SQUIRREL_PATH = $(LibsPathCygwin)/sqplus
|
||||
|
||||
LIBPNG_PATH = $(LibsPathCygwin)/libpng_1.4.1_android
|
||||
|
||||
ZIP_PATH = $(LibsPathCygwin)/julienr-libzip-android/jni
|
||||
|
||||
#====== ENGINE AND LIBS =====================
|
||||
|
||||
include $(ENGINE_PATH)/Android_Salmon_Engine.mk
|
||||
|
||||
#================= THE GAME =======================
|
||||
|
||||
|
||||
LOCAL_PATH:= $(LPATH)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_CFLAGS := -DTARGET_ANDROID -DNOSOUND -std=gnu++11 --std=c++11
|
||||
LOCAL_STATIC_LIBRARIES := boost
|
||||
LOCAL_STATIC_LIBRARIES += squirrel
|
||||
LOCAL_STATIC_LIBRARIES += png_lib
|
||||
LOCAL_STATIC_LIBRARIES += zip
|
||||
LOCAL_SHARED_LIBRARIES := SalmonEngine
|
||||
LOCAL_SHARED_LIBRARIES += gnustl_shared
|
||||
LOCAL_C_INCLUDES := $(ENGINE_PATH)
|
||||
LOCAL_C_INCLUDES += $(BOOST_PATH)
|
||||
LOCAL_C_INCLUDES += $(VORBIS_PATH)/include
|
||||
LOCAL_C_INCLUDES += $(VORBIS_PATH)/include/vorbis
|
||||
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib
|
||||
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/books
|
||||
LOCAL_C_INCLUDES += $(VORBIS_PATH)/lib/modes
|
||||
LOCAL_C_INCLUDES += $(OGG_PATH)/include
|
||||
LOCAL_C_INCLUDES += $(OGG_PATH)/include/ogg
|
||||
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/include
|
||||
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/sqplus
|
||||
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/squirrel
|
||||
LOCAL_C_INCLUDES += $(SQUIRREL_PATH)/sqstdlib
|
||||
LOCAL_C_INCLUDES += $(LIBPNG_PATH)
|
||||
LOCAL_C_INCLUDES += $(ZIP_PATH)
|
||||
LOCAL_MODULE := SalmonWallpaper
|
||||
LOCAL_SRC_FILES := main_code.cpp
|
||||
LOCAL_SRC_FILES += android_api.cpp
|
||||
|
||||
LOCAL_LDLIBS := -lGLESv2
|
||||
LOCAL_LDLIBS += -llog -Wl
|
||||
|
||||
#debug
|
||||
#LOCAL_CFLAGS += -g -ggdb -O0
|
||||
#LOCAL_LDLIBS += -g -ggdb
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
@ -1,3 +0,0 @@
|
||||
APP_STL := gnustl_shared
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
APP_CPPFLAGS += -frtti
|
@ -1,49 +0,0 @@
|
||||
#include "android_api.h"
|
||||
|
||||
#include "main_code.h"
|
||||
#include "boost\thread.hpp"
|
||||
|
||||
TAndroidApplication* Application = NULL;
|
||||
|
||||
|
||||
float lastOffsetX = 0.5f;
|
||||
|
||||
const float CONST_ANGLE_SHIFT = 45.f;
|
||||
|
||||
int TimeOfDayPref = 0;
|
||||
bool SnowPref = false;
|
||||
|
||||
bool OffsetChanged = false;
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetTimeOfDayPref(JNIEnv * env, jobject obj, jint timeofday)
|
||||
{
|
||||
TimeOfDayPref = timeofday;
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetSnowPref(JNIEnv * env, jobject obj, jboolean snow)
|
||||
{
|
||||
SnowPref = snow;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height)
|
||||
{
|
||||
|
||||
Application = JniInitApp<TAndroidApplication>(width, height, 800.f, 480.f);
|
||||
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f);
|
||||
Application->SkyTexShift = lastOffsetX*0.01f;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetOffset(JNIEnv * env, jobject obj, jfloat offsetX, jfloat offsetY)
|
||||
{
|
||||
|
||||
if (Renderer != NULL)
|
||||
{
|
||||
OffsetChanged = true;
|
||||
Application->SkyTexShift = offsetX*0.01f;
|
||||
lastOffsetX = offsetX;
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f);
|
||||
}
|
||||
}
|
@ -1,30 +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_mountainwallpaper_JniWrapper_SetTimeOfDayPref(JNIEnv * env, jobject obj, jint timeofday);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetSnowPref(JNIEnv * env, jobject obj, jboolean snow);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetOffset(JNIEnv * env, jobject obj, jfloat offsetX, jfloat offsetY);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -1,550 +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"
|
||||
|
||||
bool makeShot = true;
|
||||
|
||||
|
||||
extern int TimeOfDayPref;
|
||||
extern bool SnowPref;
|
||||
|
||||
extern float lastOffsetX;
|
||||
|
||||
#ifdef TARGET_WIN32
|
||||
int TimeOfDayPref = 0;
|
||||
bool SnowPref = false;
|
||||
|
||||
#else
|
||||
extern int TimeOfDayPref;
|
||||
extern bool SnowPref;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
boost::mutex m2;
|
||||
|
||||
|
||||
class LoadingQueueVisitor : public boost::static_visitor<void>
|
||||
{
|
||||
public:
|
||||
void operator()(boost::function<cardinal()> f) const
|
||||
{
|
||||
f();
|
||||
}
|
||||
|
||||
void operator()(boost::function<bool()> f) const
|
||||
{
|
||||
f();
|
||||
}
|
||||
|
||||
void operator()(boost::function<void()> f) const
|
||||
{
|
||||
f();
|
||||
}
|
||||
};
|
||||
|
||||
TAndroidApplication::TAndroidApplication()
|
||||
: TApplication()
|
||||
, Inited(false)
|
||||
, Loaded(false)
|
||||
, LiteModel(NULL)
|
||||
, WaterTimer(0)
|
||||
, SnowTimer(0)
|
||||
, CloudTimer(0)
|
||||
, SkyTexShift(0)
|
||||
, WaveDir(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void TAndroidApplication::Serialize(boost::property_tree::ptree& propertyTree)
|
||||
{
|
||||
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, propertyTree.get_child("Ices"))
|
||||
{
|
||||
|
||||
std::string modelName = v.second.get<std::string>("ModelName");
|
||||
float posx = v.second.get<float>("PosX");
|
||||
float posz = v.second.get<float>("PosZ");
|
||||
|
||||
float angle = v.second.get<float>("Angle", 0.f);
|
||||
float scale = v.second.get<float>("Scale", 1.f);
|
||||
|
||||
mat3 m(vec4(0, cos(angle*pi/360.f), 0, sin(angle*pi/360.f)));
|
||||
|
||||
IceModel.push_back(TLiteModel());
|
||||
IceModel[IceModel.size()-1].LoadModel(modelName);
|
||||
IceModel[IceModel.size()-1].RotateModel(m);
|
||||
IceModel[IceModel.size()-1].ScaleModel(scale);
|
||||
IceModel[IceModel.size()-1].MoveModel(vec3(posx, 0, posz));
|
||||
|
||||
|
||||
IceModel[IceModel.size()-1].UpdateVBO();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TAndroidApplication::LoadModels()
|
||||
{
|
||||
mat3 m(vec4(0,1*sin(pi/8 + pi/2),0,1*cos(pi/8 + pi/2)));
|
||||
|
||||
LiteModel = new TLiteModel;
|
||||
LiteModel->LoadModel("mountain.lm1");
|
||||
LiteModel->ScaleModel(0.5f);
|
||||
LiteModel->RotateModel(m);
|
||||
LiteModel->MoveModel(vec3(0, 0, 0));
|
||||
LiteModel->UpdateVBO();
|
||||
|
||||
std::shared_ptr<boost::property_tree::ptree> p = FileToPropertyTree("ices.xml");
|
||||
|
||||
Serialize(*p);
|
||||
|
||||
}
|
||||
|
||||
void TAndroidApplication::AddFrameBuffers()
|
||||
{
|
||||
ResourceManager->FrameManager.AddFrameRenderBuffer("WaterFrame", 256, 256);
|
||||
ResourceManager->FrameManager.AddFrameRenderBuffer("ScreenshotFrame", 512, 512);
|
||||
|
||||
}
|
||||
|
||||
void TAndroidApplication::DrawSceneWithoutWater(bool inv)
|
||||
{
|
||||
|
||||
|
||||
Renderer->PushProjectionMatrix(1,1);
|
||||
Renderer->LoadIdentity();
|
||||
|
||||
if (inv)
|
||||
{
|
||||
|
||||
|
||||
if (TimeOfDayPref == 2)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky_night.png"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]);
|
||||
}
|
||||
Renderer->DrawRect(vec2(0.0f, 0.56f), vec2(1.f, 0.f), vec2(0.5f + SkyTexShift, 0.f), vec2(1.f + SkyTexShift, 1.f));
|
||||
|
||||
if (TimeOfDayPref == 1)
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]);
|
||||
Renderer->DrawRect(vec2(0.0f, 0.56f), vec2(4.f, 0.f), vec2(0.0f + SkyTexShift + CloudTimer, 0.f), vec2(1.f + SkyTexShift + CloudTimer, 0.5f));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TimeOfDayPref == 2)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky_night.png"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]);
|
||||
}
|
||||
Renderer->DrawRect(vec2(0.0f, 0.54f), vec2(1.f, 1.f), vec2(0.5f + SkyTexShift, 0.f), vec2(1.f + SkyTexShift, 1.f));
|
||||
|
||||
if (TimeOfDayPref == 1)
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]);
|
||||
Renderer->DrawRect(vec2(0.0f, 0.54f), vec2(4.f, 1.f), vec2(0.0f + SkyTexShift + CloudTimer, 0.f), vec2(1.f + SkyTexShift + CloudTimer, 0.5f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Renderer->PopProjectionMatrix();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
Renderer->SetGLCamView();
|
||||
|
||||
if (inv)
|
||||
{
|
||||
Renderer->TranslateMatrix(vec3(0,0.1f,0));
|
||||
Renderer->ScaleMatrix(vec3(1, -1, 1));
|
||||
}
|
||||
|
||||
Renderer->PushShader("SimplelightShader");
|
||||
|
||||
vec3 dayColor = vec3(0,0,0);
|
||||
vec3 nightColor = vec3(0, 0.1f, 0.2f);
|
||||
|
||||
if (TimeOfDayPref == 0)
|
||||
{
|
||||
RenderUniform3fv("TimeOfDayColor", dayColor.v);
|
||||
RenderUniform1f("TimeOfDayCoef1", 0.75f);
|
||||
RenderUniform1f("TimeOfDayCoef2", 0.25f);
|
||||
}
|
||||
else
|
||||
if (TimeOfDayPref == 1)
|
||||
{
|
||||
RenderUniform3fv("TimeOfDayColor", dayColor.v);
|
||||
RenderUniform1f("TimeOfDayCoef1", 0.5f);
|
||||
RenderUniform1f("TimeOfDayCoef2", 0.25f);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderUniform3fv("TimeOfDayColor", nightColor.v);
|
||||
RenderUniform1f("TimeOfDayCoef1", 0.0f);
|
||||
RenderUniform1f("TimeOfDayCoef2", 0.4f);
|
||||
}
|
||||
|
||||
|
||||
Renderer->PushPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 450.f);
|
||||
|
||||
LiteModel->DrawVBO();
|
||||
|
||||
for (int i=0; i<IceModel.size(); i++)
|
||||
{
|
||||
IceModel[i].DrawVBO();
|
||||
}
|
||||
|
||||
Renderer->PopProjectionMatrix();
|
||||
|
||||
Renderer->PopShader();
|
||||
}
|
||||
|
||||
void TAndroidApplication::DrawSnow()
|
||||
{
|
||||
|
||||
Renderer->PushProjectionMatrix(1,1);
|
||||
|
||||
Renderer->LoadIdentity();
|
||||
|
||||
const float multiply_x = 4;
|
||||
const float multiply_y = 2;
|
||||
|
||||
Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f), vec2(-SkyTexShift, SnowTimer), vec2(multiply_x - SkyTexShift, multiply_y + SnowTimer));
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f), vec2(SnowTimer*0.7f+0.3f - SkyTexShift, SnowTimer+0.7f), vec2(multiply_x - SkyTexShift + SnowTimer*0.7f+0.3f, multiply_y + SnowTimer+0.7f));
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f), vec2(SnowTimer*0.4f+0.7f - SkyTexShift, SnowTimer+0.3f), vec2(multiply_x - SkyTexShift + SnowTimer*0.4f+0.7f, multiply_y + SnowTimer+0.3f));
|
||||
|
||||
Renderer->PopProjectionMatrix();
|
||||
}
|
||||
|
||||
void TAndroidApplication::DrawAllScene(bool toScreen)
|
||||
{
|
||||
glClearColor(0.f, 0.f, 0.f, 1.0f);
|
||||
//glClearColor(1.f, 1.f, 1.f, 1.0f);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
Renderer->PushMatrix();
|
||||
Renderer->SetGLCamView();
|
||||
|
||||
Renderer->PushShader("ClipShader");
|
||||
|
||||
|
||||
Renderer->SwitchToFrameBuffer("WaterFrame");
|
||||
Renderer->SetGLCamView();
|
||||
Renderer->ScaleMatrix(vec3(1, -1, 1));
|
||||
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
DrawSceneWithoutWater(true);
|
||||
|
||||
Renderer->ScaleMatrix(vec3(1, -1, 1));
|
||||
|
||||
if (toScreen)
|
||||
{
|
||||
Renderer->SwitchToScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
Renderer->SwitchToFrameBuffer("ScreenshotFrame");
|
||||
}
|
||||
|
||||
Renderer->SetGLCamView();
|
||||
|
||||
Renderer->PushShader("NormShader");
|
||||
RenderUniform1f("Time", WaterTimer);
|
||||
if (Renderer->GetScreenWidth() < 600)
|
||||
{
|
||||
RenderUniform1f("WaterScale", 0.7f);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderUniform1f("WaterScale", 1.f);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["water_nmap.png"]);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (toScreen)
|
||||
{
|
||||
Renderer->SetFullScreenViewport();
|
||||
}
|
||||
else
|
||||
{
|
||||
Renderer->SetFrameViewport("ScreenshotFrame");
|
||||
}
|
||||
Renderer->DrawFramePartScreen("WaterFrame", vec2(0, 0), vec2(1.f, 0.54f));
|
||||
Renderer->PopShader();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
Renderer->SetGLCamView();
|
||||
|
||||
|
||||
DrawSceneWithoutWater(false);
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["snow.png"]);
|
||||
|
||||
if (SnowPref)
|
||||
{
|
||||
DrawSnow();
|
||||
}
|
||||
|
||||
Renderer->PopShader();
|
||||
|
||||
Renderer->PopMatrix();
|
||||
}
|
||||
|
||||
void TAndroidApplication::InnerInit()
|
||||
{
|
||||
m2.lock();
|
||||
|
||||
CheckGlError();
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
*Console<<"Inner init go!\n";
|
||||
|
||||
#ifdef TARGET_ANDROID
|
||||
ST::PathToResources = "";
|
||||
#endif
|
||||
#ifdef TARGET_WIN32
|
||||
ST::PathToResources = "../../assets/";
|
||||
#endif
|
||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "gui_transparent.vertex", "gui_transparent.fragment");
|
||||
Renderer->PushShader("DefaultShader");
|
||||
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "ClipShader", "gui_transparent_clip.vertex", "gui_transparent_clip.fragment")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "NormShader", "test_norm.vertex", "test_norm.fragment")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "ParallaxShader", "test_parallax.vertex", "test_parallax.fragment")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TShaderManager::AddShader, &(ResourceManager->ShaderManager), "SimplelightShader", "test_simplelight.vertex", "test_simplelight.fragment")));
|
||||
|
||||
if (IsFileExistsInUserData("file.bmp"))
|
||||
{
|
||||
ResourceManager->TexList.AddTextureFromUserdata("file.bmp", "ScreenshotTexture");
|
||||
}
|
||||
else
|
||||
{
|
||||
ResourceManager->TexList.AddTexture("file.bmp", "ScreenshotTexture");
|
||||
}
|
||||
|
||||
LoadingQueue.push_back(boost::function<cardinal()>(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "console_bkg.bmp", "")));
|
||||
LoadingQueue.push_back(boost::function<cardinal()>(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "water_nmap.png", "")));
|
||||
LoadingQueue.push_back(boost::function<cardinal()>(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "sky.png", "")));
|
||||
LoadingQueue.push_back(boost::function<cardinal()>(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "sky_night.png", "")));
|
||||
LoadingQueue.push_back(boost::function<cardinal()>(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "snow.png", "")));
|
||||
LoadingQueue.push_back(boost::function<cardinal()>(boost::bind(&TTextureListClass::AddTexture, &(ResourceManager->TexList), "final_cloud.png", "")));
|
||||
|
||||
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "mountain.lm1", "")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice1.lm1", "")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice2.lm1", "")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice3.lm1", "")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice4.lm1", "")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice5.lm1", "")));
|
||||
LoadingQueue.push_back(boost::function<bool()>(boost::bind(&TModelManager::AddLiteModel, &(ResourceManager->ModelManager), "ice6.lm1", "")));
|
||||
|
||||
LoadingQueue.push_back(boost::function<void()>(boost::bind(&TAndroidApplication::LoadModels, this)));
|
||||
LoadingQueue.push_back(boost::function<void()>(boost::bind(&TAndroidApplication::AddFrameBuffers, this)));
|
||||
|
||||
|
||||
|
||||
//LoadModels();
|
||||
|
||||
CheckGlError();
|
||||
|
||||
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MovePhi(pi/32);
|
||||
|
||||
|
||||
if (Renderer->GetScreenWidth() > Renderer->GetScreenHeight())
|
||||
{
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MoveDist(30.f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MoveDist(45.f);
|
||||
}
|
||||
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).CalcCamVec();
|
||||
|
||||
CheckGlError();
|
||||
|
||||
ResourceManager->LightManager.SetLightOn();
|
||||
|
||||
ResourceManager->LightManager.SetLightDirection(vec3(1, -1, 0));
|
||||
|
||||
//AddFrameBuffers();
|
||||
|
||||
//Renderer->SetPerspectiveFullScreenViewport();
|
||||
|
||||
if (Renderer->GetScreenWidth() < Renderer->GetScreenHeight())
|
||||
{
|
||||
Renderer->SetMatrixWidth(480);
|
||||
Renderer->SetMatrixHeight(800);
|
||||
}
|
||||
|
||||
Renderer->PushPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth() / Renderer->GetMatrixHeight(), 1.f, 400.f);
|
||||
|
||||
*Console<<"Inner init end!\n";
|
||||
|
||||
m2.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TAndroidApplication::InnerDeinit()
|
||||
{
|
||||
m2.lock();
|
||||
Inited = false;
|
||||
Loaded = false;
|
||||
|
||||
makeShot = true;
|
||||
LoadingQueue.clear();
|
||||
|
||||
if (LiteModel != NULL)
|
||||
{
|
||||
LiteModel->FreeModel();
|
||||
delete LiteModel;
|
||||
LiteModel = NULL;
|
||||
}
|
||||
|
||||
IceModel.clear();
|
||||
|
||||
SimpleLand = std::shared_ptr<TSimpleLandClass>();
|
||||
SimpleLandInv = std::shared_ptr<TSimpleLandClass>();
|
||||
m2.unlock();
|
||||
}
|
||||
|
||||
|
||||
void TAndroidApplication::InnerDraw()
|
||||
{
|
||||
m2.lock();
|
||||
if (!Loaded)
|
||||
{
|
||||
glClearColor(0.f, 0.f, 0.f, 1.0f);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["ScreenshotTexture"]);
|
||||
Renderer->PushProjectionMatrix(1,1);
|
||||
Renderer->LoadIdentity();
|
||||
Renderer->DrawRect(vec2(0, 0), vec2(1.f, 1.f));
|
||||
Renderer->PopProjectionMatrix();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
DrawAllScene(true);
|
||||
|
||||
if (makeShot)
|
||||
{
|
||||
makeShot = false;
|
||||
|
||||
Renderer->SwitchToFrameBuffer("ScreenshotFrame");
|
||||
|
||||
DrawAllScene(false);
|
||||
|
||||
ResourceManager->TexList.SaveTexDataToPlainBmpToUserData("file.bmp", ResourceManager->FrameManager.ReadFromBufferToTexData("ScreenshotFrame"));
|
||||
|
||||
Renderer->SwitchToScreen();
|
||||
|
||||
}
|
||||
}
|
||||
m2.unlock();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TAndroidApplication::InnerUpdate(cardinal dt)
|
||||
{
|
||||
|
||||
if (!Loaded)
|
||||
{
|
||||
|
||||
boost::apply_visitor( LoadingQueueVisitor(), *LoadingQueue.begin() );
|
||||
LoadingQueue.erase(LoadingQueue.begin());
|
||||
|
||||
if (LoadingQueue.size() == 0)
|
||||
{
|
||||
Loaded = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (WaveDir)
|
||||
{
|
||||
WaterTimer += dt/1000.f;
|
||||
if (WaterTimer >= 10 * pi)
|
||||
{
|
||||
WaveDir = false;
|
||||
WaterTimer = 10 * pi;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WaterTimer -= dt/1000.f;
|
||||
if (WaterTimer < 0)
|
||||
{
|
||||
WaveDir = true;
|
||||
WaterTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CloudTimer += dt / 60000.f;
|
||||
|
||||
while (CloudTimer >= 1.f)
|
||||
{
|
||||
CloudTimer -= 1.f;
|
||||
}
|
||||
|
||||
|
||||
SnowTimer += dt/3000.f;
|
||||
|
||||
while (SnowTimer > 10.f)
|
||||
{
|
||||
SnowTimer -= 10.f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TAndroidApplication::InnerOnMove(vec2 shift)
|
||||
{
|
||||
|
||||
shift = vec2(shift.v[0]*Renderer->GetMatrixWidth()/static_cast<float>(Renderer->GetScreenWidth()), shift.v[1]*Renderer->GetMatrixHeight()/static_cast<float>(Renderer->GetScreenHeight()));
|
||||
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MoveAlpha(-pi*shift.v[0]*0.1f);
|
||||
}
|
||||
|
||||
void TAndroidApplication::OnMouseDown(TMouseState& mouseState)
|
||||
{
|
||||
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
#ifndef GL_CODE_H_INCLUDED
|
||||
#define GL_CODE_H_INCLUDED
|
||||
|
||||
#ifdef TARGET_ANDROID
|
||||
//#include "android_api.h"
|
||||
#endif
|
||||
|
||||
#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/asio.hpp"
|
||||
#include "boost/signal.hpp"
|
||||
#include "boost/assign.hpp"
|
||||
#include "boost/variant.hpp"
|
||||
#include "boost/function.hpp"
|
||||
#include "boost/bind.hpp"
|
||||
|
||||
#include "include/Engine.h"
|
||||
|
||||
using namespace SE;
|
||||
|
||||
class TAndroidApplication : public TApplication, public TSerializeInterface
|
||||
{
|
||||
protected:
|
||||
|
||||
void LoadModels();
|
||||
void AddFrameBuffers();
|
||||
|
||||
public:
|
||||
bool Inited;
|
||||
bool Loaded;
|
||||
|
||||
std::vector<boost::variant<boost::function<cardinal()>, boost::function<bool()>, boost::function<void()> > > LoadingQueue;
|
||||
|
||||
TLiteModel* LiteModel;
|
||||
|
||||
float WaterTimer;
|
||||
float SnowTimer;
|
||||
float CloudTimer;
|
||||
float SkyTexShift;
|
||||
bool WaveDir;
|
||||
|
||||
std::vector<TLiteModel> IceModel;
|
||||
|
||||
std::shared_ptr<TSimpleLandClass> SimpleLand;
|
||||
|
||||
std::shared_ptr<TSimpleLandClass> SimpleLandInv;
|
||||
|
||||
TAndroidApplication();
|
||||
|
||||
virtual void InnerInit();
|
||||
|
||||
virtual void InnerDeinit();
|
||||
|
||||
virtual void InnerDraw();
|
||||
|
||||
virtual void InnerUpdate(cardinal dt);
|
||||
|
||||
virtual void InnerOnMove(vec2 shift);
|
||||
|
||||
virtual void OnMouseDown(TMouseState& mouseState);
|
||||
|
||||
bool IsInited() { return Inited; }
|
||||
|
||||
void DrawSceneWithoutWater(bool inv);
|
||||
void DrawSnow();
|
||||
void DrawAllScene(bool toScreen);
|
||||
|
||||
|
||||
virtual void Serialize(boost::property_tree::ptree& propertyTree);
|
||||
|
||||
//void DrawSceneWithoutWaterFrame();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//static void checkGlError(const std::string& op);
|
||||
|
||||
|
||||
#endif
|
1
proj.android-studio/app/.gitignore
vendored
Executable file
@ -0,0 +1 @@
|
||||
/build
|
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.
|
||||
MountainWallpaper
|
||||
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
|
||||
# Provides a relative path to your source file(s).
|
||||
# Associated headers in the same location as their source
|
||||
# file are automatically included.
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../game/android_api.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../game/main_code.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Searches for a specified prebuilt library and stores the path as a
|
||||
# variable. Because system libraries are included in the search path by
|
||||
# default, you only need to specify the name of the public NDK library
|
||||
# you want to add. CMake verifies that the library exists before
|
||||
# completing its build.
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
log-lib
|
||||
|
||||
# Specifies the name of the NDK library that
|
||||
# you want CMake to locate.
|
||||
log )
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
GLESv2-lib
|
||||
|
||||
# Specifies the name of the NDK library that
|
||||
# you want CMake to locate.
|
||||
GLESv2 )
|
||||
|
||||
|
||||
# Specifies libraries CMake should link to your target library. You
|
||||
# can link multiple libraries, such as libraries you define in the
|
||||
# build script, prebuilt third-party libraries, or system libraries.
|
||||
|
||||
target_link_libraries( # Specifies the target library.
|
||||
MountainWallpaper
|
||||
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib} ${GLESv2-lib} engine )
|
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.mountainwallpaper"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 24
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++11 -frtti -fexceptions -fsigned-char -Wno-c++11-narrowing"
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
assets.srcDirs = ['../../assets/']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
compile 'com.android.support:appcompat-v7:24.2.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
|
||||
compile project(':SalmonEngineAndroid')
|
||||
}
|
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.salmonandroidtemplate;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumentation test, which will execute on an Android device.
|
||||
*
|
||||
* @see <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());
|
||||
}
|
||||
}
|
6
AndroidManifest.xml → proj.android-studio/app/src/main/AndroidManifest.xml
Normal file → Executable file
@ -3,10 +3,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="fishrungames.mountainwallpaper" android:versionCode="1" android:versionName="1.0.0">
|
||||
<application android:label="@string/app_name" android:icon="@drawable/icon" >
|
||||
<activity android:launchMode="standard" android:name="Prefs">
|
||||
<activity android:launchMode="standard" android:name=".Prefs">
|
||||
<intent-filter>
|
||||
<category android:name="android.intent.category.PREFERENCE"></category>
|
||||
<action android:name="android.intent.action.MAIN"></action>
|
||||
<category android:name="android.intent.category.PREFERENCE"/>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
@ -18,7 +18,7 @@ import android.service.wallpaper.WallpaperService;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import fishrungames.engine.EngineWrapper;
|
||||
import fishrungames.salmonengineandroid.EngineWrapper;
|
||||
|
||||
|
||||
public class GLWallpaperService extends WallpaperService {
|
||||
@ -186,7 +186,7 @@ public class GLWallpaperService extends WallpaperService {
|
||||
*
|
||||
*
|
||||
* This interface must be implemented by clients wishing to call
|
||||
* {@link GLWallpaperService#setEGLContextFactory(EGLContextFactory)}
|
||||
* {@link GLWallpaperService.GLEngine#setEGLContextFactory(EGLContextFactory)}
|
||||
*/
|
||||
interface EGLContextFactory {
|
||||
EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig);
|
||||
@ -234,7 +234,7 @@ class ES20ContextFactory implements EGLContextFactory {
|
||||
*
|
||||
*
|
||||
* This interface must be implemented by clients wishing to call
|
||||
* {@link GLWallpaperService#setEGLWindowSurfaceFactory(EGLWindowSurfaceFactory)}
|
||||
* {@link GLWallpaperService.GLEngine#setEGLWindowSurfaceFactory(EGLWindowSurfaceFactory)}
|
||||
*/
|
||||
interface EGLWindowSurfaceFactory {
|
||||
EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display,
|
||||
@ -298,7 +298,7 @@ class EglHelper {
|
||||
/**
|
||||
* Initialize EGL for a given configuration spec.
|
||||
*
|
||||
* @param configSpec
|
||||
* configSpec
|
||||
*/
|
||||
public void start() {
|
||||
String instanceId = "";
|
@ -5,7 +5,7 @@ public class JniWrapper
|
||||
|
||||
static
|
||||
{
|
||||
System.loadLibrary("SalmonWallpaper");
|
||||
System.loadLibrary("MountainWallpaper");
|
||||
}
|
||||
|
||||
public static void LoadLibrary()
|
||||
@ -22,6 +22,4 @@ public class JniWrapper
|
||||
|
||||
public static native void SetOffset(float offsetX, float offsetY);
|
||||
|
||||
public static native void SetOrientation(int isLandscape);
|
||||
|
||||
}
|
@ -19,7 +19,7 @@ import android.view.SurfaceHolder;
|
||||
|
||||
//import com.seb.SLWP.SLWP.GlEngine.DownloadTask;
|
||||
|
||||
import fishrungames.engine.EngineWrapper;
|
||||
import fishrungames.salmonengineandroid.EngineWrapper;
|
||||
|
||||
public class MountainWallpaperService extends GLWallpaperService implements
|
||||
OnSharedPreferenceChangeListener {
|
0
res/drawable-hdpi/icon.png → proj.android-studio/app/src/main/res/drawable-hdpi/icon.png
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
0
res/drawable-ldpi/icon.png → proj.android-studio/app/src/main/res/drawable-ldpi/icon.png
Normal file → Executable file
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
0
res/drawable-mdpi/icon.png → proj.android-studio/app/src/main/res/drawable-mdpi/icon.png
Normal file → Executable file
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
0
res/drawable/notificon.png → proj.android-studio/app/src/main/res/drawable/notificon.png
Normal file → Executable file
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
0
res/drawable/thumb.jpg → proj.android-studio/app/src/main/res/drawable/thumb.jpg
Normal file → Executable file
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
0
res/layout/main.xml → proj.android-studio/app/src/main/res/layout/main.xml
Normal file → Executable file
0
res/layout/prefliste.xml → proj.android-studio/app/src/main/res/layout/prefliste.xml
Normal file → Executable file
0
res/values-cs/strings.xml → proj.android-studio/app/src/main/res/values-cs/strings.xml
Normal file → Executable file
0
res/values-de/strings.xml → proj.android-studio/app/src/main/res/values-de/strings.xml
Normal file → Executable file
0
res/values-es/strings.xml → proj.android-studio/app/src/main/res/values-es/strings.xml
Normal file → Executable file
0
res/values-fr/strings.xml → proj.android-studio/app/src/main/res/values-fr/strings.xml
Normal file → Executable file
0
res/values-it/strings.xml → proj.android-studio/app/src/main/res/values-it/strings.xml
Normal file → Executable file
0
res/values-nl/strings.xml → proj.android-studio/app/src/main/res/values-nl/strings.xml
Normal file → Executable file
0
res/values-pt/strings.xml → proj.android-studio/app/src/main/res/values-pt/strings.xml
Normal file → Executable file
0
res/values-ru/strings.xml → proj.android-studio/app/src/main/res/values-ru/strings.xml
Normal file → Executable file
0
res/values/strings.xml → proj.android-studio/app/src/main/res/values/strings.xml
Normal file → Executable file
0
res/xml/preferences.xml → proj.android-studio/app/src/main/res/xml/preferences.xml
Normal file → Executable file
0
res/xml/wallpaper.xml → proj.android-studio/app/src/main/res/xml/wallpaper.xml
Normal file → Executable file
@ -0,0 +1,17 @@
|
||||
package fishrungames.salmonandroidtemplate;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <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
@ -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
@ -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
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
@ -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
@ -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
@ -0,0 +1,7 @@
|
||||
include ':SalmonEngineAndroid'
|
||||
project(':SalmonEngineAndroid').projectDir =new File(settingsDir, '../../engine/SalmonEngineAndroid/app')
|
||||
|
||||
|
||||
include ':app'
|
||||
|
||||
|