mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 14:45:41 +12:00
Android bonk
This commit is contained in:
parent
e6880b1564
commit
63a09dd51f
10 changed files with 1 additions and 23 deletions
|
@ -63,11 +63,8 @@ AlberFunction(void, LoadRom)(JNIEnv* env, jobject obj, jstring path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AlberFunction(void, TouchScreenDown)(JNIEnv* env, jobject obj, jint x, jint y) { hidService->setTouchScreenPress((u16)x, (u16)y); }
|
AlberFunction(void, TouchScreenDown)(JNIEnv* env, jobject obj, jint x, jint y) { hidService->setTouchScreenPress((u16)x, (u16)y); }
|
||||||
|
|
||||||
AlberFunction(void, TouchScreenUp)(JNIEnv* env, jobject obj) { hidService->releaseTouchScreen(); }
|
AlberFunction(void, TouchScreenUp)(JNIEnv* env, jobject obj) { hidService->releaseTouchScreen(); }
|
||||||
|
|
||||||
AlberFunction(void, KeyUp)(JNIEnv* env, jobject obj, jint keyCode) { hidService->releaseKey((u32)keyCode); }
|
AlberFunction(void, KeyUp)(JNIEnv* env, jobject obj, jint keyCode) { hidService->releaseKey((u32)keyCode); }
|
||||||
|
|
||||||
AlberFunction(void, KeyDown)(JNIEnv* env, jobject obj, jint keyCode) { hidService->pressKey((u32)keyCode); }
|
AlberFunction(void, KeyDown)(JNIEnv* env, jobject obj, jint keyCode) { hidService->pressKey((u32)keyCode); }
|
||||||
|
|
||||||
AlberFunction(void, SetCirclepadAxis)(JNIEnv* env, jobject obj, jint x, jint y) {
|
AlberFunction(void, SetCirclepadAxis)(JNIEnv* env, jobject obj, jint x, jint y) {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import com.panda3ds.pandroid.view.PandaGlSurfaceView;
|
||||||
import com.panda3ds.pandroid.view.PandaLayoutController;
|
import com.panda3ds.pandroid.view.PandaLayoutController;
|
||||||
|
|
||||||
public class GameActivity extends BaseActivity {
|
public class GameActivity extends BaseActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -31,14 +30,12 @@ public class GameActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
PandaGlSurfaceView pandaSurface = new PandaGlSurfaceView(this, intent.getStringExtra(Constants.ACTIVITY_PARAMETER_PATH));
|
PandaGlSurfaceView pandaSurface = new PandaGlSurfaceView(this, intent.getStringExtra(Constants.ACTIVITY_PARAMETER_PATH));
|
||||||
|
|
||||||
setContentView(R.layout.game_activity);
|
setContentView(R.layout.game_activity);
|
||||||
|
|
||||||
((FrameLayout) findViewById(R.id.panda_gl_frame))
|
((FrameLayout) findViewById(R.id.panda_gl_frame))
|
||||||
.addView(pandaSurface, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
.addView(pandaSurface, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
|
||||||
PandaLayoutController controllerLayout = findViewById(R.id.controller_layout);
|
PandaLayoutController controllerLayout = findViewById(R.id.controller_layout);
|
||||||
|
|
||||||
controllerLayout.initialize();
|
controllerLayout.initialize();
|
||||||
|
|
||||||
((CheckBox) findViewById(R.id.hide_screen_controller)).setOnCheckedChangeListener((buttonView, isChecked) -> findViewById(R.id.overlay_controller).setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE));
|
((CheckBox) findViewById(R.id.hide_screen_controller)).setOnCheckedChangeListener((buttonView, isChecked) -> findViewById(R.id.overlay_controller).setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE));
|
||||||
|
|
|
@ -40,7 +40,6 @@ public class MainActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
findViewById(R.id.load_rom).setOnClickListener(v -> { openFile(); });
|
findViewById(R.id.load_rom).setOnClickListener(v -> { openFile(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,10 +83,7 @@ public class PathUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); }
|
public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); }
|
||||||
|
|
||||||
public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); }
|
public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); }
|
||||||
|
|
||||||
public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); }
|
public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); }
|
||||||
|
|
||||||
public static boolean isGooglePhotosUri(Uri uri) { return "com.google.android.apps.photos.content".equals(uri.getAuthority()); }
|
public static boolean isGooglePhotosUri(Uri uri) { return "com.google.android.apps.photos.content".equals(uri.getAuthority()); }
|
||||||
}
|
}
|
|
@ -11,9 +11,7 @@ import com.panda3ds.pandroid.view.controller.nodes.Joystick;
|
||||||
|
|
||||||
public class PandaLayoutController extends ControllerLayout {
|
public class PandaLayoutController extends ControllerLayout {
|
||||||
public PandaLayoutController(Context context) { super(context); }
|
public PandaLayoutController(Context context) { super(context); }
|
||||||
|
|
||||||
public PandaLayoutController(Context context, AttributeSet attrs) { super(context, attrs); }
|
public PandaLayoutController(Context context, AttributeSet attrs) { super(context, attrs); }
|
||||||
|
|
||||||
public PandaLayoutController(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
|
public PandaLayoutController(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
|
||||||
|
|
||||||
public PandaLayoutController(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public PandaLayoutController(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
|
|
@ -19,9 +19,7 @@ public class ControllerLayout extends RelativeLayout {
|
||||||
private final ArrayList<ControllerNode> controllerNodes = new ArrayList<>();
|
private final ArrayList<ControllerNode> controllerNodes = new ArrayList<>();
|
||||||
|
|
||||||
public ControllerLayout(Context context) { this(context, null); }
|
public ControllerLayout(Context context) { this(context, null); }
|
||||||
|
|
||||||
public ControllerLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); }
|
public ControllerLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); }
|
||||||
|
|
||||||
public ControllerLayout(Context context, AttributeSet attrs, int defStyleAttr) { this(context, attrs, defStyleAttr, 0); }
|
public ControllerLayout(Context context, AttributeSet attrs, int defStyleAttr) { this(context, attrs, defStyleAttr, 0); }
|
||||||
|
|
||||||
public ControllerLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public ControllerLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
@ -131,7 +129,7 @@ public class ControllerLayout extends RelativeLayout {
|
||||||
refreshChildren();
|
refreshChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@TODO: Need replace that methods for prevent Android send events directly to children*/
|
// TODO: Need to replace these methods to prevent Android sending events directly to children
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<View> getTouchables() {
|
public ArrayList<View> getTouchables() {
|
||||||
|
|
|
@ -17,6 +17,5 @@ public interface ControllerNode {
|
||||||
default boolean isVisible() { return ((View) this).isShown(); }
|
default boolean isVisible() { return ((View) this).isShown(); }
|
||||||
|
|
||||||
@NonNull Vector2 getSize();
|
@NonNull Vector2 getSize();
|
||||||
|
|
||||||
void onTouch(TouchEvent event);
|
void onTouch(TouchEvent event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,7 @@ public class TouchEvent {
|
||||||
private final float x, y;
|
private final float x, y;
|
||||||
|
|
||||||
public float getX() { return x; }
|
public float getX() { return x; }
|
||||||
|
|
||||||
public float getY() { return y; }
|
public float getY() { return y; }
|
||||||
|
|
||||||
public TouchType getAction() { return action; }
|
public TouchType getAction() { return action; }
|
||||||
|
|
||||||
public TouchEvent(float x, float y, TouchType action) {
|
public TouchEvent(float x, float y, TouchType action) {
|
||||||
|
|
|
@ -9,8 +9,6 @@ import com.panda3ds.pandroid.view.controller.ControllerNode;
|
||||||
|
|
||||||
public abstract class BasicControllerNode extends AppCompatTextView implements ControllerNode {
|
public abstract class BasicControllerNode extends AppCompatTextView implements ControllerNode {
|
||||||
public BasicControllerNode(@NonNull Context context) { super(context); }
|
public BasicControllerNode(@NonNull Context context) { super(context); }
|
||||||
|
|
||||||
public BasicControllerNode(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); }
|
public BasicControllerNode(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); }
|
||||||
|
|
||||||
public BasicControllerNode(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
|
public BasicControllerNode(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,9 @@ public class Joystick extends BasicControllerNode implements ControllerNode {
|
||||||
|
|
||||||
private int width = 0;
|
private int width = 0;
|
||||||
private int height = 0;
|
private int height = 0;
|
||||||
|
|
||||||
private JoystickListener joystickListener;
|
private JoystickListener joystickListener;
|
||||||
|
|
||||||
public Joystick(Context context) { this(context, null); }
|
public Joystick(Context context) { this(context, null); }
|
||||||
|
|
||||||
public Joystick(Context context, AttributeSet attrs) { this(context, attrs, 0); }
|
public Joystick(Context context, AttributeSet attrs) { this(context, attrs, 0); }
|
||||||
|
|
||||||
public Joystick(Context context, AttributeSet attrs, int defStyleAttr) {
|
public Joystick(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
@ -99,7 +97,6 @@ public class Joystick extends BasicControllerNode implements ControllerNode {
|
||||||
y = Math.max(0, Math.min(middle * 2, y));
|
y = Math.max(0, Math.min(middle * 2, y));
|
||||||
|
|
||||||
axisX = ((x - middle) / middle);
|
axisX = ((x - middle) / middle);
|
||||||
|
|
||||||
axisY = ((y - middle) / middle);
|
axisY = ((y - middle) / middle);
|
||||||
|
|
||||||
if (event.getAction() == TouchType.ACTION_UP) {
|
if (event.getAction() == TouchType.ACTION_UP) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue