You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
-fix bug in cache for atlas import/export
-fix some menus -fixed bug in out transition curves -detect and remove file:/// in collada -remove multiscript for now -remove dependencies on mouse in OS, moved to Input -avoid fscache from screwing up (fix might make it slower, but it works) -funcref was missing, it's there now
This commit is contained in:
@@ -49,15 +49,19 @@ import android.media.*;
|
||||
import android.hardware.*;
|
||||
import android.content.*;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.media.MediaPlayer;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import com.android.godot.payments.PaymentsManager;
|
||||
import java.io.IOException;
|
||||
import android.provider.Settings.Secure;
|
||||
|
||||
|
||||
public class Godot extends Activity implements SensorEventListener
|
||||
{
|
||||
|
||||
{
|
||||
static public class SingletonBase {
|
||||
|
||||
protected void registerClass(String p_name, String[] p_methods) {
|
||||
@@ -131,8 +135,12 @@ public class Godot extends Activity implements SensorEventListener
|
||||
};
|
||||
public ResultCallback result_callback;
|
||||
|
||||
private PaymentsManager mPaymentsManager;
|
||||
|
||||
@Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {
|
||||
if (result_callback != null) {
|
||||
if(requestCode == PaymentsManager.REQUEST_CODE_FOR_PURCHASE){
|
||||
mPaymentsManager.processPurchaseResponse(resultCode, data);
|
||||
}else if (result_callback != null) {
|
||||
result_callback.callback(requestCode, resultCode, data);
|
||||
result_callback = null;
|
||||
};
|
||||
@@ -152,13 +160,17 @@ public class Godot extends Activity implements SensorEventListener
|
||||
|
||||
}
|
||||
|
||||
private static Godot _self;
|
||||
|
||||
public static Godot getInstance(){
|
||||
return Godot._self;
|
||||
}
|
||||
|
||||
@Override protected void onCreate(Bundle icicle) {
|
||||
|
||||
|
||||
super.onCreate(icicle);
|
||||
|
||||
|
||||
|
||||
_self = this;
|
||||
Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
|
||||
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
@@ -172,12 +184,20 @@ public class Godot extends Activity implements SensorEventListener
|
||||
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
|
||||
|
||||
result_callback = null;
|
||||
|
||||
|
||||
mPaymentsManager = PaymentsManager.createManager(this).initService();
|
||||
|
||||
// instanceSingleton( new GodotFacebook(this) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override protected void onDestroy(){
|
||||
|
||||
if(mPaymentsManager != null ) mPaymentsManager.destroy();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override protected void onPause() {
|
||||
super.onPause();
|
||||
mView.onPause();
|
||||
@@ -291,7 +311,15 @@ public class Godot extends Activity implements SensorEventListener
|
||||
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
GodotLib.key(event.getUnicodeChar(0), true);
|
||||
return super.onKeyDown(keyCode, event);
|
||||
};
|
||||
}
|
||||
|
||||
public PaymentsManager getPaymentsManager() {
|
||||
return mPaymentsManager;
|
||||
}
|
||||
|
||||
// public void setPaymentsManager(PaymentsManager mPaymentsManager) {
|
||||
// this.mPaymentsManager = mPaymentsManager;
|
||||
// };
|
||||
|
||||
|
||||
// Audio
|
||||
|
||||
@@ -57,6 +57,9 @@ public class GodotIO {
|
||||
AssetManager am;
|
||||
Activity activity;
|
||||
|
||||
Context applicationContext;
|
||||
MediaPlayer mediaPlayer;
|
||||
|
||||
final int SCREEN_LANDSCAPE=0;
|
||||
final int SCREEN_PORTRAIT=1;
|
||||
final int SCREEN_REVERSE_LANDSCAPE=2;
|
||||
@@ -326,7 +329,7 @@ public class GodotIO {
|
||||
activity=p_activity;
|
||||
streams=new HashMap<Integer,AssetData>();
|
||||
dirs=new HashMap<Integer,AssetDir>();
|
||||
|
||||
applicationContext = activity.getApplicationContext();
|
||||
|
||||
}
|
||||
|
||||
@@ -502,6 +505,43 @@ public class GodotIO {
|
||||
}
|
||||
};
|
||||
|
||||
public void playVideo(String p_path)
|
||||
{
|
||||
Uri filePath = Uri.parse(p_path);
|
||||
mediaPlayer = new MediaPlayer();
|
||||
|
||||
try {
|
||||
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
mediaPlayer.setDataSource(applicationContext, filePath);
|
||||
mediaPlayer.prepare();
|
||||
mediaPlayer.start();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
System.out.println("IOError while playing video");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isVideoPlaying() {
|
||||
if (mediaPlayer != null) {
|
||||
return mediaPlayer.isPlaying();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void pauseVideo() {
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopVideo() {
|
||||
if (mediaPlayer != null) {
|
||||
mediaPlayer.release();
|
||||
mediaPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected static final String PREFS_FILE = "device_id.xml";
|
||||
protected static final String PREFS_DEVICE_ID = "device_id";
|
||||
|
||||
|
||||
@@ -51,14 +51,14 @@ public class GodotLib {
|
||||
public static native void step();
|
||||
public static native void touch(int what,int pointer,int howmany, int[] arr);
|
||||
public static native void accelerometer(float x, float y, float z);
|
||||
public static native void key(int p_unicode_char, boolean p_pressed);
|
||||
public static native void key(int p_unicode_char, boolean p_pressed);
|
||||
public static native void focusin();
|
||||
public static native void focusout();
|
||||
public static native void audio();
|
||||
public static native void singleton(String p_name,Object p_object);
|
||||
public static native void method(String p_sname,String p_name,String p_ret,String[] p_params);
|
||||
public static native String getGlobal(String p_key);
|
||||
public static native void callobject(int p_ID, String p_method, Object[] p_params);
|
||||
public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
|
||||
public static native void callobject(int p_ID, String p_method, Object[] p_params);
|
||||
public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user