push the input data from java to c on each event

This commit is contained in:
Bryan Barnes 2014-02-09 22:44:53 -05:00
parent 55d5e31a55
commit e46993f96c
2 changed files with 20 additions and 13 deletions

View File

@ -467,7 +467,7 @@ public class GL2JNIActivity extends Activity {
}
}
mView.pushInput();
if ((jsCompat[playerNum] || xbox[playerNum] || nVidia[playerNum])
&& ((globalLS_X[playerNum] == previousLS_X[playerNum] && globalLS_Y[playerNum] == previousLS_Y[playerNum]) || (previousLS_X[playerNum] == 0.0f && previousLS_Y[playerNum] == 0.0f)))
// Only handle Left Stick on an Xbox 360 controller if there was
@ -582,7 +582,7 @@ public class GL2JNIActivity extends Activity {
break;
}
}
mView.pushInput();
return rav;
} else {

View File

@ -229,9 +229,9 @@ class GL2JNIView extends GLSurfaceView
if (GL2JNIActivity.syms != null)
JNIdc.data(1, GL2JNIActivity.syms);
int[] kcode = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF };
int[] rt = { 0, 0, 0, 0 }, lt = { 0, 0, 0, 0 };
int[] jx = { 128, 128, 128, 128 }, jy = { 128, 128, 128, 128 };
// int[] kcode = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF };
// int[] rt = { 0, 0, 0, 0 }, lt = { 0, 0, 0, 0 };
// int[] jx = { 128, 128, 128, 128 }, jy = { 128, 128, 128, 128 };
JNIdc.init(fileName);
// By default, GLSurfaceView() creates a RGB_565 opaque surface.
@ -258,7 +258,7 @@ class GL2JNIView extends GLSurfaceView
setRenderer(rend=new Renderer());
// Initialize audio
configAudio(44100,250);
//configAudio(44100,250);
ethd.start();
}
@ -272,11 +272,11 @@ class GL2JNIView extends GLSurfaceView
private static void LOGW(String S) { Log.w("GL2JNIView",S); }
private static void LOGE(String S) { Log.e("GL2JNIView",S); }
public void configAudio(int rate,int latency)
{
//if(audioThread!=null) audioThread.stopPlayback();
//audioThread = new AudioThread(rate,latency);
}
// public void configAudio(int rate,int latency)
// {
// //if(audioThread!=null) audioThread.stopPlayback();
// //audioThread = new AudioThread(rate,latency);
// }
private void reset_analog()
{
@ -587,6 +587,7 @@ class GL2JNIView extends GLSurfaceView
kcode_raw[0] = rv;
jx[0] = get_anal(11, 0);
jy[0] = get_anal(11, 1);
pushInput();
return(true);
}
@ -853,13 +854,17 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
while(egl.eglGetError()!=EGL10.EGL_SUCCESS);
}
}
public void pushInput(){
JNIdc.kcode(kcode_raw,lt,rt,jx,jy);
}
private static class Renderer implements GLSurfaceView.Renderer
{
public void onDrawFrame(GL10 gl)
{
//Log.w("INPUT", " " + kcode_raw + " " + rt + " " + lt + " " + jx + " " + jy);
JNIdc.kcode(kcode_raw,lt,rt,jx,jy);
//JNIdc.kcode(kcode_raw,lt,rt,jx,jy);
// Natively update nullDC display
JNIdc.rendframe();
}
@ -934,6 +939,7 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
//
// Thread responsible for playing audio.
//
/*
class AudioThready extends Thread
{
private AudioTrack Player;
@ -1005,7 +1011,8 @@ private static class ContextFactory implements GLSurfaceView.EGLContextFactory
LOGI("Exiting audio thread");
}
}
*/
public void onStop() {
// TODO Auto-generated method stub
System.exit(0);