mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-22 22:58:12 +03:00
Android: Remove 3-finger-touch menu
This commit is contained in:
@@ -67,7 +67,6 @@ Note: This ZIP format is also compatible with
|
||||
### Miscellaneous
|
||||
- You can export or import save files via the game list's option menu.
|
||||
- To uninstall a game, long-tap its title in the game list.
|
||||
- A system menu will appear when you use a three-finger touch during gameplay.
|
||||
|
||||
## Known Issues
|
||||
- Installing from a ZIP file containing multiple games (e.g., the DPS series)
|
||||
|
||||
@@ -20,10 +20,6 @@ package io.github.kichikuou.system3
|
||||
import android.app.AlertDialog
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
import android.view.ContextMenu
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import org.libsdl.app.SDLActivity
|
||||
import java.io.File
|
||||
@@ -42,7 +38,6 @@ class GameActivity : SDLActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
gameRoot = File(intent.getStringExtra(EXTRA_GAME_ROOT)!!)
|
||||
registerForContextMenu(mLayout)
|
||||
}
|
||||
|
||||
override fun getLibraries(): Array<String> {
|
||||
@@ -86,34 +81,6 @@ class GameActivity : SDLActivity() {
|
||||
.show()
|
||||
}
|
||||
|
||||
private var menuShown = false
|
||||
private fun openMenu() {
|
||||
if (menuShown)
|
||||
return
|
||||
openContextMenu(mLayout)
|
||||
menuShown = true
|
||||
}
|
||||
|
||||
override fun onCreateContextMenu(menu: ContextMenu, v: View?, menuInfo: ContextMenu.ContextMenuInfo?) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo)
|
||||
menuInflater.inflate(R.menu.game_menu, menu)
|
||||
}
|
||||
|
||||
override fun onContextItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.quit_game -> {
|
||||
finish()
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onContextMenuClosed(menu: Menu) {
|
||||
super.onContextMenuClosed(menu)
|
||||
menuShown = false
|
||||
}
|
||||
|
||||
// The functions below are called in the SDL thread by JNI.
|
||||
@Suppress("unused") fun inputString(oldVal: String, maxLen: Int): String? {
|
||||
val result = arrayOfNulls<String?>(1)
|
||||
@@ -128,8 +95,4 @@ class GameActivity : SDLActivity() {
|
||||
}
|
||||
return result[0]
|
||||
}
|
||||
|
||||
@Suppress("unused") fun popupMenu() {
|
||||
runOnUiThread { openMenu() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/quit_game"
|
||||
android:title="@string/action_quit_game" />
|
||||
</menu>
|
||||
@@ -4,7 +4,6 @@
|
||||
<string name="action_export_save_data">セーブデータをエクスポート</string>
|
||||
<string name="action_import_save_data">セーブデータをインポート</string>
|
||||
<string name="action_licenses">オープンソースライセンス</string>
|
||||
<string name="action_quit_game">ゲーム終了</string>
|
||||
<string name="cancel">キャンセル</string>
|
||||
<string name="cannot_find_adisk">System3 のファイル (*.dat) が見つかりません。</string>
|
||||
<string name="choose_a_file">ファイルを選択</string>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<string name="action_export_save_data">Export Save Files</string>
|
||||
<string name="action_import_save_data">Import Save Files</string>
|
||||
<string name="action_licenses">Open source licenses</string>
|
||||
<string name="action_quit_game">Quit Game</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="cannot_find_adisk">Cannot find System3 game files (*.dat).</string>
|
||||
<string name="choose_a_file">Choose a file</string>
|
||||
|
||||
@@ -51,13 +51,5 @@ void NACT::set_skip_menu_state(bool enabled, bool checked)
|
||||
|
||||
bool NACT::handle_platform_event(const SDL_Event& e)
|
||||
{
|
||||
if (e.type == SDL_FINGERDOWN && SDL_GetNumTouchFingers(e.tfinger.touchId) == 3) {
|
||||
JNILocalFrame jni(16);
|
||||
if (jni.env()) {
|
||||
jmethodID mid = jni.GetMethodID("popupMenu", "()V");
|
||||
jni.env()->CallVoidMethod(jni.context(), mid);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user