-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
144 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
; edit this file to change m8c defaults | ||
; this file is re-written every time it is read, | ||
; so do not expect comments or commented out values to survive! | ||
; valid parameter changes will be written back and persisted though. | ||
|
||
[graphics] | ||
; set this to true to have m8c start fullscreen | ||
fullscreen=true | ||
; set this to false to run m8c in software rendering mode (may be useful for Raspberry Pi) | ||
use_gpu=true | ||
; the delay amount in ms in the main loop, decrease value for faster operation, increase value if too much cpu usage | ||
idle_ms = 10 | ||
; show a spinning cube if device is not inserted | ||
wait_for_device = true | ||
; number of zero-byte attempts to disconnect if wait_for_device = false (128 = about 2 sec for default idle_ms) | ||
wait_packets = 128 | ||
|
||
[keyboard] | ||
; these need to be the decimal value of the SDL scancodes. | ||
; a table exists here: https://github.com/libsdl-org/sdlwiki/blob/main/SDLScancodeLookup.mediawiki | ||
key_up=82 | ||
key_left=80 | ||
key_down=81 | ||
key_right=79 | ||
key_select=225 | ||
key_select_alt=4 | ||
key_start=44 | ||
key_start_alt=22 | ||
key_opt=226 | ||
key_opt_alt=29 | ||
key_edit=224 | ||
key_edit_alt=27 | ||
key_delete=76 | ||
key_reset=21 | ||
|
||
[gamepad] | ||
; these need to be the decimal value of the SDL Controller buttons. | ||
; a table exists here: https://wiki.libsdl.org/SDL_GameControllerButton | ||
gamepad_up=11 | ||
gamepad_left=13 | ||
gamepad_down=12 | ||
gamepad_right=14 | ||
gamepad_select=4 | ||
gamepad_start=6 | ||
gamepad_opt=1 | ||
gamepad_edit=0 | ||
gamepad_quit=8 | ||
gamepad_reset=7 | ||
|
||
gamepad_analog_threshold=32766 ;the threshold for analog sticks to trigger cursor movement (working values: 1-32766) | ||
gamepad_analog_invert=false ;NOT IMPLEMENTED YET: invert up/down and left/right axis (true/false) | ||
|
||
; these need to be the decimal value of the controller axis | ||
; you can use -1 if you do not wish to map the function to an analog axis | ||
gamepad_analog_axis_updown=1 | ||
gamepad_analog_axis_leftright=0 | ||
gamepad_analog_axis_start=5 | ||
gamepad_analog_axis_select=4 | ||
gamepad_analog_axis_opt=-1 | ||
gamepad_analog_axis_edit=-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.maido.m8client; | ||
|
||
import android.util.Log; | ||
import android.view.MotionEvent; | ||
import android.view.View; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
|
||
class M8TouchListener implements View.OnTouchListener { | ||
|
||
private static final String TAG = M8TouchListener.class.getSimpleName(); | ||
|
||
private static final Set<M8Keys> modifiers = new HashSet<>(); | ||
|
||
private final M8Keys key; | ||
|
||
public M8TouchListener(M8Keys key) { | ||
this.key = key; | ||
} | ||
|
||
@Override | ||
public boolean onTouch(View view, MotionEvent motionEvent) { | ||
int action = motionEvent.getActionMasked(); | ||
switch (action) { | ||
case MotionEvent.ACTION_DOWN: | ||
modifiers.add(key); | ||
char code = key.getCode(modifiers); | ||
Log.d(TAG, "Sending " + key + " as " + code); | ||
sendClickEvent(code); | ||
break; | ||
case MotionEvent.ACTION_UP: | ||
modifiers.remove(key); | ||
Log.d(TAG, "Key up " + key); | ||
sendClickEvent((char) 0); | ||
view.performClick(); | ||
break; | ||
} | ||
return true; | ||
} | ||
|
||
native public void sendClickEvent(char event); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/connect_your_m8_device" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters