Click here to Skip to main content
13,737,720 members
Click here to Skip to main content

Stats

32.5K views
959 downloads
31 bookmarked
Posted 4 Nov 2012
Licenced Apache

Terminal Velocity Android

, 23 May 2013
An android game using NDK JNI and Java.
TerVel
.classpath
.project
.settings
assets
asset.items
bg.pack
bg.png
bg2.png
coin.ogg
cur.ogg
cur.pack
cur.png
cur.wav
f.pack
f.png
gui.pack
gui.png
hero.pack
hero.png
hit.wav
items.pack
items.png
jk.pack
jk.png
m1.mp3
over.pack
over.png
rocket.wav
select.ogg
splash.png
stf.pack
stf.png
strike.pack
strike.png
Thumbs.db
bin
classes
com
badlogic
androidgames
framework
Audio.class
Color.class
DynamicGameObject.class
FileIO.class
Game.class
GameObject.class
gl
Animation.class
Camera2D.class
Font.class
FPSCounter.class
SpatialHashGrid.class
SpriteBatcher.class
Texture.class
TextureRegion.class
Vertices.class
Graphics$PixmapFormat.class
Graphics.class
impl
AccelerometerHandler.class
AndroidAudio.class
AndroidFastRenderView.class
AndroidFileIO.class
AndroidGame.class
AndroidGraphics.class
AndroidInput.class
AndroidMusic.class
AndroidPixmap.class
AndroidSound.class
GLGame$GLGameState.class
GLGame.class
GLGraphics.class
GLScreen.class
KeyboardHandler$1.class
KeyboardHandler.class
MultiTouchHandler$1.class
MultiTouchHandler.class
SingleTouchHandler$1.class
SingleTouchHandler.class
TouchHandler.class
Input$KeyEvent.class
Input$TouchEvent.class
Input.class
math
Circle.class
OverlapTester.class
Rectangle.class
Vector2.class
Music.class
Pixmap.class
Pool$PoolObjectFactory.class
Pool.class
Screen.class
Sound.class
TestScreen.class
inductionlabs
jni
bridge
BatcherBridge.class
Bridge.class
tools_seting_bridge.class
tervel
Assets$1.class
Assets$2.class
Assets.class
BuildConfig.class
Datastore.class
GameScreen.class
loaderparser.class
NativeFun.class
R$attr.class
R$drawable.class
R.class
resumescreen.class
Settings.class
TerVel.class
texturenameinfo.class
TexturRegionName.class
libgdxextension
FontExtension.class
GLGame$GLGameState.class
GLGame.class
GLGraphics.class
spritebatchextension.class
classes.dex
jarlist.cache
res
drawable-hdpi
tv.png
gen
inductionlabs
tervel
ic_launcher-web.png
jni
drawparts
engine
GameData
ViewManager
libgdx.jar
libs
armeabi
gdb.setup
gdbserver
libengine.so
armeabi-v7a
x86
gdb.setup
gdbserver
libengine.so
obj
local
armeabi
app_process
libc.so
libengine.so
libstdc++.a
objs-debug
engine
engine
Game.o
GameData
GameData.o
ViewManager
ViewManager.o
x86
app_process
libc.so
libengine.so
libstdc++.a
objs-debug
engine
engine
Game.o
GameData
GameData.o
ViewManager
ViewManager.o
res
drawable-hdpi
tv.png
src
com
badlogic
androidgames
framework
gl
impl
math
inductionlabs
jni
bridge
tervel
libgdxextension
/*
 * jni.h
 *
 *  Created on: 01-Nov-2012
 *      Author: Praveen Ojha
 */

