mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 11:35:05 +08:00
Add vibration support and swap next/prev weapon
Conflicts: assets/next_weap.png assets/prev_weap.png src/org/libsdl/app/SDLActivity.java
This commit is contained in:
@@ -24,10 +24,9 @@
|
||||
android:hardwareAccelerated="true">
|
||||
<activity android:name="in.celest.xash3d.LauncherActivity"
|
||||
android:label="@string/launcher_name"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
>
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="in.celest.xash3d.LauncherActivity"/>
|
||||
<action android:name="in.celest.xash3d.LauncherActivity"/>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
@@ -75,5 +74,6 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||
</manifest>
|
||||
|
||||
@@ -34,6 +34,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Display;
|
||||
@@ -76,6 +77,8 @@ public class SDLActivity extends Activity {
|
||||
// If we want to separate mouse and touch events.
|
||||
// This is only toggled in native code when a hint is set!
|
||||
public static boolean mSeparateMouseAndTouch;
|
||||
|
||||
private static Vibrator mVibrator;
|
||||
|
||||
// Main components
|
||||
protected static SDLActivity mSingleton;
|
||||
@@ -128,6 +131,7 @@ public class SDLActivity extends Activity {
|
||||
// The static nature of the singleton and Android quirkyness force us to initialize everything here
|
||||
// Otherwise, when exiting the app and returning to it, these variables *keep* their pre exit values
|
||||
mSingleton = null;
|
||||
mVibrator = null;
|
||||
mSurface = null;
|
||||
mTextEdit = null;
|
||||
mLayout = null;
|
||||
@@ -266,6 +270,8 @@ public class SDLActivity extends Activity {
|
||||
return;
|
||||
}
|
||||
|
||||
mVibrator.cancel();
|
||||
|
||||
SDLActivity.handlePause();
|
||||
}
|
||||
|
||||
@@ -313,6 +319,8 @@ public class SDLActivity extends Activity {
|
||||
protected void onDestroy() {
|
||||
Log.v("SDL", "onDestroy()");
|
||||
|
||||
mVibrator.cancel();
|
||||
|
||||
if (SDLActivity.mBrokenLibraries) {
|
||||
super.onDestroy();
|
||||
// Reset everything in case the user re opens the app
|
||||
@@ -504,7 +512,16 @@ public class SDLActivity extends Activity {
|
||||
public static void flipBuffers() {
|
||||
SDLActivity.nativeFlipBuffers();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is called by Xash3D engine using JNI
|
||||
*/
|
||||
public void vibrate( short time ) {
|
||||
mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||
|
||||
mVibrator.vibrate( time );
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by SDL using JNI.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user