Now uses touchcontrols for all input, no SDL
This commit is contained in:
parent
c9c7c268d0
commit
de3442951d
37 changed files with 4366 additions and 4361 deletions
14
.gitignore
vendored
14
.gitignore
vendored
|
@ -1,7 +1,7 @@
|
||||||
libs
|
libs
|
||||||
obj
|
obj
|
||||||
bin
|
bin
|
||||||
gen
|
gen
|
||||||
|
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
|
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
|
||||||
com.gamemaker.game
|
com.gamemaker.game
|
||||||
-->
|
-->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="in.celest.xash3d.hl"
|
package="in.celest.xash3d.hl"
|
||||||
android:versionCode="0"
|
android:versionCode="0"
|
||||||
android:versionName="0.12"
|
android:versionName="0.12"
|
||||||
android:installLocation="preferExternal">
|
android:installLocation="preferExternal">
|
||||||
|
|
||||||
<!-- Create a Java class extending SDLActivity and place it in a
|
<!-- Create a Java class extending SDLActivity and place it in a
|
||||||
directory under src matching the package, e.g.
|
directory under src matching the package, e.g.
|
||||||
src/com/gamemaker/game/MyGame.java
|
src/com/gamemaker/game/MyGame.java
|
||||||
|
|
||||||
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
|
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
|
||||||
in the XML below.
|
in the XML below.
|
||||||
|
|
||||||
An example Java class can be found in README-android.txt
|
An example Java class can be found in README-android.txt
|
||||||
-->
|
-->
|
||||||
<application android:debuggable="true" android:label="@string/app_name"
|
<application android:debuggable="true" android:label="@string/app_name"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:hardwareAccelerated="true">
|
android:hardwareAccelerated="true">
|
||||||
<activity android:name="org.libsdl.app.SDLActivity"
|
<activity android:name="org.libsdl.app.SDLActivity"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
>
|
>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<!-- <activity android:name=".XashActivity"
|
<!-- <activity android:name=".XashActivity"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
</activity> -->
|
</activity> -->
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<!-- Android 2.3.3 -->
|
<!-- Android 2.3.3 -->
|
||||||
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />
|
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />
|
||||||
|
|
||||||
<!-- OpenGL ES 2.0 -->
|
<!-- OpenGL ES 2.0 -->
|
||||||
<uses-feature android:glEsVersion="0x00020000" />
|
<uses-feature android:glEsVersion="0x00020000" />
|
||||||
|
|
||||||
<!-- Allow writing to external storage -->
|
<!-- Allow writing to external storage -->
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,7 +1,7 @@
|
||||||
====
|
====
|
||||||
Xash3D Android project
|
Xash3D Android project
|
||||||
====
|
====
|
||||||
|
|
||||||
Just put into jni/src/XXXX/ a symlink to a repository. For example, for HLSDK it will be jni/src/HLSDK/halflife/
|
Just put into jni/src/XXXX/ a symlink to a repository. For example, for HLSDK it will be jni/src/HLSDK/halflife/
|
||||||
|
|
||||||
Write here any issues related to Android port.
|
Write here any issues related to Android port.
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
# This file is used to override default values used by the Ant build system.
|
# This file is used to override default values used by the Ant build system.
|
||||||
#
|
#
|
||||||
# This file must be checked into Version Control Systems, as it is
|
# This file must be checked into Version Control Systems, as it is
|
||||||
# integral to the build system of your project.
|
# integral to the build system of your project.
|
||||||
|
|
||||||
# This file is only used by the Ant script.
|
# This file is only used by the Ant script.
|
||||||
|
|
||||||
# You can use this to override default values such as
|
# You can use this to override default values such as
|
||||||
# 'source.dir' for the location of your java source folder and
|
# 'source.dir' for the location of your java source folder and
|
||||||
# 'out.dir' for the location of your output folder.
|
# 'out.dir' for the location of your output folder.
|
||||||
|
|
||||||
# You can also use it define how the release builds are signed by declaring
|
# You can also use it define how the release builds are signed by declaring
|
||||||
# the following properties:
|
# the following properties:
|
||||||
# 'key.store' for the location of your keystore and
|
# 'key.store' for the location of your keystore and
|
||||||
# 'key.alias' for the name of the key to use.
|
# 'key.alias' for the name of the key to use.
|
||||||
# The password will be asked during the build when you use the 'release' target.
|
# The password will be asked during the build when you use the 'release' target.
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
# This file is used to override default values used by the Ant build system.
|
# This file is used to override default values used by the Ant build system.
|
||||||
#
|
#
|
||||||
# This file must be checked in Version Control Systems, as it is
|
# This file must be checked in Version Control Systems, as it is
|
||||||
# integral to the build system of your project.
|
# integral to the build system of your project.
|
||||||
|
|
||||||
# This file is only used by the Ant script.
|
# This file is only used by the Ant script.
|
||||||
|
|
||||||
# You can use this to override default values such as
|
# You can use this to override default values such as
|
||||||
# 'source.dir' for the location of your java source folder and
|
# 'source.dir' for the location of your java source folder and
|
||||||
# 'out.dir' for the location of your output folder.
|
# 'out.dir' for the location of your output folder.
|
||||||
|
|
||||||
# You can also use it define how the release builds are signed by declaring
|
# You can also use it define how the release builds are signed by declaring
|
||||||
# the following properties:
|
# the following properties:
|
||||||
# 'key.store' for the location of your keystore and
|
# 'key.store' for the location of your keystore and
|
||||||
# 'key.alias' for the name of the key to use.
|
# 'key.alias' for the name of the key to use.
|
||||||
# The password will be asked during the build when you use the 'release' target.
|
# The password will be asked during the build when you use the 'release' target.
|
||||||
|
|
||||||
|
|
16
build.sh
16
build.sh
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ndk-build NDK_TOOLCHAIN_VERSION=4.8 NDK_DEBUG=0 SUPPORT_WEBP=false V=1
|
ndk-build NDK_TOOLCHAIN_VERSION=4.8 NDK_DEBUG=0 SUPPORT_WEBP=false V=1
|
||||||
ant release
|
ant release
|
||||||
#jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../myks.keystore bin/xashdroid-release-unsigned.apk xashdroid
|
#jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../myks.keystore bin/xashdroid-release-unsigned.apk xashdroid
|
||||||
#adb install -r -f bin/xashdroid-debug.apk
|
#adb install -r -f bin/xashdroid-debug.apk
|
||||||
rm bin/xashdroid-release.apk
|
rm bin/xashdroid-release.apk
|
||||||
/opt/android-sdk-update-manager/build-tools/19.1.0/zipalign 4 bin/xashdroid-release-unsigned.apk bin/xashdroid-release.apk
|
/opt/android-sdk-update-manager/build-tools/19.1.0/zipalign 4 bin/xashdroid-release-unsigned.apk bin/xashdroid-release.apk
|
||||||
|
|
184
build.xml
184
build.xml
|
@ -1,92 +1,92 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="xashdroid" default="help">
|
<project name="xashdroid" default="help">
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
It contains the path to the SDK. It should *NOT* be checked into
|
||||||
Version Control Systems. -->
|
Version Control Systems. -->
|
||||||
<property file="local.properties" />
|
<property file="local.properties" />
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||||
'android' tool to add properties to it.
|
'android' tool to add properties to it.
|
||||||
This is the place to change some Ant specific build properties.
|
This is the place to change some Ant specific build properties.
|
||||||
Here are some properties you may want to change/update:
|
Here are some properties you may want to change/update:
|
||||||
|
|
||||||
source.dir
|
source.dir
|
||||||
The name of the source directory. Default is 'src'.
|
The name of the source directory. Default is 'src'.
|
||||||
out.dir
|
out.dir
|
||||||
The name of the output directory. Default is 'bin'.
|
The name of the output directory. Default is 'bin'.
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
For other overridable properties, look at the beginning of the rules
|
||||||
files in the SDK, at tools/ant/build.xml
|
files in the SDK, at tools/ant/build.xml
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
Properties related to the SDK location or the project target should
|
||||||
be updated using the 'android' tool with the 'update' action.
|
be updated using the 'android' tool with the 'update' action.
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
This file is an integral part of the build system for your
|
||||||
application and should be checked into Version Control Systems.
|
application and should be checked into Version Control Systems.
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<property file="ant.properties" />
|
<property file="ant.properties" />
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
<!-- if sdk.dir was not set from one of the property file, then
|
||||||
get it from the ANDROID_HOME env var.
|
get it from the ANDROID_HOME env var.
|
||||||
This must be done before we load project.properties since
|
This must be done before we load project.properties since
|
||||||
the proguard config can use sdk.dir -->
|
the proguard config can use sdk.dir -->
|
||||||
<property environment="env" />
|
<property environment="env" />
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||||
<isset property="env.ANDROID_HOME" />
|
<isset property="env.ANDROID_HOME" />
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
<!-- The project.properties file is created and updated by the 'android'
|
||||||
tool, as well as ADT.
|
tool, as well as ADT.
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
This contains project specific properties such as project target, and library
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
dependencies. Lower level build properties are stored in ant.properties
|
||||||
(or in .classpath for Eclipse projects).
|
(or in .classpath for Eclipse projects).
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
This file is an integral part of the build system for your
|
||||||
application and should be checked into Version Control Systems. -->
|
application and should be checked into Version Control Systems. -->
|
||||||
<loadproperties srcFile="project.properties" />
|
<loadproperties srcFile="project.properties" />
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
<!-- quick check on sdk.dir -->
|
||||||
<fail
|
<fail
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||||
unless="sdk.dir"
|
unless="sdk.dir"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Import per project custom build rules if present at the root of the project.
|
Import per project custom build rules if present at the root of the project.
|
||||||
This is the place to put custom intermediary targets such as:
|
This is the place to put custom intermediary targets such as:
|
||||||
-pre-build
|
-pre-build
|
||||||
-pre-compile
|
-pre-compile
|
||||||
-post-compile (This is typically used for code obfuscation.
|
-post-compile (This is typically used for code obfuscation.
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
Compiled code location: ${out.classes.absolute.dir}
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||||
-post-package
|
-post-package
|
||||||
-post-build
|
-post-build
|
||||||
-pre-clean
|
-pre-clean
|
||||||
-->
|
-->
|
||||||
<import file="custom_rules.xml" optional="true" />
|
<import file="custom_rules.xml" optional="true" />
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
<!-- Import the actual build file.
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
To customize existing targets, there are two options:
|
||||||
- Customize only one target:
|
- Customize only one target:
|
||||||
- copy/paste the target into this file, *before* the
|
- copy/paste the target into this file, *before* the
|
||||||
<import> task.
|
<import> task.
|
||||||
- customize it to your needs.
|
- customize it to your needs.
|
||||||
- Customize the whole content of build.xml
|
- Customize the whole content of build.xml
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
- copy/paste the content of the rules files (minus the top node)
|
||||||
into this file, replacing the <import> task.
|
into this file, replacing the <import> task.
|
||||||
- customize to your needs.
|
- customize to your needs.
|
||||||
|
|
||||||
***********************
|
***********************
|
||||||
****** IMPORTANT ******
|
****** IMPORTANT ******
|
||||||
***********************
|
***********************
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
-->
|
-->
|
||||||
<!-- version-tag: 1 -->
|
<!-- version-tag: 1 -->
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
16
debug.sh
16
debug.sh
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ndk-build NDK_TOOLCHAIN_VERSION=4.8 NDK_DEBUG=1 SUPPORT_WEBP=false V=1 -j3 APP_CFLAGS="-gdwarf-3"
|
ndk-build NDK_TOOLCHAIN_VERSION=4.8 NDK_DEBUG=1 SUPPORT_WEBP=false V=1 -j3 APP_CFLAGS="-gdwarf-3"
|
||||||
ant debug
|
ant debug
|
||||||
#jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../myks.keystore bin/xashdroid-release-unsigned.apk xashdroid -storepass 529459
|
#jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../myks.keystore bin/xashdroid-release-unsigned.apk xashdroid -storepass 529459
|
||||||
adb install -r -f bin/xashdroid-debug.apk
|
adb install -r -f bin/xashdroid-debug.apk
|
||||||
#rm bin/xashdroid-release.apk
|
#rm bin/xashdroid-release.apk
|
||||||
#/opt/android-sdk-update-manager/build-tools/19.1.0/zipalign 4 bin/xashdroid-release-unsigned.apk bin/xashdroid-release.apk
|
#/opt/android-sdk-update-manager/build-tools/19.1.0/zipalign 4 bin/xashdroid-release-unsigned.apk bin/xashdroid-release.apk
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# This file is automatically generated by Android Tools.
|
# This file is automatically generated by Android Tools.
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
#
|
#
|
||||||
# This file must be checked in Version Control Systems.
|
# This file must be checked in Version Control Systems.
|
||||||
#
|
#
|
||||||
# To customize properties used by the Ant build system use,
|
# To customize properties used by the Ant build system use,
|
||||||
# "build.properties", and override values to adapt the script to your
|
# "build.properties", and override values to adapt the script to your
|
||||||
# project structure.
|
# project structure.
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-12
|
target=android-12
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
include $(call all-subdir-makefiles)
|
include $(call all-subdir-makefiles)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
include $(call all-subdir-makefiles)
|
include $(call all-subdir-makefiles)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
include $(call all-subdir-makefiles)
|
include $(call all-subdir-makefiles)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
include $(call all-subdir-makefiles)
|
include $(call all-subdir-makefiles)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
include $(call all-subdir-makefiles)
|
include $(call all-subdir-makefiles)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 215d7a35d99850dcbc38d37fb8fe9b4166fefcf3
|
Subproject commit f93ba2ac968bb2bf1d82f87e78eaba77d9fe05b8
|
|
@ -1 +1 @@
|
||||||
include $(call all-subdir-makefiles)
|
include $(call all-subdir-makefiles)
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
# To enable ProGuard in your project, edit project.properties
|
# To enable ProGuard in your project, edit project.properties
|
||||||
# to define the proguard.config property as described in that file.
|
# to define the proguard.config property as described in that file.
|
||||||
#
|
#
|
||||||
# Add project specific ProGuard rules here.
|
# Add project specific ProGuard rules here.
|
||||||
# By default, the flags in this file are appended to flags specified
|
# By default, the flags in this file are appended to flags specified
|
||||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||||
# You can edit the include path and order by changing the ProGuard
|
# You can edit the include path and order by changing the ProGuard
|
||||||
# include property in project.properties.
|
# include property in project.properties.
|
||||||
#
|
#
|
||||||
# For more details, see
|
# For more details, see
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
# Add any project specific keep options here:
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
# If your project uses WebView with JS, uncomment the following
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
# class:
|
# class:
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
# public *;
|
# public *;
|
||||||
#}
|
#}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle" >
|
android:shape="rectangle" >
|
||||||
|
|
||||||
<solid android:color="#805fd1e2"/>
|
<solid android:color="#805fd1e2"/>
|
||||||
|
|
||||||
<stroke
|
<stroke
|
||||||
android:width="2dp"
|
android:width="2dp"
|
||||||
android:color="@android:color/holo_blue_light" />
|
android:color="@android:color/holo_blue_light" />
|
||||||
|
|
||||||
<padding
|
<padding
|
||||||
android:bottom="2dp"
|
android:bottom="2dp"
|
||||||
android:left="2dp"
|
android:left="2dp"
|
||||||
android:right="2dp"
|
android:right="2dp"
|
||||||
android:top="2dp" />
|
android:top="2dp" />
|
||||||
|
|
||||||
</shape>
|
</shape>
|
|
@ -1,42 +1,42 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:src="@drawable/joystick" />
|
android:src="@drawable/joystick" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_toRightOf="@+id/imageView"
|
android:layout_toRightOf="@+id/imageView"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/name_textview"
|
android:id="@+id/name_textview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Large Text"
|
android:text="Large Text"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/binding_textview"
|
android:id="@+id/binding_textview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Medium Text"
|
android:text="Medium Text"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textColor="@android:color/tertiary_text_dark" />
|
android:textColor="@android:color/tertiary_text_dark" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/settings_imageview"
|
android:id="@+id/settings_imageview"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="@drawable/cog" />
|
android:background="@drawable/cog" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
|
@ -1,34 +1,34 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:src="@drawable/joystick" />
|
android:src="@drawable/joystick" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_toRightOf="@+id/imageView"
|
android:layout_toRightOf="@+id/imageView"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/name_textview"
|
android:id="@+id/name_textview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="Large Text"
|
android:text="Large Text"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
android:id="@+id/hidden_switch"
|
android:id="@+id/hidden_switch"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginRight="10dp" />
|
android:layout_marginRight="10dp" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
|
@ -1,49 +1,49 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/gamepad_enable_checkbox"
|
android:id="@+id/gamepad_enable_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Enable Game Pad" />
|
android:text="Enable Game Pad" />
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/gamepad_hide_touch_checkbox"
|
android:id="@+id/gamepad_hide_touch_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Hide Touch Controls" />
|
android:text="Hide Touch Controls" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/gamepad_help_button"
|
android:id="@+id/gamepad_help_button"
|
||||||
style="@android:style/Animation"
|
style="@android:style/Animation"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
|
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="@drawable/help" />
|
android:background="@drawable/help" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/gamepad_info_textview"
|
android:id="@+id/gamepad_info_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="right"
|
||||||
android:text="Large Text"
|
android:text="Large Text"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/gamepad_listview"
|
android:id="@+id/gamepad_listview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:dividerHeight="10dp" >
|
android:dividerHeight="10dp" >
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,13 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
>
|
>
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Hello World, SDLActivity"
|
android:text="Hello World, SDLActivity"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -1,221 +1,221 @@
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" >
|
android:layout_height="fill_parent" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:minWidth="500dp"
|
android:minWidth="500dp"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/add_remove_button"
|
android:id="@+id/add_remove_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Add/remove buttons" />
|
android:text="Add/remove buttons" />
|
||||||
|
|
||||||
<TableLayout
|
<TableLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:id="@+id/tableRow1"
|
android:id="@+id/tableRow1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView1"
|
android:id="@+id/textView1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Fwd/Back:"
|
android:text="Fwd/Back:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/fwd_seekbar"
|
android:id="@+id/fwd_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:max="100" />
|
android:max="100" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:id="@+id/tableRow2"
|
android:id="@+id/tableRow2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Strafe:"
|
android:text="Strafe:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/strafe_seekbar"
|
android:id="@+id/strafe_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:max="100" />
|
android:max="100" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:id="@+id/tableRow3"
|
android:id="@+id/tableRow3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Look Up/Down:"
|
android:text="Look Up/Down:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/pitch_seekbar"
|
android:id="@+id/pitch_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:max="100" />
|
android:max="100" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:id="@+id/tableRow4"
|
android:id="@+id/tableRow4"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Turn:"
|
android:text="Turn:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/yaw_seekbar"
|
android:id="@+id/yaw_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:max="100" />
|
android:max="100" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:id="@+id/tableRow5"
|
android:id="@+id/tableRow5"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Transparency:"
|
android:text="Transparency:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/alpha_seekbar"
|
android:id="@+id/alpha_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:max="100" />
|
android:max="100" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/mouse_turn_checkbox"
|
android:id="@+id/mouse_turn_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="'Mouse' mode turning" />
|
android:text="'Mouse' mode turning" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/invert_loop_checkbox"
|
android:id="@+id/invert_loop_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Invert Look" />
|
android:text="Invert Look" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/precision_shoot_checkbox"
|
android:id="@+id/precision_shoot_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Precision Shoot" />
|
android:text="Precision Shoot" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/show_next_weapon_checkbox"
|
android:id="@+id/show_next_weapon_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Show Next/Prev Weapon" />
|
android:text="Show Next/Prev Weapon" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/show_sticks_checkbox"
|
android:id="@+id/show_sticks_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Show Movement arrows" />
|
android:text="Show Movement arrows" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/enable_weapon_wheel_checkbox"
|
android:id="@+id/enable_weapon_wheel_checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Enable Weapon Wheel" />
|
android:text="Enable Weapon Wheel" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Double tap Move:"
|
android:text="Double tap Move:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/move_dbl_tap_spinner"
|
android:id="@+id/move_dbl_tap_spinner"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Double tap Look:"
|
android:text="Double tap Look:"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/look_dbl_tap_spinner"
|
android:id="@+id/look_dbl_tap_spinner"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/save_button"
|
android:id="@+id/save_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Save" />
|
android:text="Save" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/cancel_button"
|
android:id="@+id/cancel_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="Cancel" />
|
android:text="Cancel" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Half-life</string>
|
<string name="app_name">Half-life</string>
|
||||||
|
|
||||||
<string-array name="double_tap_actions">
|
<string-array name="double_tap_actions">
|
||||||
<item>None</item>
|
<item>None</item>
|
||||||
<item>Shoot</item>
|
<item>Shoot</item>
|
||||||
<item>Jump</item>
|
<item>Jump</item>
|
||||||
<item>Use</item>
|
<item>Use</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
package com.beloko.games.hl;
|
package com.beloko.games.hl;
|
||||||
|
|
||||||
import com.beloko.touchcontrols.ControlInterface;
|
import com.beloko.touchcontrols.ControlInterface;
|
||||||
|
|
||||||
public class NativeLib implements ControlInterface{
|
public class NativeLib implements ControlInterface{
|
||||||
|
|
||||||
|
|
||||||
public static native int init(String graphics_dir,int mem,String[] args,int game,String path);
|
public static native int init(String graphics_dir,int mem,String[] args,int game,String path);
|
||||||
public static native int initTouchControls(String graphics_dir,int width,int height);
|
public static native int initTouchControls(String graphics_dir,int width,int height);
|
||||||
|
|
||||||
public static native void setScreenSize( int width, int height );
|
public static native void setScreenSize( int width, int height );
|
||||||
|
|
||||||
public static native boolean touchEvent( int action, int pid, float x, float y);
|
public static native boolean touchEvent( int action, int pid, float x, float y);
|
||||||
public static native void keypress(int down, int qkey, int unicode);
|
public static native void keypress(int down, int qkey, int unicode);
|
||||||
public static native void doAction(int state, int action);
|
public static native void doAction(int state, int action);
|
||||||
public static native void analogFwd(float v);
|
public static native void analogFwd(float v);
|
||||||
public static native void analogSide(float v);
|
public static native void analogSide(float v);
|
||||||
public static native void analogPitch(int mode,float v);
|
public static native void analogPitch(int mode,float v);
|
||||||
public static native void analogYaw(int mode,float v);
|
public static native void analogYaw(int mode,float v);
|
||||||
public static native void setTouchSettings(float alpha,float strafe,float fwd,float pitch,float yaw,int other);
|
public static native void setTouchSettings(float alpha,float strafe,float fwd,float pitch,float yaw,int other);
|
||||||
|
|
||||||
public static native void quickCommand(String command);
|
public static native void quickCommand(String command);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initTouchControls_if(String pngPath,int width,int height) {
|
public void initTouchControls_if(String pngPath,int width,int height) {
|
||||||
initTouchControls(pngPath,width,height);
|
initTouchControls(pngPath,width,height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void quickCommand_if(String command){
|
public void quickCommand_if(String command){
|
||||||
quickCommand(command);
|
quickCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean touchEvent_if(int action, int pid, float x, float y) {
|
public boolean touchEvent_if(int action, int pid, float x, float y) {
|
||||||
return touchEvent( action, pid, x, y);
|
return touchEvent( action, pid, x, y);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void keyPress_if(int down, int qkey, int unicode) {
|
public void keyPress_if(int down, int qkey, int unicode) {
|
||||||
keypress(down,qkey,unicode);
|
keypress(down,qkey,unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAction_if(int state, int action) {
|
public void doAction_if(int state, int action) {
|
||||||
doAction(state,action);
|
doAction(state,action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void analogFwd_if(float v) {
|
public void analogFwd_if(float v) {
|
||||||
analogFwd(v);
|
analogFwd(v);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void analogSide_if(float v) {
|
public void analogSide_if(float v) {
|
||||||
analogSide(v);
|
analogSide(v);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void analogPitch_if(int mode,float v)
|
public void analogPitch_if(int mode,float v)
|
||||||
{
|
{
|
||||||
analogPitch(mode,v);
|
analogPitch(mode,v);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void analogYaw_if(int mode,float v)
|
public void analogYaw_if(int mode,float v)
|
||||||
{
|
{
|
||||||
analogYaw(mode,v);
|
analogYaw(mode,v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTouchSettings_if(float alpha,float strafe, float fwd, float pitch,
|
public void setTouchSettings_if(float alpha,float strafe, float fwd, float pitch,
|
||||||
float yaw, int other) {
|
float yaw, int other) {
|
||||||
setTouchSettings(alpha,strafe, fwd, pitch, yaw, other);
|
setTouchSettings(alpha,strafe, fwd, pitch, yaw, other);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int mapKey(int acode, int unicode) {
|
public int mapKey(int acode, int unicode) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import com.beloko.touchcontrols.ControlConfig.Type;
|
import com.beloko.touchcontrols.ControlConfig.Type;
|
||||||
|
|
||||||
|
|
||||||
public class ActionInput implements Serializable
|
public class ActionInput implements Serializable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public String tag;
|
public String tag;
|
||||||
public String description;
|
public String description;
|
||||||
public boolean invert;
|
public boolean invert;
|
||||||
public float scale = 1; //senstivty for analog
|
public float scale = 1; //senstivty for analog
|
||||||
|
|
||||||
public int source = -1;
|
public int source = -1;
|
||||||
public Type sourceType;
|
public Type sourceType;
|
||||||
public boolean sourcePositive=true; //Used when using analog as a button
|
public boolean sourcePositive=true; //Used when using analog as a button
|
||||||
|
|
||||||
public int actionCode;
|
public int actionCode;
|
||||||
public Type actionType;
|
public Type actionType;
|
||||||
|
|
||||||
public ActionInput(String t,String n,int action,Type actiontype)
|
public ActionInput(String t,String n,int action,Type actiontype)
|
||||||
{
|
{
|
||||||
tag = t;
|
tag = t;
|
||||||
description = n;
|
description = n;
|
||||||
actionCode = action;
|
actionCode = action;
|
||||||
actionType = actiontype;
|
actionType = actiontype;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return description + ":" + sourceType.toString() + " source: " + source + " sourcePositive: " + sourcePositive;
|
return description + ":" + sourceType.toString() + " source: " + source + " sourcePositive: " + sourcePositive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,22 +1,22 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
public interface ControlInterface {
|
public interface ControlInterface {
|
||||||
|
|
||||||
public void initTouchControls_if(String pngPath,int width,int height);
|
public void initTouchControls_if(String pngPath,int width,int height);
|
||||||
|
|
||||||
public boolean touchEvent_if( int action, int pid, float x, float y);
|
public boolean touchEvent_if( int action, int pid, float x, float y);
|
||||||
public void keyPress_if(int down, int qkey, int unicode);
|
public void keyPress_if(int down, int qkey, int unicode);
|
||||||
public void doAction_if(int state, int action);
|
public void doAction_if(int state, int action);
|
||||||
public void analogFwd_if(float v);
|
public void analogFwd_if(float v);
|
||||||
public void analogSide_if(float v);
|
public void analogSide_if(float v);
|
||||||
public void analogPitch_if(int mode,float v);
|
public void analogPitch_if(int mode,float v);
|
||||||
public void analogYaw_if(int mode,float v);
|
public void analogYaw_if(int mode,float v);
|
||||||
public void setTouchSettings_if(float alpha,float strafe,float fwd,float pitch,float yaw,int other);
|
public void setTouchSettings_if(float alpha,float strafe,float fwd,float pitch,float yaw,int other);
|
||||||
|
|
||||||
public void quickCommand_if(String command);
|
public void quickCommand_if(String command);
|
||||||
|
|
||||||
public int mapKey(int acode,int unicode);
|
public int mapKey(int acode,int unicode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,304 +1,304 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
import com.bda.controller.Controller;
|
import com.bda.controller.Controller;
|
||||||
import com.beloko.touchcontrols.ControlConfig.Type;
|
import com.beloko.touchcontrols.ControlConfig.Type;
|
||||||
import com.beloko.touchcontrols.Settings.IDGame;
|
import com.beloko.touchcontrols.Settings.IDGame;
|
||||||
|
|
||||||
public class ControlInterpreter {
|
public class ControlInterpreter {
|
||||||
|
|
||||||
String LOG = "QuakeControlInterpreter";
|
String LOG = "QuakeControlInterpreter";
|
||||||
|
|
||||||
ControlInterface quakeIf;
|
ControlInterface quakeIf;
|
||||||
ControlConfig config;
|
ControlConfig config;
|
||||||
|
|
||||||
boolean gamePadEnabled;
|
boolean gamePadEnabled;
|
||||||
|
|
||||||
float screenWidth, screenHeight;
|
float screenWidth, screenHeight;
|
||||||
|
|
||||||
HashMap<Integer, Boolean> analogButtonState = new HashMap<Integer, Boolean>(); //Saves current state of analog buttons so all sent each time
|
HashMap<Integer, Boolean> analogButtonState = new HashMap<Integer, Boolean>(); //Saves current state of analog buttons so all sent each time
|
||||||
|
|
||||||
public ControlInterpreter(ControlInterface qif,IDGame game,String controlfile,boolean ctrlEn)
|
public ControlInterpreter(ControlInterface qif,IDGame game,String controlfile,boolean ctrlEn)
|
||||||
{
|
{
|
||||||
Log.d("QuakeControlInterpreter", "file = " + controlfile);
|
Log.d("QuakeControlInterpreter", "file = " + controlfile);
|
||||||
|
|
||||||
gamePadEnabled = ctrlEn;
|
gamePadEnabled = ctrlEn;
|
||||||
|
|
||||||
config = new ControlConfig(controlfile,game);
|
config = new ControlConfig(controlfile,game);
|
||||||
try {
|
try {
|
||||||
config.loadControls();
|
config.loadControls();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ActionInput ai: config.actions)
|
for (ActionInput ai: config.actions)
|
||||||
{
|
{
|
||||||
if ((ai.sourceType == Type.ANALOG) && ((ai.actionType == Type.MENU) || (ai.actionType == Type.BUTTON)))
|
if ((ai.sourceType == Type.ANALOG) && ((ai.actionType == Type.MENU) || (ai.actionType == Type.BUTTON)))
|
||||||
{
|
{
|
||||||
analogButtonState.put(ai.actionCode, false);
|
analogButtonState.put(ai.actionCode, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
quakeIf = qif;
|
quakeIf = qif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScreenSize(int w,int h)
|
public void setScreenSize(int w,int h)
|
||||||
{
|
{
|
||||||
screenWidth = w;
|
screenWidth = w;
|
||||||
screenHeight = h;
|
screenHeight = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onTouchEvent(MotionEvent event)
|
public boolean onTouchEvent(MotionEvent event)
|
||||||
{
|
{
|
||||||
int action = event.getAction();
|
int action = event.getAction();
|
||||||
int actionCode = action & MotionEvent.ACTION_MASK;
|
int actionCode = action & MotionEvent.ACTION_MASK;
|
||||||
|
|
||||||
if (actionCode == MotionEvent.ACTION_MOVE)
|
if (actionCode == MotionEvent.ACTION_MOVE)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < event.getPointerCount(); i++) {
|
for (int i = 0; i < event.getPointerCount(); i++) {
|
||||||
|
|
||||||
float x = event.getX(i)/screenWidth;
|
float x = event.getX(i)/screenWidth;
|
||||||
float y = event.getY(i)/screenHeight;
|
float y = event.getY(i)/screenHeight;
|
||||||
int pid = event.getPointerId(i);
|
int pid = event.getPointerId(i);
|
||||||
quakeIf.touchEvent_if(3, pid, x, y);
|
quakeIf.touchEvent_if(3, pid, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (actionCode == MotionEvent.ACTION_DOWN)
|
else if (actionCode == MotionEvent.ACTION_DOWN)
|
||||||
{
|
{
|
||||||
float x = event.getX()/screenWidth;
|
float x = event.getX()/screenWidth;
|
||||||
float y = event.getY()/screenHeight;
|
float y = event.getY()/screenHeight;
|
||||||
quakeIf.touchEvent_if(1, 0, x, y);
|
quakeIf.touchEvent_if(1, 0, x, y);
|
||||||
}
|
}
|
||||||
else if (actionCode == MotionEvent.ACTION_POINTER_DOWN)
|
else if (actionCode == MotionEvent.ACTION_POINTER_DOWN)
|
||||||
{
|
{
|
||||||
int index = event.getActionIndex();
|
int index = event.getActionIndex();
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
float x = event.getX(index)/screenWidth;
|
float x = event.getX(index)/screenWidth;
|
||||||
float y = event.getY(index)/screenHeight;
|
float y = event.getY(index)/screenHeight;
|
||||||
int pid = event.getPointerId(index);
|
int pid = event.getPointerId(index);
|
||||||
quakeIf.touchEvent_if(1, pid, x, y);
|
quakeIf.touchEvent_if(1, pid, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (actionCode == MotionEvent.ACTION_POINTER_UP)
|
else if (actionCode == MotionEvent.ACTION_POINTER_UP)
|
||||||
{
|
{
|
||||||
int index = event.getActionIndex();
|
int index = event.getActionIndex();
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
float x = event.getX(index)/screenWidth;
|
float x = event.getX(index)/screenWidth;
|
||||||
float y = event.getY(index)/screenHeight;
|
float y = event.getY(index)/screenHeight;
|
||||||
int pid = event.getPointerId(index);
|
int pid = event.getPointerId(index);
|
||||||
quakeIf.touchEvent_if(2, pid, x, y);
|
quakeIf.touchEvent_if(2, pid, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (actionCode == MotionEvent.ACTION_UP)
|
else if (actionCode == MotionEvent.ACTION_UP)
|
||||||
{
|
{
|
||||||
float x = event.getX()/screenWidth;
|
float x = event.getX()/screenWidth;
|
||||||
float y = event.getY()/screenHeight;
|
float y = event.getY()/screenHeight;
|
||||||
int index = event.getActionIndex();
|
int index = event.getActionIndex();
|
||||||
int pid = event.getPointerId(index);
|
int pid = event.getPointerId(index);
|
||||||
|
|
||||||
quakeIf.touchEvent_if(2, pid, x, y);
|
quakeIf.touchEvent_if(2, pid, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onMogaKeyEvent(com.bda.controller.KeyEvent event,int pad_version)
|
public void onMogaKeyEvent(com.bda.controller.KeyEvent event,int pad_version)
|
||||||
{
|
{
|
||||||
int keycode = event.getKeyCode();
|
int keycode = event.getKeyCode();
|
||||||
|
|
||||||
if (pad_version == Controller.ACTION_VERSION_MOGA)
|
if (pad_version == Controller.ACTION_VERSION_MOGA)
|
||||||
{
|
{
|
||||||
//Log.d(LOG,"removed");
|
//Log.d(LOG,"removed");
|
||||||
if ((keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_DOWN) ||
|
if ((keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_DOWN) ||
|
||||||
(keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_UP) ||
|
(keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_UP) ||
|
||||||
(keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_LEFT) ||
|
(keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_LEFT) ||
|
||||||
(keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_RIGHT))
|
(keycode == com.bda.controller.KeyEvent.KEYCODE_DPAD_RIGHT))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == com.bda.controller.KeyEvent.ACTION_DOWN)
|
if (event.getAction() == com.bda.controller.KeyEvent.ACTION_DOWN)
|
||||||
onKeyDown(keycode, null);
|
onKeyDown(keycode, null);
|
||||||
else if (event.getAction() == com.bda.controller.KeyEvent.ACTION_UP)
|
else if (event.getAction() == com.bda.controller.KeyEvent.ACTION_UP)
|
||||||
onKeyUp(keycode, null);
|
onKeyUp(keycode, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
boolean used = false;;
|
boolean used = false;;
|
||||||
if (gamePadEnabled)
|
if (gamePadEnabled)
|
||||||
{
|
{
|
||||||
for (ActionInput ai: config.actions)
|
for (ActionInput ai: config.actions)
|
||||||
{
|
{
|
||||||
if (((ai.sourceType == Type.BUTTON)||(ai.sourceType == Type.MENU)) && (ai.source == keyCode))
|
if (((ai.sourceType == Type.BUTTON)||(ai.sourceType == Type.MENU)) && (ai.source == keyCode))
|
||||||
{
|
{
|
||||||
quakeIf.doAction_if(1, ai.actionCode);
|
quakeIf.doAction_if(1, ai.actionCode);
|
||||||
Log.d(LOG,"key down intercept");
|
Log.d(LOG,"key down intercept");
|
||||||
used = true;
|
used = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (used)
|
if (used)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || //If these were mapped it would have already returned
|
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || //If these were mapped it would have already returned
|
||||||
(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN))
|
(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int uc = 0;
|
int uc = 0;
|
||||||
if (event !=null)
|
if (event !=null)
|
||||||
uc = event.getUnicodeChar();
|
uc = event.getUnicodeChar();
|
||||||
quakeIf.keyPress_if(1, quakeIf.mapKey(keyCode, uc), uc);
|
quakeIf.keyPress_if(1, quakeIf.mapKey(keyCode, uc), uc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
public boolean onKeyUp(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
boolean used = false;
|
boolean used = false;
|
||||||
|
|
||||||
if (gamePadEnabled)
|
if (gamePadEnabled)
|
||||||
{
|
{
|
||||||
for (ActionInput ai: config.actions)
|
for (ActionInput ai: config.actions)
|
||||||
{
|
{
|
||||||
if (((ai.sourceType == Type.BUTTON) || (ai.sourceType == Type.MENU)) && (ai.source == keyCode))
|
if (((ai.sourceType == Type.BUTTON) || (ai.sourceType == Type.MENU)) && (ai.source == keyCode))
|
||||||
{
|
{
|
||||||
quakeIf.doAction_if(0, ai.actionCode);
|
quakeIf.doAction_if(0, ai.actionCode);
|
||||||
used = true;
|
used = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (used)
|
if (used)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || //If these were mapped it would have already returned
|
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || //If these were mapped it would have already returned
|
||||||
(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN))
|
(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int uc = 0;
|
int uc = 0;
|
||||||
if (event !=null)
|
if (event !=null)
|
||||||
uc = event.getUnicodeChar();
|
uc = event.getUnicodeChar();
|
||||||
quakeIf.keyPress_if(0, quakeIf.mapKey(keyCode, uc), uc);
|
quakeIf.keyPress_if(0, quakeIf.mapKey(keyCode, uc), uc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float deadRegion = 0.2f;
|
float deadRegion = 0.2f;
|
||||||
private float analogCalibrate(float v)
|
private float analogCalibrate(float v)
|
||||||
{
|
{
|
||||||
if ((v < deadRegion) && (v > -deadRegion))
|
if ((v < deadRegion) && (v > -deadRegion))
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (v > 0)
|
if (v > 0)
|
||||||
return(v-deadRegion) / (1-deadRegion);
|
return(v-deadRegion) / (1-deadRegion);
|
||||||
else
|
else
|
||||||
return(v+deadRegion) / (1-deadRegion);
|
return(v+deadRegion) / (1-deadRegion);
|
||||||
//return v;
|
//return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericAxisValues genericAxisValues = new GenericAxisValues();
|
GenericAxisValues genericAxisValues = new GenericAxisValues();
|
||||||
|
|
||||||
|
|
||||||
//This is for normal Android motioon event
|
//This is for normal Android motioon event
|
||||||
public boolean onGenericMotionEvent(MotionEvent event) {
|
public boolean onGenericMotionEvent(MotionEvent event) {
|
||||||
genericAxisValues.setAndroidValues(event);
|
genericAxisValues.setAndroidValues(event);
|
||||||
return onGenericMotionEvent(genericAxisValues);
|
return onGenericMotionEvent(genericAxisValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
//This is for Moga event
|
//This is for Moga event
|
||||||
public boolean onGenericMotionEvent(com.bda.controller.MotionEvent event) {
|
public boolean onGenericMotionEvent(com.bda.controller.MotionEvent event) {
|
||||||
genericAxisValues.setMogaValues(event);
|
genericAxisValues.setMogaValues(event);
|
||||||
return onGenericMotionEvent(genericAxisValues);
|
return onGenericMotionEvent(genericAxisValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onGenericMotionEvent(GenericAxisValues event) {
|
public boolean onGenericMotionEvent(GenericAxisValues event) {
|
||||||
if (Settings.DEBUG) Log.d(LOG,"onGenericMotionEvent" );
|
if (Settings.DEBUG) Log.d(LOG,"onGenericMotionEvent" );
|
||||||
|
|
||||||
boolean used = false;
|
boolean used = false;
|
||||||
if (gamePadEnabled)
|
if (gamePadEnabled)
|
||||||
{
|
{
|
||||||
for (ActionInput ai: config.actions)
|
for (ActionInput ai: config.actions)
|
||||||
{
|
{
|
||||||
if ((ai.sourceType == Type.ANALOG) && (ai.source != -1))
|
if ((ai.sourceType == Type.ANALOG) && (ai.source != -1))
|
||||||
{
|
{
|
||||||
int invert;
|
int invert;
|
||||||
invert = ai.invert?-1:1;
|
invert = ai.invert?-1:1;
|
||||||
if (ai.actionCode == ControlConfig.ACTION_ANALOG_PITCH)
|
if (ai.actionCode == ControlConfig.ACTION_ANALOG_PITCH)
|
||||||
quakeIf.analogPitch_if(ControlConfig.LOOK_MODE_JOYSTICK, analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
quakeIf.analogPitch_if(ControlConfig.LOOK_MODE_JOYSTICK, analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
||||||
else if (ai.actionCode == ControlConfig.ACTION_ANALOG_YAW)
|
else if (ai.actionCode == ControlConfig.ACTION_ANALOG_YAW)
|
||||||
quakeIf.analogYaw_if(ControlConfig.LOOK_MODE_JOYSTICK, -analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
quakeIf.analogYaw_if(ControlConfig.LOOK_MODE_JOYSTICK, -analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
||||||
else if (ai.actionCode == ControlConfig.ACTION_ANALOG_FWD)
|
else if (ai.actionCode == ControlConfig.ACTION_ANALOG_FWD)
|
||||||
quakeIf.analogFwd_if(-analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
quakeIf.analogFwd_if(-analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
||||||
else if (ai.actionCode == ControlConfig.ACTION_ANALOG_STRAFE)
|
else if (ai.actionCode == ControlConfig.ACTION_ANALOG_STRAFE)
|
||||||
quakeIf.analogSide_if(analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
quakeIf.analogSide_if(analogCalibrate(event.getAxisValue(ai.source)) * invert * ai.scale);
|
||||||
else //Must be using analog as a button
|
else //Must be using analog as a button
|
||||||
{
|
{
|
||||||
if (Settings.DEBUG) Log.d(LOG,"Analog as button" );
|
if (Settings.DEBUG) Log.d(LOG,"Analog as button" );
|
||||||
|
|
||||||
if (Settings.DEBUG) Log.d(LOG,ai.toString());
|
if (Settings.DEBUG) Log.d(LOG,ai.toString());
|
||||||
|
|
||||||
if (((ai.sourcePositive) && (event.getAxisValue(ai.source)) > 0.5) ||
|
if (((ai.sourcePositive) && (event.getAxisValue(ai.source)) > 0.5) ||
|
||||||
((!ai.sourcePositive) && (event.getAxisValue(ai.source)) < -0.5) )
|
((!ai.sourcePositive) && (event.getAxisValue(ai.source)) < -0.5) )
|
||||||
{
|
{
|
||||||
if (!analogButtonState.get(ai.actionCode)) //Check internal state, only send if different
|
if (!analogButtonState.get(ai.actionCode)) //Check internal state, only send if different
|
||||||
{
|
{
|
||||||
quakeIf.doAction_if(1, ai.actionCode); //press
|
quakeIf.doAction_if(1, ai.actionCode); //press
|
||||||
analogButtonState.put(ai.actionCode, true);
|
analogButtonState.put(ai.actionCode, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (analogButtonState.get(ai.actionCode)) //Check internal state, only send if different
|
if (analogButtonState.get(ai.actionCode)) //Check internal state, only send if different
|
||||||
{
|
{
|
||||||
quakeIf.doAction_if(0, ai.actionCode); //un-press
|
quakeIf.doAction_if(0, ai.actionCode); //un-press
|
||||||
analogButtonState.put(ai.actionCode, false);
|
analogButtonState.put(ai.actionCode, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
used = true;
|
used = true;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
//Menu buttons
|
//Menu buttons
|
||||||
if ((ai.sourceType == Type.ANALOG) && (ai.actionType == Type.MENU) && (ai.source != -1))
|
if ((ai.sourceType == Type.ANALOG) && (ai.actionType == Type.MENU) && (ai.source != -1))
|
||||||
{
|
{
|
||||||
if (GD.DEBUG) Log.d(LOG,"Analog as MENU button" );
|
if (GD.DEBUG) Log.d(LOG,"Analog as MENU button" );
|
||||||
if (GD.DEBUG) Log.d(LOG,ai.toString());
|
if (GD.DEBUG) Log.d(LOG,ai.toString());
|
||||||
if (((ai.sourcePositive) && (event.getAxisValue(ai.source)) > 0.5) ||
|
if (((ai.sourcePositive) && (event.getAxisValue(ai.source)) > 0.5) ||
|
||||||
((!ai.sourcePositive) && (event.getAxisValue(ai.source)) < -0.5) )
|
((!ai.sourcePositive) && (event.getAxisValue(ai.source)) < -0.5) )
|
||||||
quakeIf.doAction_if(1, ai.actionCode); //press
|
quakeIf.doAction_if(1, ai.actionCode); //press
|
||||||
else
|
else
|
||||||
quakeIf.doAction_if(0, ai.actionCode); //un-press
|
quakeIf.doAction_if(0, ai.actionCode); //un-press
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return used;
|
return used;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,289 +1,289 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import in.celest.xash3d.hl.R;
|
import in.celest.xash3d.hl.R;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.AdapterView.OnItemLongClickListener;
|
import android.widget.AdapterView.OnItemLongClickListener;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.bda.controller.Controller;
|
import com.bda.controller.Controller;
|
||||||
import com.bda.controller.ControllerListener;
|
import com.bda.controller.ControllerListener;
|
||||||
import com.bda.controller.StateEvent;
|
import com.bda.controller.StateEvent;
|
||||||
|
|
||||||
public class GamePadFragment extends Fragment{
|
public class GamePadFragment extends Fragment{
|
||||||
final String LOG = "GamePadFragment";
|
final String LOG = "GamePadFragment";
|
||||||
|
|
||||||
ListView listView;
|
ListView listView;
|
||||||
ControlListAdapter adapter;
|
ControlListAdapter adapter;
|
||||||
|
|
||||||
TextView info;
|
TextView info;
|
||||||
|
|
||||||
ControlConfig config;
|
ControlConfig config;
|
||||||
|
|
||||||
GenericAxisValues genericAxisValues = new GenericAxisValues();
|
GenericAxisValues genericAxisValues = new GenericAxisValues();
|
||||||
|
|
||||||
Controller mogaController = null;
|
Controller mogaController = null;
|
||||||
final MogaControllerListener mListener = new MogaControllerListener();
|
final MogaControllerListener mListener = new MogaControllerListener();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
config = new ControlConfig(Settings.gamePadControlsFile,Settings.game);
|
config = new ControlConfig(Settings.gamePadControlsFile,Settings.game);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config.loadControls();
|
config.loadControls();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mogaController = Controller.getInstance(getActivity());
|
mogaController = Controller.getInstance(getActivity());
|
||||||
mogaController.init();
|
mogaController.init();
|
||||||
mogaController.setListener(mListener,new Handler());
|
mogaController.setListener(mListener,new Handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean isHidden = true;
|
boolean isHidden = true;
|
||||||
@Override
|
@Override
|
||||||
public void onHiddenChanged(boolean hidden) {
|
public void onHiddenChanged(boolean hidden) {
|
||||||
isHidden = hidden;
|
isHidden = hidden;
|
||||||
super.onHiddenChanged(hidden);
|
super.onHiddenChanged(hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause()
|
public void onPause()
|
||||||
{
|
{
|
||||||
super.onPause();
|
super.onPause();
|
||||||
mogaController.onPause();
|
mogaController.onPause();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mogaController.onResume();
|
mogaController.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
mogaController.exit();
|
mogaController.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View mainView = inflater.inflate(R.layout.fragment_gamepad, null);
|
View mainView = inflater.inflate(R.layout.fragment_gamepad, null);
|
||||||
|
|
||||||
|
|
||||||
CheckBox enableCb = (CheckBox)mainView.findViewById(R.id.gamepad_enable_checkbox);
|
CheckBox enableCb = (CheckBox)mainView.findViewById(R.id.gamepad_enable_checkbox);
|
||||||
enableCb.setChecked(Settings.gamePadEnabled);
|
enableCb.setChecked(Settings.gamePadEnabled);
|
||||||
|
|
||||||
enableCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
enableCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
Settings.setBoolOption(getActivity(), "gamepad_enabled", isChecked);
|
Settings.setBoolOption(getActivity(), "gamepad_enabled", isChecked);
|
||||||
Settings.gamePadEnabled = isChecked;
|
Settings.gamePadEnabled = isChecked;
|
||||||
setListViewEnabled(Settings.gamePadEnabled);
|
setListViewEnabled(Settings.gamePadEnabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
CheckBox hideCtrlCb = (CheckBox)mainView.findViewById(R.id.gamepad_hide_touch_checkbox);
|
CheckBox hideCtrlCb = (CheckBox)mainView.findViewById(R.id.gamepad_hide_touch_checkbox);
|
||||||
hideCtrlCb.setChecked(Settings.hideTouchControls);
|
hideCtrlCb.setChecked(Settings.hideTouchControls);
|
||||||
|
|
||||||
hideCtrlCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
hideCtrlCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
Settings.setBoolOption(getActivity(), "hide_touch_controls", isChecked);
|
Settings.setBoolOption(getActivity(), "hide_touch_controls", isChecked);
|
||||||
Settings.hideTouchControls = isChecked;
|
Settings.hideTouchControls = isChecked;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Button help = (Button)mainView.findViewById(R.id.gamepad_help_button);
|
Button help = (Button)mainView.findViewById(R.id.gamepad_help_button);
|
||||||
help.setOnClickListener(new OnClickListener() {
|
help.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//NoticeDialog.show(getActivity(),"Gamepad Help", R.raw.gamepad);
|
//NoticeDialog.show(getActivity(),"Gamepad Help", R.raw.gamepad);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
listView = (ListView)mainView.findViewById(R.id.gamepad_listview);
|
listView = (ListView)mainView.findViewById(R.id.gamepad_listview);
|
||||||
adapter = new ControlListAdapter(getActivity());
|
adapter = new ControlListAdapter(getActivity());
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
setListViewEnabled(Settings.gamePadEnabled);
|
setListViewEnabled(Settings.gamePadEnabled);
|
||||||
|
|
||||||
|
|
||||||
listView.setSelector(R.drawable.layout_sel_background);
|
listView.setSelector(R.drawable.layout_sel_background);
|
||||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
listView.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> arg0, View v, int pos,
|
public void onItemClick(AdapterView<?> arg0, View v, int pos,
|
||||||
long id) {
|
long id) {
|
||||||
config.startMonitor(getActivity(), pos);
|
config.startMonitor(getActivity(), pos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
|
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> arg0, View v, int pos,
|
public boolean onItemLongClick(AdapterView<?> arg0, View v, int pos,
|
||||||
long id) {
|
long id) {
|
||||||
return config.showExtraOptions(getActivity(), pos);
|
return config.showExtraOptions(getActivity(), pos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
info = (TextView)mainView.findViewById(R.id.gamepad_info_textview);
|
info = (TextView)mainView.findViewById(R.id.gamepad_info_textview);
|
||||||
info.setText("Select Action");
|
info.setText("Select Action");
|
||||||
info.setTextColor(getResources().getColor(android.R.color.holo_blue_light));
|
info.setTextColor(getResources().getColor(android.R.color.holo_blue_light));
|
||||||
|
|
||||||
config.setTextView(getActivity(),info);
|
config.setTextView(getActivity(),info);
|
||||||
|
|
||||||
return mainView;
|
return mainView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListViewEnabled(boolean v)
|
private void setListViewEnabled(boolean v)
|
||||||
{
|
{
|
||||||
|
|
||||||
listView.setEnabled(v);
|
listView.setEnabled(v);
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
listView.setAlpha(1);
|
listView.setAlpha(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
listView.setAlpha(0.3f);
|
listView.setAlpha(0.3f);
|
||||||
//listView.setBackgroundColor(Color.GRAY);
|
//listView.setBackgroundColor(Color.GRAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onGenericMotionEvent(MotionEvent event)
|
public boolean onGenericMotionEvent(MotionEvent event)
|
||||||
{
|
{
|
||||||
genericAxisValues.setAndroidValues(event);
|
genericAxisValues.setAndroidValues(event);
|
||||||
|
|
||||||
if (config.onGenericMotionEvent(genericAxisValues))
|
if (config.onGenericMotionEvent(genericAxisValues))
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
|
||||||
//return config.isMonitoring(); //This does not work, mouse appears anyway
|
//return config.isMonitoring(); //This does not work, mouse appears anyway
|
||||||
return !isHidden; //If gamepas tab visible always steal
|
return !isHidden; //If gamepas tab visible always steal
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
if (config.onKeyDown(keyCode, event))
|
if (config.onKeyDown(keyCode, event))
|
||||||
{
|
{
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
public boolean onKeyUp(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
if(config.onKeyUp(keyCode, event))
|
if(config.onKeyUp(keyCode, event))
|
||||||
{
|
{
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControlListAdapter extends BaseAdapter{
|
class ControlListAdapter extends BaseAdapter{
|
||||||
private Activity context;
|
private Activity context;
|
||||||
|
|
||||||
public ControlListAdapter(Activity context){
|
public ControlListAdapter(Activity context){
|
||||||
this.context=context;
|
this.context=context;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void add(String string){
|
public void add(String string){
|
||||||
|
|
||||||
}
|
}
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return config.getSize();
|
return config.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getItem(int arg0) {
|
public Object getItem(int arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getItemId(int arg0) {
|
public long getItemId(int arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public View getView (int position, View convertView, ViewGroup list) {
|
public View getView (int position, View convertView, ViewGroup list) {
|
||||||
View v = config.getView(getActivity(), position);
|
View v = config.getView(getActivity(), position);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MogaControllerListener implements ControllerListener {
|
class MogaControllerListener implements ControllerListener {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onKeyEvent(com.bda.controller.KeyEvent event) {
|
public void onKeyEvent(com.bda.controller.KeyEvent event) {
|
||||||
//Log.d(LOG,"onKeyEvent " + event.getKeyCode());
|
//Log.d(LOG,"onKeyEvent " + event.getKeyCode());
|
||||||
|
|
||||||
if (event.getAction() == com.bda.controller.KeyEvent.ACTION_DOWN)
|
if (event.getAction() == com.bda.controller.KeyEvent.ACTION_DOWN)
|
||||||
onKeyDown(event.getKeyCode(),null);
|
onKeyDown(event.getKeyCode(),null);
|
||||||
else if (event.getAction() == com.bda.controller.KeyEvent.ACTION_UP)
|
else if (event.getAction() == com.bda.controller.KeyEvent.ACTION_UP)
|
||||||
onKeyUp(event.getKeyCode(),null);
|
onKeyUp(event.getKeyCode(),null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMotionEvent(com.bda.controller.MotionEvent event) {
|
public void onMotionEvent(com.bda.controller.MotionEvent event) {
|
||||||
//Log.d(LOG,"onGenericMotionEvent " + event.toString());
|
//Log.d(LOG,"onGenericMotionEvent " + event.toString());
|
||||||
|
|
||||||
genericAxisValues.setMogaValues(event);
|
genericAxisValues.setMogaValues(event);
|
||||||
|
|
||||||
if (config.onGenericMotionEvent(genericAxisValues))
|
if (config.onGenericMotionEvent(genericAxisValues))
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStateEvent(StateEvent event) {
|
public void onStateEvent(StateEvent event) {
|
||||||
Log.d(LOG,"onStateEvent " + event.getState());
|
Log.d(LOG,"onStateEvent " + event.getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
public class GenericAxisValues {
|
public class GenericAxisValues {
|
||||||
float[] values = new float[64];
|
float[] values = new float[64];
|
||||||
|
|
||||||
public float getAxisValue(int a)
|
public float getAxisValue(int a)
|
||||||
{
|
{
|
||||||
return values[a];
|
return values[a];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAxisValue(int a,float v)
|
public void setAxisValue(int a,float v)
|
||||||
{
|
{
|
||||||
values[a] = v;
|
values[a] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAndroidValues(MotionEvent event){
|
public void setAndroidValues(MotionEvent event){
|
||||||
for (int n=0;n<64;n++)
|
for (int n=0;n<64;n++)
|
||||||
values[n] = event.getAxisValue(n);
|
values[n] = event.getAxisValue(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMogaValues(com.bda.controller.MotionEvent event){
|
public void setMogaValues(com.bda.controller.MotionEvent event){
|
||||||
values[MotionEvent.AXIS_X] = event.getAxisValue(MotionEvent.AXIS_X);
|
values[MotionEvent.AXIS_X] = event.getAxisValue(MotionEvent.AXIS_X);
|
||||||
values[MotionEvent.AXIS_Y] = event.getAxisValue(MotionEvent.AXIS_Y);
|
values[MotionEvent.AXIS_Y] = event.getAxisValue(MotionEvent.AXIS_Y);
|
||||||
values[MotionEvent.AXIS_Z] = event.getAxisValue(MotionEvent.AXIS_Z);
|
values[MotionEvent.AXIS_Z] = event.getAxisValue(MotionEvent.AXIS_Z);
|
||||||
values[MotionEvent.AXIS_RZ] = event.getAxisValue(MotionEvent.AXIS_RZ);
|
values[MotionEvent.AXIS_RZ] = event.getAxisValue(MotionEvent.AXIS_RZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class QuickCommand implements Serializable{
|
public class QuickCommand implements Serializable{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
String title;
|
String title;
|
||||||
String command;
|
String command;
|
||||||
|
|
||||||
QuickCommand(String title, String command)
|
QuickCommand(String title, String command)
|
||||||
{
|
{
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.command = command;
|
this.command = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCommand() {
|
public String getCommand() {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommand(String command) {
|
public void setCommand(String command) {
|
||||||
this.command = command;
|
this.command = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,144 +1,144 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
|
||||||
public class Settings {
|
public class Settings {
|
||||||
public static boolean DEBUG = false;
|
public static boolean DEBUG = false;
|
||||||
|
|
||||||
public static String gamePadControlsFile = "gamepadSettings.dat";
|
public static String gamePadControlsFile = "gamepadSettings.dat";
|
||||||
public static String graphicsDir = "";
|
public static String graphicsDir = "";
|
||||||
|
|
||||||
public static boolean gamePadEnabled;
|
public static boolean gamePadEnabled;
|
||||||
public static boolean hideTouchControls;
|
public static boolean hideTouchControls;
|
||||||
|
|
||||||
public enum IDGame{Quake,Quake2,Doom,Duke3d,Quake3,Hexen2,RTCW,Wolf3d,JK2,JK3,Heretic,Hexen,Strife,AVP,Shadow,Gish,Descent1,Descent2,Homeworld,BlakeStone,Noah,Doom3};
|
public enum IDGame{Quake,Quake2,Doom,Duke3d,Quake3,Hexen2,RTCW,Wolf3d,JK2,JK3,Heretic,Hexen,Strife,AVP,Shadow,Gish,Descent1,Descent2,Homeworld,BlakeStone,Noah,Doom3};
|
||||||
|
|
||||||
public static IDGame game;
|
public static IDGame game;
|
||||||
|
|
||||||
|
|
||||||
public static float getFloatOption(Context ctx,String name, float def)
|
public static float getFloatOption(Context ctx,String name, float def)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
return settings.getFloat(name, def);
|
return settings.getFloat(name, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFloatOption(Context ctx,String name, float value)
|
public static void setFloatOption(Context ctx,String name, float value)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putFloat(name, value);
|
editor.putFloat(name, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getBoolOption(Context ctx,String name, boolean def)
|
public static boolean getBoolOption(Context ctx,String name, boolean def)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
return settings.getBoolean(name, def);
|
return settings.getBoolean(name, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBoolOption(Context ctx,String name, boolean value)
|
public static void setBoolOption(Context ctx,String name, boolean value)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putBoolean(name, value);
|
editor.putBoolean(name, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getIntOption(Context ctx,String name, int def)
|
public static int getIntOption(Context ctx,String name, int def)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
return settings.getInt(name, def);
|
return settings.getInt(name, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setIntOption(Context ctx,String name, int value)
|
public static void setIntOption(Context ctx,String name, int value)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putInt(name, value);
|
editor.putInt(name, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getLongOption(Context ctx,String name, long def)
|
public static long getLongOption(Context ctx,String name, long def)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
return settings.getLong(name, def);
|
return settings.getLong(name, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLongOption(Context ctx,String name, long value)
|
public static void setLongOption(Context ctx,String name, long value)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putLong(name, value);
|
editor.putLong(name, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getStringOption(Context ctx,String name, String def)
|
public static String getStringOption(Context ctx,String name, String def)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
return settings.getString(name, def);
|
return settings.getString(name, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setStringOption(Context ctx,String name, String value)
|
public static void setStringOption(Context ctx,String name, String value)
|
||||||
{
|
{
|
||||||
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
SharedPreferences settings = ctx.getSharedPreferences("OPTIONS", Context.MODE_MULTI_PROCESS);
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putString(name, value);
|
editor.putString(name, value);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void copyFile(InputStream in, OutputStream out) throws IOException {
|
static public void copyFile(InputStream in, OutputStream out) throws IOException {
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int read;
|
int read;
|
||||||
while((read = in.read(buffer)) != -1){
|
while((read = in.read(buffer)) != -1){
|
||||||
out.write(buffer, 0, read);
|
out.write(buffer, 0, read);
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void copyPNGAssets(Context ctx,String dir,String prefix) {
|
static public void copyPNGAssets(Context ctx,String dir,String prefix) {
|
||||||
|
|
||||||
if (prefix == null)
|
if (prefix == null)
|
||||||
prefix = "";
|
prefix = "";
|
||||||
|
|
||||||
File d = new File(dir);
|
File d = new File(dir);
|
||||||
if (!d.exists())
|
if (!d.exists())
|
||||||
d.mkdirs();
|
d.mkdirs();
|
||||||
|
|
||||||
AssetManager assetManager = ctx.getAssets();
|
AssetManager assetManager = ctx.getAssets();
|
||||||
String[] files = null;
|
String[] files = null;
|
||||||
try {
|
try {
|
||||||
files = assetManager.list("");
|
files = assetManager.list("");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e("tag", "Failed to get asset file list.", e);
|
Log.e("tag", "Failed to get asset file list.", e);
|
||||||
}
|
}
|
||||||
for(String filename : files) {
|
for(String filename : files) {
|
||||||
if (filename.endsWith("png") && filename.startsWith(prefix)){
|
if (filename.endsWith("png") && filename.startsWith(prefix)){
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
//Log.d("test","file = " + filename);
|
//Log.d("test","file = " + filename);
|
||||||
try {
|
try {
|
||||||
in = assetManager.open(filename);
|
in = assetManager.open(filename);
|
||||||
out = new FileOutputStream(dir + "/" + filename.substring(prefix.length()));
|
out = new FileOutputStream(dir + "/" + filename.substring(prefix.length()));
|
||||||
copyFile(in, out);
|
copyFile(in, out);
|
||||||
in.close();
|
in.close();
|
||||||
in = null;
|
in = null;
|
||||||
out.flush();
|
out.flush();
|
||||||
out.close();
|
out.close();
|
||||||
out = null;
|
out = null;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
Log.e("tag", "Failed to copy asset file: " + filename, e);
|
Log.e("tag", "Failed to copy asset file: " + filename, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,68 +1,68 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
public class ShowKeyboard {
|
public class ShowKeyboard {
|
||||||
static Activity activity;
|
static Activity activity;
|
||||||
static View view;;
|
static View view;;
|
||||||
|
|
||||||
public static void setup(Activity a,View v)
|
public static void setup(Activity a,View v)
|
||||||
{
|
{
|
||||||
activity = a;
|
activity = a;
|
||||||
view = v;
|
view = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void toggleKeyboard()
|
public static void toggleKeyboard()
|
||||||
{
|
{
|
||||||
Log.d("ShowKeyboard","toggleKeyboard");
|
Log.d("ShowKeyboard","toggleKeyboard");
|
||||||
|
|
||||||
InputMethodManager im = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager im = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
if (im != null)
|
if (im != null)
|
||||||
{
|
{
|
||||||
Log.d("ShowKeyboard","toggleKeyboard...");
|
Log.d("ShowKeyboard","toggleKeyboard...");
|
||||||
im.toggleSoftInput(0, 0);
|
im.toggleSoftInput(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showKeyboard(int show)
|
public static void showKeyboard(int show)
|
||||||
{
|
{
|
||||||
Log.d("ShowKeyboard","showKeyboard " + show);
|
Log.d("ShowKeyboard","showKeyboard " + show);
|
||||||
|
|
||||||
InputMethodManager im = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager im = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
if (im != null)
|
if (im != null)
|
||||||
{
|
{
|
||||||
if (show == 0)
|
if (show == 0)
|
||||||
{
|
{
|
||||||
im.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
|
im.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
if (show == 1)
|
if (show == 1)
|
||||||
if (!im.isAcceptingText())
|
if (!im.isAcceptingText())
|
||||||
toggleKeyboard();
|
toggleKeyboard();
|
||||||
if (show == 2)
|
if (show == 2)
|
||||||
toggleKeyboard();
|
toggleKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
InputMethodManager imm = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
if (show == 1)
|
if (show == 1)
|
||||||
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
|
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
|
||||||
else
|
else
|
||||||
imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasHardwareKeyboard()
|
public static boolean hasHardwareKeyboard()
|
||||||
{
|
{
|
||||||
if(activity == null)
|
if(activity == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return activity.getApplicationContext().getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
|
return activity.getApplicationContext().getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,145 +1,145 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
import in.celest.xash3d.hl.R;
|
import in.celest.xash3d.hl.R;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
public class TouchControlsEditing {
|
public class TouchControlsEditing {
|
||||||
|
|
||||||
static String TAG = "TouchControlsEditing";
|
static String TAG = "TouchControlsEditing";
|
||||||
|
|
||||||
static class ControlInfo
|
static class ControlInfo
|
||||||
{
|
{
|
||||||
String tag;
|
String tag;
|
||||||
String image;
|
String image;
|
||||||
boolean enabled;
|
boolean enabled;
|
||||||
boolean hidden;
|
boolean hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ListAdapter adapter;
|
static ListAdapter adapter;
|
||||||
|
|
||||||
static Activity activity;
|
static Activity activity;
|
||||||
|
|
||||||
public static native void JNIGetControlInfo(int pos,ControlInfo info);
|
public static native void JNIGetControlInfo(int pos,ControlInfo info);
|
||||||
|
|
||||||
public static native int JNIGetNbrControls();
|
public static native int JNIGetNbrControls();
|
||||||
|
|
||||||
public static native void JNISetHidden(int pos, boolean hidden);
|
public static native void JNISetHidden(int pos, boolean hidden);
|
||||||
|
|
||||||
public static void setup(Activity a)
|
public static void setup(Activity a)
|
||||||
{
|
{
|
||||||
activity = a;
|
activity = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show()
|
public static void show()
|
||||||
{
|
{
|
||||||
show(activity);
|
show(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show(Activity act)
|
public static void show(Activity act)
|
||||||
{
|
{
|
||||||
Log.d(TAG,"showSettings");
|
Log.d(TAG,"showSettings");
|
||||||
|
|
||||||
if (act != null)
|
if (act != null)
|
||||||
activity = act;
|
activity = act;
|
||||||
|
|
||||||
activity.runOnUiThread(new Runnable(){
|
activity.runOnUiThread(new Runnable(){
|
||||||
public void run() {
|
public void run() {
|
||||||
final Dialog dialog = new Dialog(activity);
|
final Dialog dialog = new Dialog(activity);
|
||||||
ListView listView = new ListView(activity);
|
ListView listView = new ListView(activity);
|
||||||
|
|
||||||
dialog.setContentView(listView);
|
dialog.setContentView(listView);
|
||||||
dialog.setTitle("Add/remove buttons");
|
dialog.setTitle("Add/remove buttons");
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
|
|
||||||
adapter = new ListAdapter(activity);
|
adapter = new ListAdapter(activity);
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
dialog.getWindow().setFlags(
|
dialog.getWindow().setFlags(
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ListAdapter extends BaseAdapter{
|
static class ListAdapter extends BaseAdapter{
|
||||||
private Activity context;
|
private Activity context;
|
||||||
|
|
||||||
public ListAdapter(Activity context){
|
public ListAdapter(Activity context){
|
||||||
this.context=context;
|
this.context=context;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void add(String string){
|
public void add(String string){
|
||||||
|
|
||||||
}
|
}
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return TouchControlsEditing.JNIGetNbrControls();
|
return TouchControlsEditing.JNIGetNbrControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getItem(int arg0) {
|
public Object getItem(int arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getItemId(int arg0) {
|
public long getItemId(int arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public View getView (int position, View convertView, ViewGroup list) {
|
public View getView (int position, View convertView, ViewGroup list) {
|
||||||
//if (convertView == null) dont reuse view otherwise check change get called
|
//if (convertView == null) dont reuse view otherwise check change get called
|
||||||
convertView = activity.getLayoutInflater().inflate(R.layout.edit_controls_listview_item, null);
|
convertView = activity.getLayoutInflater().inflate(R.layout.edit_controls_listview_item, null);
|
||||||
|
|
||||||
final int my_pos = position;
|
final int my_pos = position;
|
||||||
|
|
||||||
ImageView image = (ImageView)convertView.findViewById(R.id.imageView);
|
ImageView image = (ImageView)convertView.findViewById(R.id.imageView);
|
||||||
TextView name = (TextView)convertView.findViewById(R.id.name_textview);
|
TextView name = (TextView)convertView.findViewById(R.id.name_textview);
|
||||||
ToggleButton hidden = (ToggleButton)convertView.findViewById(R.id.hidden_switch);
|
ToggleButton hidden = (ToggleButton)convertView.findViewById(R.id.hidden_switch);
|
||||||
|
|
||||||
|
|
||||||
TouchControlsEditing.ControlInfo ci = new TouchControlsEditing.ControlInfo();
|
TouchControlsEditing.ControlInfo ci = new TouchControlsEditing.ControlInfo();
|
||||||
TouchControlsEditing.JNIGetControlInfo(position, ci);
|
TouchControlsEditing.JNIGetControlInfo(position, ci);
|
||||||
|
|
||||||
name.setText(ci.tag);
|
name.setText(ci.tag);
|
||||||
hidden.setChecked(!ci.hidden);
|
hidden.setChecked(!ci.hidden);
|
||||||
hidden.setTag(new Integer(position));
|
hidden.setTag(new Integer(position));
|
||||||
|
|
||||||
hidden.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
hidden.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
Integer pos = (Integer)buttonView.getTag();
|
Integer pos = (Integer)buttonView.getTag();
|
||||||
|
|
||||||
TouchControlsEditing.JNISetHidden(pos, !isChecked);
|
TouchControlsEditing.JNISetHidden(pos, !isChecked);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
String png = activity.getFilesDir() + "/" + ci.image + ".png";
|
String png = activity.getFilesDir() + "/" + ci.image + ".png";
|
||||||
Log.d(TAG,"png = " + png);
|
Log.d(TAG,"png = " + png);
|
||||||
BitmapDrawable bm = new BitmapDrawable(png);
|
BitmapDrawable bm = new BitmapDrawable(png);
|
||||||
|
|
||||||
image.setImageDrawable(bm);
|
image.setImageDrawable(bm);
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,265 +1,265 @@
|
||||||
package com.beloko.touchcontrols;
|
package com.beloko.touchcontrols;
|
||||||
|
|
||||||
|
|
||||||
import in.celest.xash3d.hl.R;
|
import in.celest.xash3d.hl.R;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemSelectedListener;
|
import android.widget.AdapterView.OnItemSelectedListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
|
||||||
public class TouchControlsSettings {
|
public class TouchControlsSettings {
|
||||||
|
|
||||||
static Activity activity;
|
static Activity activity;
|
||||||
static ControlInterface quakeIf;
|
static ControlInterface quakeIf;
|
||||||
|
|
||||||
|
|
||||||
static int alpha,fwdSens,strafeSens,pitchSens,yawSens;
|
static int alpha,fwdSens,strafeSens,pitchSens,yawSens;
|
||||||
|
|
||||||
static boolean mouseMode,showWeaponCycle,showSticks,enableWeaponWheel;
|
static boolean mouseMode,showWeaponCycle,showSticks,enableWeaponWheel;
|
||||||
static boolean invertLook,precisionShoot;
|
static boolean invertLook,precisionShoot;
|
||||||
|
|
||||||
static int doubleTapMove,doubleTapLook;
|
static int doubleTapMove,doubleTapLook;
|
||||||
|
|
||||||
public static void setup(Activity a,ControlInterface qif)
|
public static void setup(Activity a,ControlInterface qif)
|
||||||
{
|
{
|
||||||
activity = a;
|
activity = a;
|
||||||
quakeIf = qif;
|
quakeIf = qif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showSettings()
|
public static void showSettings()
|
||||||
{
|
{
|
||||||
Log.d("settings","showSettings");
|
Log.d("settings","showSettings");
|
||||||
|
|
||||||
activity.runOnUiThread(new Runnable(){
|
activity.runOnUiThread(new Runnable(){
|
||||||
public void run() {
|
public void run() {
|
||||||
final Dialog dialog = new Dialog(activity);
|
final Dialog dialog = new Dialog(activity);
|
||||||
dialog.setContentView(R.layout.touch_controls_settings);
|
dialog.setContentView(R.layout.touch_controls_settings);
|
||||||
dialog.setTitle("Touch Control Sensitivity Settings");
|
dialog.setTitle("Touch Control Sensitivity Settings");
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
|
|
||||||
final SeekBar alphaSeek = (SeekBar)dialog.findViewById(R.id.alpha_seekbar);
|
final SeekBar alphaSeek = (SeekBar)dialog.findViewById(R.id.alpha_seekbar);
|
||||||
final SeekBar fwdSeek = (SeekBar)dialog.findViewById(R.id.fwd_seekbar);
|
final SeekBar fwdSeek = (SeekBar)dialog.findViewById(R.id.fwd_seekbar);
|
||||||
final SeekBar strafeSeek = (SeekBar)dialog.findViewById(R.id.strafe_seekbar);
|
final SeekBar strafeSeek = (SeekBar)dialog.findViewById(R.id.strafe_seekbar);
|
||||||
final SeekBar pitchSeek = (SeekBar)dialog.findViewById(R.id.pitch_seekbar);
|
final SeekBar pitchSeek = (SeekBar)dialog.findViewById(R.id.pitch_seekbar);
|
||||||
final SeekBar yawSeek = (SeekBar)dialog.findViewById(R.id.yaw_seekbar);
|
final SeekBar yawSeek = (SeekBar)dialog.findViewById(R.id.yaw_seekbar);
|
||||||
|
|
||||||
final CheckBox mouseModeCheck = (CheckBox)dialog.findViewById(R.id.mouse_turn_checkbox);
|
final CheckBox mouseModeCheck = (CheckBox)dialog.findViewById(R.id.mouse_turn_checkbox);
|
||||||
final CheckBox showWeaponCycleCheckBox = (CheckBox)dialog.findViewById(R.id.show_next_weapon_checkbox);
|
final CheckBox showWeaponCycleCheckBox = (CheckBox)dialog.findViewById(R.id.show_next_weapon_checkbox);
|
||||||
final CheckBox invertLookCheckBox = (CheckBox)dialog.findViewById(R.id.invert_loop_checkbox);
|
final CheckBox invertLookCheckBox = (CheckBox)dialog.findViewById(R.id.invert_loop_checkbox);
|
||||||
final CheckBox precisionShootCheckBox = (CheckBox)dialog.findViewById(R.id.precision_shoot_checkbox);
|
final CheckBox precisionShootCheckBox = (CheckBox)dialog.findViewById(R.id.precision_shoot_checkbox);
|
||||||
final CheckBox showSticksCheckBox = (CheckBox)dialog.findViewById(R.id.show_sticks_checkbox);
|
final CheckBox showSticksCheckBox = (CheckBox)dialog.findViewById(R.id.show_sticks_checkbox);
|
||||||
final CheckBox enableWeaponWheelCheckBox = (CheckBox)dialog.findViewById(R.id.enable_weapon_wheel_checkbox);
|
final CheckBox enableWeaponWheelCheckBox = (CheckBox)dialog.findViewById(R.id.enable_weapon_wheel_checkbox);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//Hide controls for lookup/down
|
//Hide controls for lookup/down
|
||||||
if (Settings.game == IDGame.Doom)
|
if (Settings.game == IDGame.Doom)
|
||||||
{
|
{
|
||||||
//pitchSeek.setVisibility(View.GONE);
|
//pitchSeek.setVisibility(View.GONE);
|
||||||
invertLookCheckBox.setVisibility(View.GONE);
|
invertLookCheckBox.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
Button add_rem_button = (Button)dialog.findViewById(R.id.add_remove_button);
|
Button add_rem_button = (Button)dialog.findViewById(R.id.add_remove_button);
|
||||||
add_rem_button.setOnClickListener(new OnClickListener() {
|
add_rem_button.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
TouchControlsEditing.show(activity);
|
TouchControlsEditing.show(activity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
alphaSeek.setProgress(alpha);
|
alphaSeek.setProgress(alpha);
|
||||||
fwdSeek.setProgress(fwdSens);
|
fwdSeek.setProgress(fwdSens);
|
||||||
strafeSeek.setProgress(strafeSens);
|
strafeSeek.setProgress(strafeSens);
|
||||||
pitchSeek.setProgress(pitchSens);
|
pitchSeek.setProgress(pitchSens);
|
||||||
yawSeek.setProgress(yawSens);
|
yawSeek.setProgress(yawSens);
|
||||||
|
|
||||||
mouseModeCheck.setChecked(mouseMode);
|
mouseModeCheck.setChecked(mouseMode);
|
||||||
showWeaponCycleCheckBox.setChecked(showWeaponCycle);
|
showWeaponCycleCheckBox.setChecked(showWeaponCycle);
|
||||||
invertLookCheckBox.setChecked(invertLook);
|
invertLookCheckBox.setChecked(invertLook);
|
||||||
precisionShootCheckBox.setChecked(precisionShoot);
|
precisionShootCheckBox.setChecked(precisionShoot);
|
||||||
showSticksCheckBox.setChecked(showSticks);
|
showSticksCheckBox.setChecked(showSticks);
|
||||||
enableWeaponWheelCheckBox.setChecked(enableWeaponWheel);
|
enableWeaponWheelCheckBox.setChecked(enableWeaponWheel);
|
||||||
|
|
||||||
Spinner move_spinner = (Spinner) dialog.findViewById(R.id.move_dbl_tap_spinner);
|
Spinner move_spinner = (Spinner) dialog.findViewById(R.id.move_dbl_tap_spinner);
|
||||||
ArrayAdapter<CharSequence> adapterm;
|
ArrayAdapter<CharSequence> adapterm;
|
||||||
|
|
||||||
adapterm = ArrayAdapter.createFromResource(activity,
|
adapterm = ArrayAdapter.createFromResource(activity,
|
||||||
R.array.double_tap_actions, android.R.layout.simple_spinner_item);
|
R.array.double_tap_actions, android.R.layout.simple_spinner_item);
|
||||||
|
|
||||||
adapterm.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapterm.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
move_spinner.setAdapter(adapterm);
|
move_spinner.setAdapter(adapterm);
|
||||||
move_spinner.setSelection(doubleTapMove);
|
move_spinner.setSelection(doubleTapMove);
|
||||||
|
|
||||||
move_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
|
move_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view,
|
public void onItemSelected(AdapterView<?> parent, View view,
|
||||||
int pos, long id) {
|
int pos, long id) {
|
||||||
doubleTapMove = pos;
|
doubleTapMove = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> arg0) {
|
public void onNothingSelected(AdapterView<?> arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Spinner look_spinner = (Spinner) dialog.findViewById(R.id.look_dbl_tap_spinner);
|
Spinner look_spinner = (Spinner) dialog.findViewById(R.id.look_dbl_tap_spinner);
|
||||||
ArrayAdapter<CharSequence> adapterl = ArrayAdapter.createFromResource(activity,
|
ArrayAdapter<CharSequence> adapterl = ArrayAdapter.createFromResource(activity,
|
||||||
R.array.double_tap_actions, android.R.layout.simple_spinner_item);
|
R.array.double_tap_actions, android.R.layout.simple_spinner_item);
|
||||||
adapterl.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapterl.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
look_spinner.setAdapter(adapterl);
|
look_spinner.setAdapter(adapterl);
|
||||||
|
|
||||||
look_spinner.setSelection(doubleTapLook);
|
look_spinner.setSelection(doubleTapLook);
|
||||||
|
|
||||||
look_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
|
look_spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view,
|
public void onItemSelected(AdapterView<?> parent, View view,
|
||||||
int pos, long id) {
|
int pos, long id) {
|
||||||
doubleTapLook = pos;
|
doubleTapLook = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> arg0) {
|
public void onNothingSelected(AdapterView<?> arg0) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.setOnDismissListener(new OnDismissListener() {
|
dialog.setOnDismissListener(new OnDismissListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(DialogInterface dialog) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
alpha = alphaSeek.getProgress();
|
alpha = alphaSeek.getProgress();
|
||||||
fwdSens = fwdSeek.getProgress();
|
fwdSens = fwdSeek.getProgress();
|
||||||
strafeSens = strafeSeek.getProgress();
|
strafeSens = strafeSeek.getProgress();
|
||||||
pitchSens = pitchSeek.getProgress();
|
pitchSens = pitchSeek.getProgress();
|
||||||
yawSens = yawSeek.getProgress();
|
yawSens = yawSeek.getProgress();
|
||||||
|
|
||||||
mouseMode = mouseModeCheck.isChecked();
|
mouseMode = mouseModeCheck.isChecked();
|
||||||
showWeaponCycle = showWeaponCycleCheckBox.isChecked();
|
showWeaponCycle = showWeaponCycleCheckBox.isChecked();
|
||||||
invertLook = invertLookCheckBox.isChecked();
|
invertLook = invertLookCheckBox.isChecked();
|
||||||
precisionShoot = precisionShootCheckBox.isChecked();
|
precisionShoot = precisionShootCheckBox.isChecked();
|
||||||
showSticks = showSticksCheckBox.isChecked();
|
showSticks = showSticksCheckBox.isChecked();
|
||||||
enableWeaponWheel = enableWeaponWheelCheckBox.isChecked();
|
enableWeaponWheel = enableWeaponWheelCheckBox.isChecked();
|
||||||
|
|
||||||
saveSettings(activity);
|
saveSettings(activity);
|
||||||
sendToQuake();
|
sendToQuake();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button save = (Button)dialog.findViewById(R.id.save_button);
|
Button save = (Button)dialog.findViewById(R.id.save_button);
|
||||||
save.setOnClickListener(new OnClickListener() {
|
save.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
alpha = alphaSeek.getProgress();
|
alpha = alphaSeek.getProgress();
|
||||||
fwdSens = fwdSeek.getProgress();
|
fwdSens = fwdSeek.getProgress();
|
||||||
strafeSens = strafeSeek.getProgress();
|
strafeSens = strafeSeek.getProgress();
|
||||||
pitchSens = pitchSeek.getProgress();
|
pitchSens = pitchSeek.getProgress();
|
||||||
yawSens = yawSeek.getProgress();
|
yawSens = yawSeek.getProgress();
|
||||||
|
|
||||||
mouseMode = mouseModeCheck.isChecked();
|
mouseMode = mouseModeCheck.isChecked();
|
||||||
showWeaponCycle = showWeaponCycleCheckBox.isChecked();
|
showWeaponCycle = showWeaponCycleCheckBox.isChecked();
|
||||||
invertLook = invertLookCheckBox.isChecked();
|
invertLook = invertLookCheckBox.isChecked();
|
||||||
precisionShoot = precisionShootCheckBox.isChecked();
|
precisionShoot = precisionShootCheckBox.isChecked();
|
||||||
showSticks = showSticksCheckBox.isChecked();
|
showSticks = showSticksCheckBox.isChecked();
|
||||||
enableWeaponWheel = enableWeaponWheelCheckBox.isChecked();
|
enableWeaponWheel = enableWeaponWheelCheckBox.isChecked();
|
||||||
|
|
||||||
saveSettings(activity);
|
saveSettings(activity);
|
||||||
sendToQuake();
|
sendToQuake();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button cancel = (Button)dialog.findViewById(R.id.cancel_button);
|
Button cancel = (Button)dialog.findViewById(R.id.cancel_button);
|
||||||
cancel.setOnClickListener(new OnClickListener() {
|
cancel.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void sendToQuake()
|
public static void sendToQuake()
|
||||||
{
|
{
|
||||||
|
|
||||||
int other = 0;
|
int other = 0;
|
||||||
other += showWeaponCycle?0x1:0;
|
other += showWeaponCycle?0x1:0;
|
||||||
other += mouseMode?0x2:0;
|
other += mouseMode?0x2:0;
|
||||||
other += invertLook?0x4:0;
|
other += invertLook?0x4:0;
|
||||||
other += precisionShoot?0x8:0;
|
other += precisionShoot?0x8:0;
|
||||||
|
|
||||||
other += (doubleTapMove << 4) & 0xF0;
|
other += (doubleTapMove << 4) & 0xF0;
|
||||||
other += (doubleTapLook << 8) & 0xF00;
|
other += (doubleTapLook << 8) & 0xF00;
|
||||||
|
|
||||||
other += showSticks?0x1000:0;
|
other += showSticks?0x1000:0;
|
||||||
other += enableWeaponWheel?0x2000:0;
|
other += enableWeaponWheel?0x2000:0;
|
||||||
|
|
||||||
other += Settings.hideTouchControls?0x80000000:0;
|
other += Settings.hideTouchControls?0x80000000:0;
|
||||||
|
|
||||||
quakeIf.setTouchSettings_if(
|
quakeIf.setTouchSettings_if(
|
||||||
(float)alpha/(float)100,
|
(float)alpha/(float)100,
|
||||||
(strafeSens)/(float)50,
|
(strafeSens)/(float)50,
|
||||||
(fwdSens)/(float)50,
|
(fwdSens)/(float)50,
|
||||||
(pitchSens)/(float)50,
|
(pitchSens)/(float)50,
|
||||||
(yawSens)/(float)50,
|
(yawSens)/(float)50,
|
||||||
other);
|
other);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadSettings(Context ctx)
|
public static void loadSettings(Context ctx)
|
||||||
{
|
{
|
||||||
alpha = Settings.getIntOption(ctx, "alpha", 50);
|
alpha = Settings.getIntOption(ctx, "alpha", 50);
|
||||||
fwdSens = Settings.getIntOption(ctx, "fwdSens", 50);
|
fwdSens = Settings.getIntOption(ctx, "fwdSens", 50);
|
||||||
strafeSens = Settings.getIntOption(ctx, "strafeSens", 50);
|
strafeSens = Settings.getIntOption(ctx, "strafeSens", 50);
|
||||||
pitchSens = Settings.getIntOption(ctx, "pitchSens", 50);
|
pitchSens = Settings.getIntOption(ctx, "pitchSens", 50);
|
||||||
yawSens = Settings.getIntOption(ctx, "yawSens", 50);
|
yawSens = Settings.getIntOption(ctx, "yawSens", 50);
|
||||||
|
|
||||||
showWeaponCycle = Settings.getBoolOption(ctx, "show_weapon_cycle", true);
|
showWeaponCycle = Settings.getBoolOption(ctx, "show_weapon_cycle", true);
|
||||||
mouseMode = Settings.getBoolOption(ctx, "mouse_mode", true);
|
mouseMode = Settings.getBoolOption(ctx, "mouse_mode", true);
|
||||||
invertLook = Settings.getBoolOption(ctx, "invert_look", false);
|
invertLook = Settings.getBoolOption(ctx, "invert_look", false);
|
||||||
precisionShoot = Settings.getBoolOption(ctx, "precision_shoot", false);
|
precisionShoot = Settings.getBoolOption(ctx, "precision_shoot", false);
|
||||||
showSticks = Settings.getBoolOption(ctx, "show_sticks", false);
|
showSticks = Settings.getBoolOption(ctx, "show_sticks", false);
|
||||||
enableWeaponWheel = Settings.getBoolOption(ctx, "enable_ww", true);
|
enableWeaponWheel = Settings.getBoolOption(ctx, "enable_ww", true);
|
||||||
|
|
||||||
doubleTapMove = Settings.getIntOption(ctx, "double_tap_move", 0);
|
doubleTapMove = Settings.getIntOption(ctx, "double_tap_move", 0);
|
||||||
doubleTapLook = Settings.getIntOption(ctx, "double_tap_look", 0);
|
doubleTapLook = Settings.getIntOption(ctx, "double_tap_look", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveSettings(Context ctx)
|
public static void saveSettings(Context ctx)
|
||||||
{
|
{
|
||||||
Settings.setIntOption(ctx, "alpha", alpha);
|
Settings.setIntOption(ctx, "alpha", alpha);
|
||||||
Settings.setIntOption(ctx, "fwdSens", fwdSens);
|
Settings.setIntOption(ctx, "fwdSens", fwdSens);
|
||||||
Settings.setIntOption(ctx, "strafeSens", strafeSens);
|
Settings.setIntOption(ctx, "strafeSens", strafeSens);
|
||||||
Settings.setIntOption(ctx, "pitchSens", pitchSens);
|
Settings.setIntOption(ctx, "pitchSens", pitchSens);
|
||||||
Settings.setIntOption(ctx, "yawSens", yawSens);
|
Settings.setIntOption(ctx, "yawSens", yawSens);
|
||||||
|
|
||||||
Settings.setBoolOption(ctx, "show_weapon_cycle", showWeaponCycle);
|
Settings.setBoolOption(ctx, "show_weapon_cycle", showWeaponCycle);
|
||||||
Settings.setBoolOption(ctx, "invert_look", invertLook);
|
Settings.setBoolOption(ctx, "invert_look", invertLook);
|
||||||
Settings.setBoolOption(ctx, "precision_shoot", precisionShoot);
|
Settings.setBoolOption(ctx, "precision_shoot", precisionShoot);
|
||||||
Settings.setBoolOption(ctx, "show_sticks", showSticks);
|
Settings.setBoolOption(ctx, "show_sticks", showSticks);
|
||||||
Settings.setBoolOption(ctx, "enable_ww", enableWeaponWheel);
|
Settings.setBoolOption(ctx, "enable_ww", enableWeaponWheel);
|
||||||
|
|
||||||
Settings.setIntOption(ctx, "double_tap_move", doubleTapMove);
|
Settings.setIntOption(ctx, "double_tap_move", doubleTapMove);
|
||||||
Settings.setIntOption(ctx, "double_tap_look", doubleTapLook);
|
Settings.setIntOption(ctx, "double_tap_look", doubleTapLook);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue