Skip to content
Snippets Groups Projects
Commit 70be45c9 authored by Charles Lombardo's avatar Charles Lombardo
Browse files

android: InputHandler: Convert to object

This doesn't need to be an instance of a class because it doesn't hold any data. It's just all helper functions.
parent 9b3c64f4
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { ...@@ -58,7 +58,6 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
var isActivityRecreated = false var isActivityRecreated = false
private lateinit var nfcReader: NfcReader private lateinit var nfcReader: NfcReader
private lateinit var inputHandler: InputHandler
private val gyro = FloatArray(3) private val gyro = FloatArray(3)
private val accel = FloatArray(3) private val accel = FloatArray(3)
...@@ -100,8 +99,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { ...@@ -100,8 +99,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
nfcReader = NfcReader(this) nfcReader = NfcReader(this)
nfcReader.initialize() nfcReader.initialize()
inputHandler = InputHandler() InputHandler.initialize()
inputHandler.initialize()
val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
if (!preferences.getBoolean(Settings.PREF_MEMORY_WARNING_SHOWN, false)) { if (!preferences.getBoolean(Settings.PREF_MEMORY_WARNING_SHOWN, false)) {
...@@ -190,7 +188,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { ...@@ -190,7 +188,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
return super.dispatchKeyEvent(event) return super.dispatchKeyEvent(event)
} }
return inputHandler.dispatchKeyEvent(event) return InputHandler.dispatchKeyEvent(event)
} }
override fun dispatchGenericMotionEvent(event: MotionEvent): Boolean { override fun dispatchGenericMotionEvent(event: MotionEvent): Boolean {
...@@ -205,7 +203,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener { ...@@ -205,7 +203,7 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
return true return true
} }
return inputHandler.dispatchGenericMotionEvent(event) return InputHandler.dispatchGenericMotionEvent(event)
} }
override fun onSensorChanged(event: SensorEvent) { override fun onSensorChanged(event: SensorEvent) {
......
...@@ -8,7 +8,7 @@ import android.view.MotionEvent ...@@ -8,7 +8,7 @@ import android.view.MotionEvent
import kotlin.math.sqrt import kotlin.math.sqrt
import org.yuzu.yuzu_emu.NativeLibrary import org.yuzu.yuzu_emu.NativeLibrary
class InputHandler { object InputHandler {
fun initialize() { fun initialize() {
// Connect first controller // Connect first controller
NativeLibrary.onGamePadConnectEvent(getPlayerNumber(NativeLibrary.Player1Device)) NativeLibrary.onGamePadConnectEvent(getPlayerNumber(NativeLibrary.Player1Device))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment