summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3134883)
raw | patch | inline | side by side (parent: 3134883)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Thu, 16 Dec 2021 15:47:19 +0000 (18:47 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Thu, 16 Dec 2021 15:47:19 +0000 (18:47 +0300) |
android/AndroidManifest.xml | patch | blob | history | |
android/src/org/d2df/app/Doom2DF.java | patch | blob | history | |
android/src/org/d2df/app/Launcher.java | [new file with mode: 0644] | patch | blob |
index b69d31fa77393f9a9404703138931ef544723e1b..a9524347cc7a46854633437d2a5fafa04f328d56 100644 (file)
android:versionName="0.667-git"
android:installLocation="auto">
- <!-- Android 4.1 -->
- <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
+ <!-- min Android 4.1, target Android 4.4 -->
+ <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19" />
<!-- OpenGL ES 2.0 -->
<!-- <uses-feature android:glEsVersion="0x00020000" /> -->
+
<!-- OpenGL ES 1.1 -->
<uses-feature android:glEsVersion="0x00010001" />
+ <!-- Game controller support -->
+ <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
+ <uses-feature android:name="android.hardware.gamepad" android:required="false" />
+ <uses-feature android:name="android.hardware.usb.host" android:required="false" />
+
+ <!-- External mouse input events -->
+ <uses-feature android:name="android.hardware.type.pc" android:required="false" />
+
<!-- Allow writing to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
<!-- Allow access to the vibrator -->
<uses-permission android:name="android.permission.VIBRATE" />
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true"
android:debuggable="true" >
- <activity android:name="Doom2DF"
- android:label="Doom2D Forever"
- android:screenOrientation="sensorLandscape"
- android:configChanges="keyboardHidden|orientation|screenSize"
- >
+
+ <meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0"/>
+
+ <activity android:name="Launcher" android:label="Doom2D Forever" android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
- <!-- Drop file event -->
- <!--
- <intent-filter>
- <action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:mimeType="*/*" />
- </intent-filter>
- -->
</activity>
+
+ <activity android:name="Doom2DF"
+ android:label="Doom2DF Forever"
+ android:alwaysRetainTaskState="true"
+ android:launchMode="singleInstance"
+ android:screenOrientation="sensorLandscape"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+ >
+ </activity>
+
</application>
</manifest>
index 4f7b00d82d370c77394ae50cb8b541a7285dbdf5..47220cbd80278d638d80b7320584d5ea71fa83dc 100644 (file)
package org.d2df.app;
+import android.content.Intent;
import android.app.Activity;
import android.os.Bundle;
public class Doom2DF extends SDLActivity {
- @Override
- protected String[] getLibraries() {
- return new String[] {
- "crystax",
- "SDL2",
- "mpg123",
- "SDL2_mixer",
- "enet",
- "miniupnpc",
- "Doom2DF"
- };
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- CopyAssets.copyAssets(SDL.getContext(), "");
- CopyAssets.copyAssets(SDL.getContext(), "data");
- CopyAssets.copyAssets(SDL.getContext(), "data/models");
- CopyAssets.copyAssets(SDL.getContext(), "maps");
- CopyAssets.copyAssets(SDL.getContext(), "maps/megawads");
- CopyAssets.copyAssets(SDL.getContext(), "wads");
- CopyAssets.copyAssets(SDL.getContext(), "instruments");
- CopyAssets.copyAssets(SDL.getContext(), "timidity.cfg");
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
-
- /* This will fix bug #31 and may be #32 */
- System.exit(0);
- }
+ @Override
+ protected String[] getLibraries () {
+ return new String[] {
+ "crystax",
+ "SDL2",
+ "mpg123",
+ "SDL2_mixer",
+ "enet",
+ "miniupnpc",
+ "Doom2DF"
+ };
+ }
+
+ @Override
+ protected String[] getArguments () {
+ Intent intent = getIntent();
+ String value = intent.getStringExtra(Launcher.prefArgs);
+ String[] args = value.split("\\s+");
+ return args;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ CopyAssets.copyAssets(SDL.getContext(), "");
+ CopyAssets.copyAssets(SDL.getContext(), "data");
+ CopyAssets.copyAssets(SDL.getContext(), "data/models");
+ CopyAssets.copyAssets(SDL.getContext(), "maps");
+ CopyAssets.copyAssets(SDL.getContext(), "maps/megawads");
+ CopyAssets.copyAssets(SDL.getContext(), "wads");
+ CopyAssets.copyAssets(SDL.getContext(), "instruments");
+ CopyAssets.copyAssets(SDL.getContext(), "timidity.cfg");
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+
+ /* This will fix bug #31 and may be #32 */
+ System.exit(0);
+ }
}
diff --git a/android/src/org/d2df/app/Launcher.java b/android/src/org/d2df/app/Launcher.java
--- /dev/null
@@ -0,0 +1,108 @@
+package org.d2df.app;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+
+import android.content.*;
+
+import android.view.*;
+import android.widget.*;
+import android.text.*;
+
+import java.io.*;
+import java.util.*;
+import java.lang.*;
+
+public class Launcher extends Activity {
+
+ static final String preferences = "org.d2df.app.PREF";
+ static final String prefArgs = "CommandLine";
+
+ private EditText cmdline;
+
+ private void saveCommandLine () {
+ String s = cmdline.getText().toString();
+ SharedPreferences sh = getSharedPreferences(preferences, MODE_PRIVATE);
+ SharedPreferences.Editor ed = sh.edit();
+ ed.putString(prefArgs, s);
+ ed.apply();
+ }
+
+ private String loadCommandLine () {
+ SharedPreferences sh = getSharedPreferences(preferences, MODE_PRIVATE);
+ return sh.getString(prefArgs, "");
+ }
+
+ private class CmdLineWatcher implements TextWatcher {
+
+ @Override
+ public void beforeTextChanged (CharSequence s, int start, int count,int after) {
+ }
+
+ @Override
+ public void onTextChanged (CharSequence s, int start, int before, int count) {
+ }
+
+ @Override
+ public void afterTextChanged (Editable s) {
+ saveCommandLine();
+ }
+ }
+
+ private View.OnClickListener StartVavoomEvent = new View.OnClickListener () {
+
+ public void onClick (View view) {
+ Intent intent = new Intent(Launcher.this, Doom2DF.class);
+ String s = Launcher.this.cmdline.getText().toString();
+ intent.putExtra(prefArgs, s);
+ Launcher.this.startActivity(intent);
+ }
+ };
+
+ private void addImage (ViewGroup g, int id) {
+ ImageView v = new ImageView(this);
+ v.setImageResource(id);
+ g.addView(v);
+ }
+
+ private void addText (ViewGroup g, String s) {
+ TextView v = new TextView(this);
+ v.setText(s);
+ // v.setTextSize(16);
+ g.addView(v);
+ }
+
+ private EditText addTextField (ViewGroup g, String s, TextWatcher w) {
+ EditText v = new EditText(this);
+ v.setText(s);
+ v.addTextChangedListener(w);
+ g.addView(v);
+ return v;
+ }
+
+ private void addButton (ViewGroup g, String s, View.OnClickListener c) {
+ Button v = new Button(this);
+ v.setText(s);
+ v.setOnClickListener(c);
+ g.addView(v);
+ }
+
+ private void rebuild () {
+ LinearLayout layout = new LinearLayout(this);
+ layout.setOrientation(LinearLayout.VERTICAL);
+// addImage(layout, R.drawable.doom2df_logo);
+ addText(layout, "Command line:");
+ cmdline = addTextField(layout, loadCommandLine(), new CmdLineWatcher());
+ addButton(layout, "Start", StartVavoomEvent);
+ setContentView(layout);
+ }
+
+ @Override
+ public void onCreate (Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ rebuild();
+ }
+
+}