First blood
This commit is contained in:
1 parent
04f270f322
commit
5720f8322b
250 files changed
+33215
No files matched your search
@@ -0,0 +1,72 @@
|
||||
# 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_Engine.mk
|
||||
|
||||
#================= THE GAME =======================
|
||||
|
||||
|
||||
LOCAL_PATH:= $(LPATH)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_CFLAGS := -DTARGET_ANDROID -DTARGET_HALIBUT -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 := HalibutEngine
|
||||
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 := AndroidJniTemplate
|
||||
LOCAL_SRC_FILES := main_code.cpp
|
||||
LOCAL_SRC_FILES += android_api.cpp
|
||||
|
||||
LOCAL_LDLIBS := -lGLESv2
|
||||
LOCAL_LDLIBS += -llog -Wl,-s
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@@ -0,0 +1,3 @@
|
||||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
APP_CPPFLAGS += -frtti
|
||||
@@ -0,0 +1,116 @@
|
||||
#include "android_api.h"
|
||||
|
||||
#include "main_code.h"
|
||||
|
||||
boost::shared_ptr<TMyApplication> App(new TMyApplication);
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (App->IsInited())
|
||||
{
|
||||
App->OuterDeinit(); //Clean up what is left at previous launch (if applicable)
|
||||
}
|
||||
|
||||
App->OuterInit(width, height, 480.f, 320.f);
|
||||
|
||||
App->Inited = true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_StopSounds(JNIEnv * env, jobject obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_Update(JNIEnv * env, jobject obj, long dt)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (App->IsInited())
|
||||
{
|
||||
App->OuterDraw();
|
||||
App->OuterUpdate(dt);
|
||||
}
|
||||
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT int JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_IsInited(JNIEnv * env, jobject obj)
|
||||
{
|
||||
|
||||
if (App->IsInited())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_Destroy(JNIEnv * env, jobject obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (App->IsInited())
|
||||
{
|
||||
App->OuterDeinit();
|
||||
}
|
||||
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnTapDown(JNIEnv * env, jobject obj, float x, float y, long time)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnTapUp(JNIEnv * env, jobject obj, float x, float y, long time)
|
||||
{
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnTapMove(JNIEnv * env, jobject obj, float x, float y, long time)
|
||||
{
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnFling(JNIEnv * env, jobject obj, jfloat velocityX, jfloat velocityY, long time)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnScroll(JNIEnv * env, jobject obj, jfloat distanceX, jfloat distanceY, long time)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnKeyPress(JNIEnv * env, jobject obj, jint keyCode)
|
||||
{
|
||||
App->OnKeyPress(keyCode);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#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_halibutjnitemplate_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_StopSounds(JNIEnv * env, jobject obj);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_Update(JNIEnv * env, jobject obj, long dt);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_Destroy(JNIEnv * env, jobject obj);
|
||||
JNIEXPORT int JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_IsInited(JNIEnv * env, jobject obj);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnTapDown(JNIEnv * env, jobject obj, jfloat x, jfloat y, long time);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnTapUp(JNIEnv * env, jobject obj, jfloat x, jfloat y, long time);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnTapMove(JNIEnv * env, jobject obj, jfloat x, jfloat y, long time);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnFling(JNIEnv * env, jobject obj, jfloat velocityX, jfloat velocityY, long time);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnScroll(JNIEnv * env, jobject obj, jfloat distanceX, jfloat distanceY, long time);
|
||||
JNIEXPORT void JNICALL Java_fishrungames_halibutjnitemplate_JniWrapper_OnKeyPress(JNIEnv * env, jobject obj, jint keyCode);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#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"
|
||||
|
||||
void TMyApplication::InnerInit()
|
||||
{
|
||||
#ifdef TARGET_ANDROID
|
||||
ResourceManager->PathToResources = "";
|
||||
#endif
|
||||
#ifdef TARGET_IOS
|
||||
ResourceManager->PathToResources = "assets/";
|
||||
#endif
|
||||
#ifdef TARGET_WIN32
|
||||
#ifdef NDEBUG
|
||||
ResourceManager->PathToResources = "resources/";
|
||||
#else
|
||||
ResourceManager->PathToResources = "../../../assets/";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "shader_vertex.txt", "shader_fragment.txt");
|
||||
Renderer->PushShader("DefaultShader");
|
||||
|
||||
|
||||
ResourceManager->TexList.AddTexture(CONST_CONSOLE_TEX_NAME);
|
||||
|
||||
ResourceManager->FontManager.AddFont("droid_sans14", "droid_sans14_font_bitmap.bmp32", "droid_sans14_font_charmap.txt");
|
||||
ResourceManager->FontManager.PushFont("droid_sans14");
|
||||
|
||||
//Inited = true; Must be set in android_api.cpp manually
|
||||
}
|
||||
|
||||
void TMyApplication::InnerDeinit()
|
||||
{
|
||||
Inited = false;
|
||||
}
|
||||
|
||||
|
||||
void TMyApplication::InnerDraw()
|
||||
{
|
||||
//Console->Draw();
|
||||
}
|
||||
|
||||
|
||||
void TMyApplication::InnerUpdate(cardinal dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef GL_CODE_H_INCLUDED
|
||||
#define GL_CODE_H_INCLUDED
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "boost/shared_ptr.hpp"
|
||||
#include "boost/thread/thread.hpp"
|
||||
#include "boost/asio.hpp"
|
||||
#include "boost/signal.hpp"
|
||||
#include "boost/assign.hpp"
|
||||
#include "boost/bind.hpp"
|
||||
|
||||
#include "include/Engine.h"
|
||||
|
||||
using namespace SE;
|
||||
|
||||
|
||||
class TMyApplication : public TApplication
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
bool Inited;
|
||||
|
||||
TMyApplication() : TApplication(), Inited(false) { }
|
||||
|
||||
|
||||
virtual void InnerInit();
|
||||
|
||||
virtual void InnerDeinit();
|
||||
|
||||
virtual void InnerDraw();
|
||||
|
||||
virtual void InnerUpdate(cardinal dt);
|
||||
|
||||
bool IsInited() { return Inited; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
static void checkGlError(const std::string& op);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user