mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-27 12:29:53 +01:00
Add volume keys switch, fix recent bugs
This commit is contained in:
parent
1f330cb1a8
commit
19b5ac81a3
@ -14,7 +14,7 @@ endif
|
||||
|
||||
CFLAGS_OPT := -O3 -fomit-frame-pointer -ggdb -funsafe-math-optimizations -ftree-vectorize -fgraphite-identity -floop-interchange -funsafe-loop-optimizations -finline-limit=1024
|
||||
CFLAGS_OPT_ARM := -mthumb -mfpu=neon -mcpu=cortex-a9 -pipe -mvectorize-with-neon-quad -DVECTORIZE_SINCOS
|
||||
CFLAGS_OPT_ARMv5 :=-mcpu=arm1136j-s -mfpu=vfp -marm -pipe
|
||||
CFLAGS_OPT_ARMv5 :=-march=armv6 -mfpu=vfp -marm -pipe
|
||||
CFLAGS_OPT_X86 := -mtune=atom -march=atom -mssse3 -mfpmath=sse -funroll-loops -pipe -DVECTORIZE_SINCOS
|
||||
CFLAGS_HARDFP := -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -mfloat-abi=hard -DLOAD_HARDFP -DSOFTFP_LINK
|
||||
APPLICATIONMK_PATH = $(call my-dir)
|
||||
|
@ -51,6 +51,13 @@
|
||||
android:text="@string/use_controls"
|
||||
android:id="@+id/useControls"/>
|
||||
|
||||
<CheckBox
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/use_volume"
|
||||
android:id="@+id/useVolume"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -3,6 +3,7 @@
|
||||
<string name="cmd_args_text">Аргументы командной строки(только для экспертов)</string>
|
||||
<string name="launch_button">Запустить Xash3D</string>
|
||||
<string name="use_controls">Включить экранное управление</string>
|
||||
<string name="use_volume">Использовать кнопки громкости</string>
|
||||
<string name="text_res_path">Путь к ресурсам игры</string>
|
||||
<string name="touch_set">Настройки управления</string>
|
||||
<string name="text_shortcut">Ярлык Xash3D</string>
|
||||
|
@ -15,6 +15,7 @@
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="cmd_args_text">Command line arguments(experts only)</string>
|
||||
<string name="use_controls">Enable touch controls</string>
|
||||
<string name="use_volume">Use volume keys</string>
|
||||
<string name="text_res_path">Path to game resources</string>
|
||||
<string name="touch_set">Controls settings</string>
|
||||
<string name="text_shortcut">Xash3D shortcut</string>
|
||||
|
@ -111,6 +111,8 @@ public class Settings {
|
||||
prefix = "";
|
||||
|
||||
File d = new File(dir);
|
||||
File f = new File(dir + "use.png");
|
||||
if(f.exists()) return;
|
||||
if (!d.exists())
|
||||
d.mkdirs();
|
||||
|
||||
|
@ -24,6 +24,7 @@ public class LauncherActivity extends Activity {
|
||||
static TouchControlsSettings mSettings;
|
||||
static EditText cmdArgs;
|
||||
static CheckBox useControls;
|
||||
static CheckBox useVolume;
|
||||
static EditText resPath;
|
||||
static SharedPreferences mPref;
|
||||
@Override
|
||||
@ -38,6 +39,8 @@ public class LauncherActivity extends Activity {
|
||||
cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
|
||||
useControls = ( CheckBox ) findViewById( R.id.useControls );
|
||||
useControls.setChecked(mPref.getBoolean("controls",true));
|
||||
useVolume = ( CheckBox ) findViewById( R.id.useVolume );
|
||||
useVolume.setChecked(mPref.getBoolean("usevolume",true));
|
||||
resPath = ( EditText ) findViewById( R.id.cmdPath );
|
||||
resPath.setText(mPref.getString("basedir","/sdcard/xash/"));
|
||||
}
|
||||
@ -50,6 +53,7 @@ public class LauncherActivity extends Activity {
|
||||
SharedPreferences.Editor editor = mPref.edit();
|
||||
editor.putString("argv", cmdArgs.getText().toString());
|
||||
editor.putBoolean("controls",useControls.isChecked());
|
||||
editor.putBoolean("usevolume",useVolume.isChecked());
|
||||
editor.putString("basedir", resPath.getText().toString());
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
|
@ -68,7 +68,7 @@ public class SDLActivity extends Activity {
|
||||
private static final String TAG = "SDL";
|
||||
|
||||
// Keep track of the paused state
|
||||
public static boolean mIsPaused, mIsSurfaceReady, mHasFocus, mUseControls;
|
||||
public static boolean mIsPaused, mIsSurfaceReady, mHasFocus, mUseControls, mUseVolume;
|
||||
public static boolean mExitCalledFromJava;
|
||||
|
||||
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
||||
@ -148,6 +148,7 @@ public class SDLActivity extends Activity {
|
||||
mIsSurfaceReady = false;
|
||||
mHasFocus = true;
|
||||
mControlsDir = null;
|
||||
mUseVolume = false;
|
||||
}
|
||||
|
||||
// Setup
|
||||
@ -172,6 +173,7 @@ public class SDLActivity extends Activity {
|
||||
mSingleton = this;
|
||||
mPref = this.getSharedPreferences("engine", 0);
|
||||
mUseControls = mPref.getBoolean("controls", false);
|
||||
mUseVolume = mPref.getBoolean("usevolume", false);
|
||||
// Load shared libraries
|
||||
String errorMsgBrokenLib = "";
|
||||
try {
|
||||
@ -210,7 +212,7 @@ public class SDLActivity extends Activity {
|
||||
|
||||
Intent intent=getIntent();
|
||||
String argv = intent.getStringExtra("argv");
|
||||
if(argv == null) argv = mPref.getString(argv, "-dev 3 -log");
|
||||
if(argv == null) argv = mPref.getString("argv", "-dev 3 -log");
|
||||
if(argv == null) argv = "-dev 3 -log";
|
||||
mArgv= argv.split(" ");
|
||||
String gamelibdir = intent.getStringExtra("gamelibdir");
|
||||
@ -341,6 +343,9 @@ public class SDLActivity extends Activity {
|
||||
|
||||
int keyCode = event.getKeyCode();
|
||||
// Ignore certain special keys so they're handled by Android
|
||||
if ( mUseVolume && (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_UP)
|
||||
) return false;
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user