#ifndef JNIfun_H_
#define JNIfun_H_
#include<jni.h>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////Jni glue code below/////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 extern "C"
{

JNIEXPORT int JNICALL Java_inductionlabs_jni_bridge_Bridge_object(JNIEnv * env, jclass clas,jobject obj,jsize i)
{
switch(i)
{case 0:k=0;engine::Glgame=env->NewGlobalRef(obj);break;
 case 1:k=1;engine::Batcher=env->NewGlobalRef(obj);break;
 case 2:k=2;engine::GuiCam=env->NewGlobalRef(obj);break;
 case 3:k=3;engine::GameScreen=env->NewGlobalRef(obj);break;
 case 4:k=4;engine::Set=env->NewGlobalRef(obj);break;
 case 6:k=6;engine::Asset=env->NewGlobalRef(obj);break;
 default:k=12;break;
}
//Gaining class handles so can call their methods.
if(i==0)
{engine::assets=env->FindClass("inductionlabs/tervel/Assets");
engine::javaBatcher=env->FindClass("inductionlabs/jni/bridge/BatcherBridge");
engine::setting=env->FindClass("inductionlabs/jni/bridge/tools_seting_bridge");
//Above they are only local references so converting them to global one
engine::assets= (jclass)(env->NewGlobalRef(engine::assets));
engine::javaBatcher=(jclass)(env->NewGlobalRef(engine::javaBatcher));
engine::setting=(jclass)(env->NewGlobalRef(engine::setting));

}
return i;
}

//////////////////////////////////Frame Draw Update/////////////////////////////////////////////
JNIEXPORT void JNICALL Java_inductionlabs_tervel_NativeFun_draw(JNIEnv * env,jclass clas,float dt)
{ Game::Draw(env,dt);
}
///////////////////////////////////////Init the game////////////////////////////////////////////
JNIEXPORT void JNICALL Java_inductionlabs_tervel_NativeFun_createEngine(JNIEnv * env,jclass clas)
{Game::gd.Gamestate=4;
 Game::vm.screenstate=0;

}
//////////////////////////////////////Input update///////////////////////////////////////////////
JNIEXPORT void JNICALL Java_inductionlabs_tervel_NativeFun_update(JNIEnv * env,jclass clas)
{Game::Update(env);
}
/////////////////////////////////Input accelerometer//////////////////////////////////////////////////
JNIEXPORT int JNICALL Java_inductionlabs_tervel_NativeFun_updateacc(JNIEnv * env,jclass clas,float accelX, float accelY,float accelZ)
{Game::Update(env,accelX,accelY,accelZ);
return 1;
}
////////////////////////////////////Input touch///////////////////////////////////////////////////////
JNIEXPORT bool JNICALL Java_inductionlabs_tervel_NativeFun_updatekey(JNIEnv * env,jclass clas,int keyCode, int type)
{return Game::Update(env,keyCode, type);
}
/////////////////////////////////////Input key///////////////////////////////////////////////////////
JNIEXPORT void JNICALL Java_inductionlabs_tervel_NativeFun_updatetou(JNIEnv * env,jclass clas,float x, float y, int type, int pointer)
{Game::Update(env, x, y, type, pointer);
}
//////////////////////////////////////////State Poster//////////////////////////////////////////////////
JNIEXPORT void JNICALL Java_inductionlabs_tervel_NativeFun_poststate(JNIEnv * env,jclass clas,int state)
{Game::State(env, state);
}


///////////////////////////////////////Init the musci and sound////////////////////////////////////////////
JNIEXPORT void JNICALL Java_inductionlabs_tervel_NativeFun_postaudiostate(JNIEnv * env,jclass clas,bool music,bool sound)
{
	Game::postaudiodata(music,sound);

}
};
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////End of Jni call  code///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////




#endif



//Draw Call Functions End



By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0

Share

About the Author

PraveenOjha
Chief Technology Officer InductionLabs
India India
Currently I am an independent developer usually develops under brand name Induction games sometimes under Induction labs ,Can say that I am professionally developing apps for more than 4 years .

Some links to my apps in different apps stores are ..


Windows Phone
http://www.windowsphone.com/en-US/store/publishers?publisherId=InductionGames

Android
1. https://play.google.com/store/apps/developer?id=Induction+Labs&hl=en
2.https://play.google.com/store/apps/developer?id=Induction%20Games

Blackberry Store
http://appworld.blackberry.com/webstore/vendor/39848/?lang=en

Flash Games :
http://www.mochigames.com/developer/praveenojha/
*my flash portal is no longer active so the quiz game cant be played .

Perceptual computing phase 1 first prize Winner app (air piano)
http://software.intel.com/sites/campaigns/perceptualshowcase/air-piano.htm

My Blog
http://praveenojha.com

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06-2016 | 2.8.180920.1 | Last Updated 23 May 2013
Article Copyright 2012 by PraveenOjha
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid