remove test code

This commit is contained in:
Tungstend 2023-01-09 22:24:09 +08:00
parent c39572f5e5
commit 0237e12fd3
16 changed files with 24 additions and 954 deletions

View File

@ -1,14 +1,9 @@
package com.tungsten.fcl.activity;
import android.content.res.Configuration;
import android.graphics.SurfaceTexture;
import android.os.Bundle;
import android.util.Log;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -18,7 +13,6 @@ import com.tungsten.fcl.control.Controller;
import com.tungsten.fcl.control.ControllerType;
import com.tungsten.fcl.control.GameController;
import com.tungsten.fcl.control.JavaGuiController;
import com.tungsten.fcl.onlytest.MioMouseKeyboard;
import com.tungsten.fclauncher.bridge.FCLBridge;
import com.tungsten.fclcore.util.Logging;
import com.tungsten.fcllibrary.component.FCLActivity;
@ -33,11 +27,6 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
private static ControllerType controllerType;
private static FCLBridge fclBridge;
//only for test version
public MioMouseKeyboard mioMouseKeyboard;
public ImageView mouse;
private EditText input;
public static void setFClBridge(FCLBridge fclBridge, ControllerType controllerType) {
JVMActivity.fclBridge = fclBridge;
JVMActivity.controllerType = controllerType;
@ -57,11 +46,7 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
controller.setup(this);
textureView = findViewById(R.id.texture_view);
textureView.setSurfaceTextureListener(this);
mouse=findViewById(R.id.mouse);
input=findViewById(R.id.input);
textureView.setFocusable(true);
mioMouseKeyboard=new MioMouseKeyboard(this,mouse,textureView);
mioMouseKeyboard.setFCLBridge(fclBridge);
}
@Override
@ -87,17 +72,6 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
@Override
public void onBackPressed() {
if(getResources().getConfiguration().keyboard!= Configuration.KEYBOARD_NOKEYS) {
mioMouseKeyboard.catchPointer();
MioMouseKeyboard.baseX=0;
MioMouseKeyboard.baseY=0;
// if (FCLBridge.cursorMode==FCLBridge.CursorEnabled) {
// mouse.setVisibility(View.INVISIBLE);
// mioMouseKeyboard.releasePointer();
// } else {
// mouse.setVisibility(View.VISIBLE);
// mioMouseKeyboard.catchPointer();
// }
}
}
}

View File

@ -2,19 +2,16 @@ package com.tungsten.fcl.control;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import com.tungsten.fcl.activity.JVMActivity;
import com.tungsten.fcl.activity.JVMCrashActivity;
import com.tungsten.fclauncher.FCLPath;
import com.tungsten.fclauncher.bridge.FCLBridge;
import com.tungsten.fclauncher.bridge.FCLBridgeCallback;
import com.tungsten.fclcore.util.Logging;
import java.util.logging.Level;
public class GameController implements Controller {
private JVMActivity activity;
@Override
public View getLayout() {
@ -23,30 +20,19 @@ public class GameController implements Controller {
@Override
public void setup(JVMActivity activity) {
this.activity=activity;
}
@Override
public FCLBridgeCallback getCallbackBridge() {
return new FCLProcessListener(activity);
return new FCLProcessListener();
}
static class FCLProcessListener implements FCLBridgeCallback {
private JVMActivity activity;
FCLProcessListener(JVMActivity activity){
this.activity=activity;
}
@Override
public void onCursorModeChange(int mode) {
// TODO: Handle mouse event
activity.mouse.post(()->{
if (mode== FCLBridge.CursorEnabled) {
activity.mouse.setVisibility(View.VISIBLE);
} else {
activity.mouse.setVisibility(View.INVISIBLE);
}
});
}
@Override

View File

@ -1,151 +0,0 @@
package com.tungsten.fcl.onlytest;
import android.graphics.Rect;
import android.os.Build;
import androidx.annotation.RequiresApi;
import android.util.Log;
import android.view.View;
import android.view.View.OnCapturedPointerListener;
import android.view.MotionEvent;
import android.view.View.OnKeyListener;
import android.view.KeyEvent;
import com.tungsten.fcl.activity.JVMActivity;
import com.tungsten.fcl.onlytest.codes.AndroidKeyMap;
import com.tungsten.fcl.onlytest.codes.Translation;
import com.tungsten.fcl.onlytest.definitions.map.KeyMap;
import com.tungsten.fclauncher.bridge.FCLBridge;
public class MioMouseKeyboard {
private final JVMActivity context;
private final View mouseCursor;
private final Runnable mRunnable;
private final OnCapturedPointerListener mPointerListener;
private final AndroidKeyMap androidKeyMap;
private final Translation translation;
private final View focusView;
private FCLBridge fclBridge;
public static int baseX,baseY;
public MioMouseKeyboard(JVMActivity context, View mouse, View focusView){
this.context=context;
this.mouseCursor=mouse;
this.focusView=focusView;
androidKeyMap=new AndroidKeyMap();
translation=new Translation(com.tungsten.fcl.onlytest.definitions.id.key.KeyEvent.KEYMAP_TO_X);
mPointerListener=new OnCapturedPointerListener(){
@Override
public boolean onCapturedPointer(View view, MotionEvent event) {
baseX+=event.getX()*1;
baseY+=event.getY()*1;
mouseCursor.setX(baseX);
mouseCursor.setY(baseY);
fclBridge.pushEventPointer(baseX,baseY);
mio(event);
return true;
}
};
mRunnable=new Runnable(){
@Override
public void run() {
focusView.requestPointerCapture();
}
};
focusView.setOnKeyListener(new OnKeyListener(){
@Override
public boolean onKey(View view, int keyCode, KeyEvent event) {
if(event.getAction()==MotionEvent.ACTION_DOWN){
if (keyCode==KeyEvent.KEYCODE_ENTER){
// if(context.cursorMode==FCLBridge.CursorEnabled&&!isSoftShowing()){
// context.showKeyboard();
// }else {
//
// }
} else if (keyCode==KeyEvent.KEYCODE_BACK){
fclBridge.pushEventKey(translation.trans((String) androidKeyMap.translate(KeyEvent.KEYCODE_ESCAPE)), 0, true);
} else {
fclBridge.pushEventKey(translation.trans((String) androidKeyMap.translate(keyCode)), 0, true);
}
}else if(event.getAction()==MotionEvent.ACTION_UP){
if (keyCode==KeyEvent.KEYCODE_ENTER){
} else if (keyCode==KeyEvent.KEYCODE_BACK){
fclBridge.pushEventKey(translation.trans((String) androidKeyMap.translate(KeyEvent.KEYCODE_ESCAPE)), 0, false);
} else {
fclBridge.pushEventKey(translation.trans((String)androidKeyMap.translate(keyCode)), 0, false);
}
}
return false;
}
});
focusView.setOnCapturedPointerListener(mPointerListener);
}
public void setFCLBridge(FCLBridge fclBridge){
this.fclBridge=fclBridge;
}
private void mio(MotionEvent event){
if (event.getAction() == MotionEvent.ACTION_BUTTON_PRESS)
{
if (event.getActionButton() == MotionEvent.BUTTON_PRIMARY)
{
fclBridge.pushEventMouseButton(FCLBridge.Button1, true);
}
if(event.getActionButton() == MotionEvent.BUTTON_SECONDARY||event.getActionButton() == MotionEvent.BUTTON_BACK)
{
fclBridge.pushEventMouseButton(FCLBridge.Button3, true);
}
if(event.getActionButton() == MotionEvent.BUTTON_TERTIARY){
fclBridge.pushEventMouseButton(FCLBridge.Button2, true);
}
}
if (event.getAction() == MotionEvent.ACTION_BUTTON_RELEASE)
{
if (event.getActionButton() == MotionEvent.BUTTON_PRIMARY)
{
fclBridge.pushEventMouseButton(FCLBridge.Button1, false);
}
if(event.getActionButton() == MotionEvent.BUTTON_SECONDARY||event.getActionButton() == MotionEvent.BUTTON_BACK)
{
fclBridge.pushEventMouseButton(FCLBridge.Button3, false);
}
if(event.getActionButton() == MotionEvent.BUTTON_TERTIARY){
fclBridge.pushEventMouseButton(FCLBridge.Button2, false);
}
}
if (event.getActionMasked()==MotionEvent.ACTION_SCROLL){
if( event.getAxisValue(MotionEvent.AXIS_VSCROLL) < 0.0f){
fclBridge.pushEventMouseButton(5,true);
fclBridge.pushEventMouseButton(5,false);
}
else{
fclBridge.pushEventMouseButton(4,true);
fclBridge.pushEventMouseButton(4,false);
}
}
}
public void catchPointer(){
focusView.requestFocus();
focusView.postDelayed(mRunnable,300);
}
public void releasePointer(){
focusView.releasePointerCapture();
}
private boolean isSoftShowing() {
//获取当屏幕内容的高度
int screenHeight = context.getWindow().getDecorView().getHeight();
//获取View可见区域的bottom
Rect rect = new Rect();
//DecorView即为activity的顶级view
context.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
//考虑到虚拟导航栏的情况虚拟导航栏情况下screenHeight = rect.bottom + 虚拟导航栏高度
//选取screenHeight*2/3进行判断
Log.i("isSoftShowing","screenHigh: " + screenHeight + " rectViewBom : " + rect.bottom );
return screenHeight * 2 / 3 > rect.bottom;
}
}

View File

@ -1,169 +0,0 @@
package com.tungsten.fcl.onlytest.codes;
import static com.tungsten.fcl.onlytest.definitions.map.KeyMap.*;
import android.view.KeyEvent;
import com.tungsten.fcl.onlytest.definitions.map.KeyMap;
import java.util.HashMap;
public class AndroidKeyMap implements KeyMap, CoKeyMap {
private final HashMap<Integer, String> androidKeyMap;
public AndroidKeyMap() {
androidKeyMap = new HashMap<>();
init();
}
private void init() {
androidKeyMap.put(KeyEvent.KEYCODE_0, KEYMAP_KEY_0);
androidKeyMap.put(KeyEvent.KEYCODE_1, KEYMAP_KEY_1);
androidKeyMap.put(KeyEvent.KEYCODE_2, KEYMAP_KEY_2);
androidKeyMap.put(KeyEvent.KEYCODE_3, KEYMAP_KEY_3);
androidKeyMap.put(KeyEvent.KEYCODE_4, KEYMAP_KEY_4);
androidKeyMap.put(KeyEvent.KEYCODE_5, KEYMAP_KEY_5);
androidKeyMap.put(KeyEvent.KEYCODE_6, KEYMAP_KEY_6);
androidKeyMap.put(KeyEvent.KEYCODE_7, KEYMAP_KEY_7);
androidKeyMap.put(KeyEvent.KEYCODE_8, KEYMAP_KEY_8);
androidKeyMap.put(KeyEvent.KEYCODE_9, KEYMAP_KEY_9);
androidKeyMap.put(KeyEvent.KEYCODE_A, KEYMAP_KEY_A);
androidKeyMap.put(KeyEvent.KEYCODE_B, KEYMAP_KEY_B);
androidKeyMap.put(KeyEvent.KEYCODE_C, KEYMAP_KEY_C);
androidKeyMap.put(KeyEvent.KEYCODE_D, KEYMAP_KEY_D);
androidKeyMap.put(KeyEvent.KEYCODE_E, KEYMAP_KEY_E);
androidKeyMap.put(KeyEvent.KEYCODE_F, KEYMAP_KEY_F);
androidKeyMap.put(KeyEvent.KEYCODE_G, KEYMAP_KEY_G);
androidKeyMap.put(KeyEvent.KEYCODE_H, KEYMAP_KEY_H);
androidKeyMap.put(KeyEvent.KEYCODE_I, KEYMAP_KEY_I);
androidKeyMap.put(KeyEvent.KEYCODE_J, KEYMAP_KEY_J);
androidKeyMap.put(KeyEvent.KEYCODE_K, KEYMAP_KEY_K);
androidKeyMap.put(KeyEvent.KEYCODE_L, KEYMAP_KEY_L);
androidKeyMap.put(KeyEvent.KEYCODE_M, KEYMAP_KEY_M);
androidKeyMap.put(KeyEvent.KEYCODE_N, KEYMAP_KEY_N);
androidKeyMap.put(KeyEvent.KEYCODE_O, KEYMAP_KEY_O);
androidKeyMap.put(KeyEvent.KEYCODE_P, KEYMAP_KEY_P);
androidKeyMap.put(KeyEvent.KEYCODE_Q, KEYMAP_KEY_Q);
androidKeyMap.put(KeyEvent.KEYCODE_R, KEYMAP_KEY_R);
androidKeyMap.put(KeyEvent.KEYCODE_S, KEYMAP_KEY_S);
androidKeyMap.put(KeyEvent.KEYCODE_T, KEYMAP_KEY_T);
androidKeyMap.put(KeyEvent.KEYCODE_U, KEYMAP_KEY_U);
androidKeyMap.put(KeyEvent.KEYCODE_V, KEYMAP_KEY_V);
androidKeyMap.put(KeyEvent.KEYCODE_W, KEYMAP_KEY_W);
androidKeyMap.put(KeyEvent.KEYCODE_X, KEYMAP_KEY_X);
androidKeyMap.put(KeyEvent.KEYCODE_Y, KEYMAP_KEY_Y);
androidKeyMap.put(KeyEvent.KEYCODE_Z, KEYMAP_KEY_Z);
androidKeyMap.put(KeyEvent.KEYCODE_MINUS, KEYMAP_KEY_MINUS);
androidKeyMap.put(KeyEvent.KEYCODE_EQUALS, KEYMAP_KEY_EQUALS);
androidKeyMap.put(KeyEvent.KEYCODE_LEFT_BRACKET, KEYMAP_KEY_LBRACKET);
androidKeyMap.put(KeyEvent.KEYCODE_RIGHT_BRACKET, KEYMAP_KEY_RBRACKET);
androidKeyMap.put(KeyEvent.KEYCODE_SEMICOLON, KEYMAP_KEY_SEMICOLON);
androidKeyMap.put(KeyEvent.KEYCODE_APOSTROPHE, KEYMAP_KEY_APOSTROPHE);
androidKeyMap.put(KeyEvent.KEYCODE_GRAVE, KEYMAP_KEY_GRAVE);
androidKeyMap.put(KeyEvent.KEYCODE_BACKSLASH, KEYMAP_KEY_BACKSLASH);
androidKeyMap.put(KeyEvent.KEYCODE_COMMA, KEYMAP_KEY_COMMA);
androidKeyMap.put(KeyEvent.KEYCODE_PERIOD, KEYMAP_KEY_PERIOD);
androidKeyMap.put(KeyEvent.KEYCODE_SLASH, KEYMAP_KEY_SLASH);
androidKeyMap.put(KeyEvent.KEYCODE_ESCAPE, KEYMAP_KEY_ESC);
androidKeyMap.put(KeyEvent.KEYCODE_F1, KEYMAP_KEY_F1);
androidKeyMap.put(KeyEvent.KEYCODE_F2, KEYMAP_KEY_F2);
androidKeyMap.put(KeyEvent.KEYCODE_F3, KEYMAP_KEY_F3);
androidKeyMap.put(KeyEvent.KEYCODE_F4, KEYMAP_KEY_F4);
androidKeyMap.put(KeyEvent.KEYCODE_F5, KEYMAP_KEY_F5);
androidKeyMap.put(KeyEvent.KEYCODE_F6, KEYMAP_KEY_F6);
androidKeyMap.put(KeyEvent.KEYCODE_F7, KEYMAP_KEY_F7);
androidKeyMap.put(KeyEvent.KEYCODE_F8, KEYMAP_KEY_F8);
androidKeyMap.put(KeyEvent.KEYCODE_F9, KEYMAP_KEY_F9);
androidKeyMap.put(KeyEvent.KEYCODE_F10, KEYMAP_KEY_F10);
androidKeyMap.put(KeyEvent.KEYCODE_F11, KEYMAP_KEY_F11);
androidKeyMap.put(KeyEvent.KEYCODE_F12, KEYMAP_KEY_F12);
androidKeyMap.put(KeyEvent.KEYCODE_TAB, KEYMAP_KEY_TAB);
androidKeyMap.put(KeyEvent.KEYCODE_BACK, KEYMAP_KEY_BACKSPACE);
androidKeyMap.put(KeyEvent.KEYCODE_SPACE, KEYMAP_KEY_SPACE);
androidKeyMap.put(KeyEvent.KEYCODE_CAPS_LOCK, KEYMAP_KEY_CAPITAL);
androidKeyMap.put(KeyEvent.KEYCODE_ENTER, KEYMAP_KEY_ENTER);
androidKeyMap.put(KeyEvent.KEYCODE_SHIFT_LEFT, KEYMAP_KEY_LSHIFT);
androidKeyMap.put(KeyEvent.KEYCODE_CTRL_LEFT, KEYMAP_KEY_LCTRL);
androidKeyMap.put(KeyEvent.KEYCODE_ALT_LEFT, KEYMAP_KEY_LALT);
androidKeyMap.put(KeyEvent.KEYCODE_SHIFT_RIGHT, KEYMAP_KEY_RSHIFT);
androidKeyMap.put(KeyEvent.KEYCODE_CTRL_RIGHT, KEYMAP_KEY_RCTRL);
androidKeyMap.put(KeyEvent.KEYCODE_ALT_RIGHT, KEYMAP_KEY_RALT);
androidKeyMap.put(KeyEvent.KEYCODE_DPAD_UP, KEYMAP_KEY_UP);
androidKeyMap.put(KeyEvent.KEYCODE_DPAD_DOWN, KEYMAP_KEY_DOWN);
androidKeyMap.put(KeyEvent.KEYCODE_DPAD_LEFT, KEYMAP_KEY_LEFT);
androidKeyMap.put(KeyEvent.KEYCODE_DPAD_RIGHT, KEYMAP_KEY_RIGHT);
androidKeyMap.put(KeyEvent.KEYCODE_PAGE_UP, KEYMAP_KEY_PAGEUP);
androidKeyMap.put(KeyEvent.KEYCODE_PAGE_DOWN, KEYMAP_KEY_PAGEDOWN);
androidKeyMap.put(KeyEvent.KEYCODE_HOME, KEYMAP_KEY_HOME);
androidKeyMap.put(KeyEvent.KEYCODE_MOVE_END, KEYMAP_KEY_END);
androidKeyMap.put(KeyEvent.KEYCODE_INSERT, KEYMAP_KEY_INSERT);
androidKeyMap.put(KeyEvent.KEYCODE_DEL, KEYMAP_KEY_DELETE);
androidKeyMap.put(KeyEvent.KEYCODE_BREAK, KEYMAP_KEY_PAUSE);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_0, KEYMAP_KEY_NUMPAD0);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_1, KEYMAP_KEY_NUMPAD1);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_2, KEYMAP_KEY_NUMPAD2);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_3, KEYMAP_KEY_NUMPAD3);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_4, KEYMAP_KEY_NUMPAD4);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_5, KEYMAP_KEY_NUMPAD5);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_6, KEYMAP_KEY_NUMPAD6);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_7, KEYMAP_KEY_NUMPAD7);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_8, KEYMAP_KEY_NUMPAD8);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_9, KEYMAP_KEY_NUMPAD9);
androidKeyMap.put(KeyEvent.KEYCODE_NUM_LOCK, KEYMAP_KEY_NUMLOCK);
androidKeyMap.put(KeyEvent.KEYCODE_SCROLL_LOCK, KEYMAP_KEY_SCROLL);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_SUBTRACT, KEYMAP_KEY_SUBTRACT);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_ADD, KEYMAP_KEY_ADD);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_DOT, KEYMAP_KEY_DECIMAL);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, KEYMAP_KEY_NUMPADENTER);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_DIVIDE, KEYMAP_KEY_DIVIDE);
androidKeyMap.put(KeyEvent.KEYCODE_NUMPAD_MULTIPLY, KEYMAP_KEY_MULTIPLY);
androidKeyMap.put(KeyEvent.KEYCODE_SYSRQ, KEYMAP_KEY_PRINT);
/* missing RWIN in /android/view/KeyEvent.java */
/* missing LWIN in /android/view/KeyEvent.java */
/* missing RightK in GLFW.java */
//手柄
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_1, KEYMAP_BUTTON_1);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_2, KEYMAP_BUTTON_2);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_3, KEYMAP_BUTTON_3);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_4, KEYMAP_BUTTON_4);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_5, KEYMAP_BUTTON_5);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_6, KEYMAP_BUTTON_6);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_7, KEYMAP_BUTTON_7);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_8, KEYMAP_BUTTON_8);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_9, KEYMAP_BUTTON_9);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_10, KEYMAP_BUTTON_10);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_11, KEYMAP_BUTTON_11);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_12, KEYMAP_BUTTON_12);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_13, KEYMAP_BUTTON_13);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_14, KEYMAP_BUTTON_14);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_15, KEYMAP_BUTTON_15);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_16, KEYMAP_BUTTON_16);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_A, KEYMAP_BUTTON_A);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_B, KEYMAP_BUTTON_B);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_C, KEYMAP_BUTTON_C);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_X, KEYMAP_BUTTON_X);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_Y, KEYMAP_BUTTON_Y);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_Z, KEYMAP_BUTTON_Z);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_L1, KEYMAP_BUTTON_L1);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_L2, KEYMAP_BUTTON_L2);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_R1, KEYMAP_BUTTON_R1);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_R2, KEYMAP_BUTTON_R2);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_MODE, KEYMAP_BUTTON_MODE);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_SELECT, KEYMAP_BUTTON_SELECT);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_START, KEYMAP_BUTTON_START);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_THUMBL, KEYMAP_BUTTON_THUMBL);
androidKeyMap.put(KeyEvent.KEYCODE_BUTTON_THUMBR, KEYMAP_BUTTON_THUMBR);
}
@Override
public Object translate(Object keyCode) {
if (androidKeyMap.containsKey(keyCode)) {
return androidKeyMap.get(keyCode);
} else {
return null;
}
}
}

View File

@ -1,167 +0,0 @@
/*
* Copyright (c) 2002-2008 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.tungsten.fcl.onlytest.codes;
/**
* Boat key codes, from linux/input-event-codes.h
*/
public final class BoatKeycodes {
public static final int KEY_RESERVED = 0;
public static final int KEY_ESC = 1;
public static final int KEY_1 = 2;
public static final int KEY_2 = 3;
public static final int KEY_3 = 4;
public static final int KEY_4 = 5;
public static final int KEY_5 = 6;
public static final int KEY_6 = 7;
public static final int KEY_7 = 8;
public static final int KEY_8 = 9;
public static final int KEY_9 = 10;
public static final int KEY_0 = 11;
public static final int KEY_MINUS = 12;
public static final int KEY_EQUAL = 13;
public static final int KEY_BACKSPACE = 14;
public static final int KEY_TAB = 15;
public static final int KEY_Q = 16;
public static final int KEY_W = 17;
public static final int KEY_E = 18;
public static final int KEY_R = 19;
public static final int KEY_T = 20;
public static final int KEY_Y = 21;
public static final int KEY_U = 22;
public static final int KEY_I = 23;
public static final int KEY_O = 24;
public static final int KEY_P = 25;
public static final int KEY_LEFTBRACE = 26;
public static final int KEY_RIGHTBRACE = 27;
public static final int KEY_ENTER = 28;
public static final int KEY_LEFTCTRL = 29;
public static final int KEY_A = 30;
public static final int KEY_S = 31;
public static final int KEY_D = 32;
public static final int KEY_F = 33;
public static final int KEY_G = 34;
public static final int KEY_H = 35;
public static final int KEY_J = 36;
public static final int KEY_K = 37;
public static final int KEY_L = 38;
public static final int KEY_SEMICOLON = 39;
public static final int KEY_APOSTROPHE = 40;
public static final int KEY_GRAVE = 41;
public static final int KEY_LEFTSHIFT = 42;
public static final int KEY_BACKSLASH = 43;
public static final int KEY_Z = 44;
public static final int KEY_X = 45;
public static final int KEY_C = 46;
public static final int KEY_V = 47;
public static final int KEY_B = 48;
public static final int KEY_N = 49;
public static final int KEY_M = 50;
public static final int KEY_COMMA = 51;
public static final int KEY_DOT = 52;
public static final int KEY_SLASH = 53;
public static final int KEY_RIGHTSHIFT = 54;
public static final int KEY_KPASTERISK = 55;
public static final int KEY_LEFTALT = 56;
public static final int KEY_SPACE = 57;
public static final int KEY_CAPSLOCK = 58;
public static final int KEY_F1 = 59;
public static final int KEY_F2 = 60;
public static final int KEY_F3 = 61;
public static final int KEY_F4 = 62;
public static final int KEY_F5 = 63;
public static final int KEY_F6 = 64;
public static final int KEY_F7 = 65;
public static final int KEY_F8 = 66;
public static final int KEY_F9 = 67;
public static final int KEY_F10 = 68;
public static final int KEY_NUMLOCK = 69;
public static final int KEY_SCROLLLOCK = 70;
public static final int KEY_KP7 = 71;
public static final int KEY_KP8 = 72;
public static final int KEY_KP9 = 73;
public static final int KEY_KPMINUS = 74;
public static final int KEY_KP4 = 75;
public static final int KEY_KP5 = 76;
public static final int KEY_KP6 = 77;
public static final int KEY_KPPLUS = 78;
public static final int KEY_KP1 = 79;
public static final int KEY_KP2 = 80;
public static final int KEY_KP3 = 81;
public static final int KEY_KP0 = 82;
public static final int KEY_KPDOT = 83;
public static final int KEY_F11 = 87;
public static final int KEY_F12 = 88;
public static final int KEY_KPENTER = 96;
public static final int KEY_RIGHTCTRL = 97;
public static final int KEY_KPSLASH = 98;
public static final int KEY_SYSRQ = 99;
public static final int KEY_RIGHTALT = 100;
public static final int KEY_HOME = 102;
public static final int KEY_UP = 103;
public static final int KEY_PAGEUP = 104;
public static final int KEY_LEFT = 105;
public static final int KEY_RIGHT = 106;
public static final int KEY_END = 107;
public static final int KEY_DOWN = 108;
public static final int KEY_PAGEDOWN = 109;
public static final int KEY_INSERT = 110;
public static final int KEY_DELETE = 111;
public static final int KEY_KPEQUAL = 117;
public static final int KEY_PAUSE = 119;
public static final int KEY_KPCOMMA = 121;
public static final int KEY_LEFTMATA = 125;
public static final int KEY_RIGHTMETA = 126;
public static final int KEY_F13 = 183;
public static final int KEY_F14 = 184;
public static final int KEY_F15 = 185;
public static final int KEY_F16 = 186;
public static final int KEY_F17 = 187;
public static final int KEY_F18 = 188;
public static final int KEY_F19 = 189;
public static final int KEY_F20 = 190;
public static final int KEY_F21 = 191;
public static final int KEY_F22 = 192;
public static final int KEY_F23 = 193;
public static final int KEY_F24 = 194;
public static final int KEY_UNKNOWN = 240;
}

View File

@ -1,13 +0,0 @@
package com.tungsten.fcl.onlytest.codes;
public class BoatMousecodes {
public static final int BOAT_MOUSE_BUTTON_left = 1;
public static final int BOAT_MOUSE_BUTTON_middle = 2;
public static final int BOAT_MOUSE_BUTTON_right = 3;
public static final int BOAT_MOUSE_WHEEL_up = 4;
public static final int BOAT_MOUSE_WHEEL_down = 5;
public static final int BOAT_MOUSE_BUTTON_tilt_left = 6; /*rare*/
public static final int BOAT_MOUSE_BUTTON_tilt_right = 7; /*rare*/
public static final int BOAT_MOUSE_BUTTON_back = 8; /* only definned in org.lwjgl.opengl.BoatMouse.java */
public static final int BOAT_MOUSE_BUTTON_froward = 9; /* only definned in org.lwjgl.opengl.BoatMouse.java */
}

View File

@ -1,5 +0,0 @@
package com.tungsten.fcl.onlytest.codes;
public interface CoKeyMap {
Object translate(Object keyCode);
}

View File

@ -1,39 +0,0 @@
package com.tungsten.fcl.onlytest.codes;
import static com.tungsten.fcl.onlytest.definitions.id.key.KeyEvent.*;
public class Translation {
private final CoKeyMap xKeyMap;
private final CoKeyMap aKeyMap;
private int mode;
public Translation(int mode) {
xKeyMap = new XKeyMap();
aKeyMap = new AndroidKeyMap();
this.mode = mode;
}
public int trans(String s) {
switch (mode) {
case KEYMAP_TO_X:
return (int) xKeyMap.translate(s);
default:
return -1;
}
}
public String trans(int i) {
switch (mode) {
case ANDROID_TO_KEYMAP:
return (String) aKeyMap.translate(i);
default:
return null;
}
}
public Translation setMode(int mode) {
this.mode = mode;
return this;
}
}

View File

@ -1,143 +0,0 @@
package com.tungsten.fcl.onlytest.codes;
import static com.tungsten.fcl.onlytest.codes.BoatMousecodes.*;
import static com.tungsten.fcl.onlytest.definitions.map.MouseMap.*;
import static com.tungsten.fclauncher.FCLKeycodes.*;
import com.tungsten.fcl.onlytest.definitions.map.KeyMap;
import java.util.HashMap;
public class XKeyMap implements KeyMap, CoKeyMap {
private final HashMap<String, Integer> xKeyMap;
public XKeyMap() {
xKeyMap = new HashMap<>();
init();
}
private void init() {
xKeyMap.put(KEYMAP_KEY_0, KEY_0);
xKeyMap.put(KEYMAP_KEY_1, KEY_1);
xKeyMap.put(KEYMAP_KEY_2, KEY_2);
xKeyMap.put(KEYMAP_KEY_3, KEY_3);
xKeyMap.put(KEYMAP_KEY_4, KEY_4);
xKeyMap.put(KEYMAP_KEY_5, KEY_5);
xKeyMap.put(KEYMAP_KEY_6, KEY_6);
xKeyMap.put(KEYMAP_KEY_7, KEY_7);
xKeyMap.put(KEYMAP_KEY_8, KEY_8);
xKeyMap.put(KEYMAP_KEY_9, KEY_9);
xKeyMap.put(KEYMAP_KEY_A, KEY_A);
xKeyMap.put(KEYMAP_KEY_B, KEY_B);
xKeyMap.put(KEYMAP_KEY_C, KEY_C);
xKeyMap.put(KEYMAP_KEY_D, KEY_D);
xKeyMap.put(KEYMAP_KEY_E, KEY_E);
xKeyMap.put(KEYMAP_KEY_F, KEY_F);
xKeyMap.put(KEYMAP_KEY_G, KEY_G);
xKeyMap.put(KEYMAP_KEY_H, KEY_H);
xKeyMap.put(KEYMAP_KEY_I, KEY_I);
xKeyMap.put(KEYMAP_KEY_J, KEY_J);
xKeyMap.put(KEYMAP_KEY_K, KEY_K);
xKeyMap.put(KEYMAP_KEY_L, KEY_L);
xKeyMap.put(KEYMAP_KEY_M, KEY_M);
xKeyMap.put(KEYMAP_KEY_N, KEY_N);
xKeyMap.put(KEYMAP_KEY_O, KEY_O);
xKeyMap.put(KEYMAP_KEY_P, KEY_P);
xKeyMap.put(KEYMAP_KEY_Q, KEY_Q);
xKeyMap.put(KEYMAP_KEY_R, KEY_R);
xKeyMap.put(KEYMAP_KEY_S, KEY_S);
xKeyMap.put(KEYMAP_KEY_T, KEY_T);
xKeyMap.put(KEYMAP_KEY_U, KEY_U);
xKeyMap.put(KEYMAP_KEY_V, KEY_V);
xKeyMap.put(KEYMAP_KEY_W, KEY_W);
xKeyMap.put(KEYMAP_KEY_X, KEY_X);
xKeyMap.put(KEYMAP_KEY_Y, KEY_Y);
xKeyMap.put(KEYMAP_KEY_Z, KEY_Z);
xKeyMap.put(KEYMAP_KEY_MINUS, KEY_MINUS);
xKeyMap.put(KEYMAP_KEY_EQUALS, KEY_EQUAL);
xKeyMap.put(KEYMAP_KEY_LBRACKET, KEY_LEFTBRACE);
xKeyMap.put(KEYMAP_KEY_RBRACKET, KEY_RIGHTBRACE);
xKeyMap.put(KEYMAP_KEY_SEMICOLON, KEY_SEMICOLON);
xKeyMap.put(KEYMAP_KEY_APOSTROPHE, KEY_APOSTROPHE);
xKeyMap.put(KEYMAP_KEY_GRAVE, KEY_GRAVE);
xKeyMap.put(KEYMAP_KEY_BACKSLASH, KEY_BACKSLASH);
xKeyMap.put(KEYMAP_KEY_COMMA, KEY_COMMA);
xKeyMap.put(KEYMAP_KEY_PERIOD, KEY_DOT);
xKeyMap.put(KEYMAP_KEY_SLASH, KEY_SLASH);
xKeyMap.put(KEYMAP_KEY_ESC, 1);
xKeyMap.put(KEYMAP_KEY_F1, KEY_F1);
xKeyMap.put(KEYMAP_KEY_F2, KEY_F2);
xKeyMap.put(KEYMAP_KEY_F3, KEY_F3);
xKeyMap.put(KEYMAP_KEY_F4, KEY_F4);
xKeyMap.put(KEYMAP_KEY_F5, KEY_F5);
xKeyMap.put(KEYMAP_KEY_F6, KEY_F6);
xKeyMap.put(KEYMAP_KEY_F7, KEY_F7);
xKeyMap.put(KEYMAP_KEY_F8, KEY_F8);
xKeyMap.put(KEYMAP_KEY_F9, KEY_F9);
xKeyMap.put(KEYMAP_KEY_F10, KEY_F10);
xKeyMap.put(KEYMAP_KEY_F11, KEY_F11);
xKeyMap.put(KEYMAP_KEY_F12, KEY_F12);
xKeyMap.put(KEYMAP_KEY_TAB, KEY_TAB);
xKeyMap.put(KEYMAP_KEY_BACKSPACE, KEY_BACKSPACE);
xKeyMap.put(KEYMAP_KEY_SPACE, KEY_SPACE);
xKeyMap.put(KEYMAP_KEY_CAPITAL, KEY_CAPSLOCK);
xKeyMap.put(KEYMAP_KEY_ENTER, KEY_ENTER);
xKeyMap.put(KEYMAP_KEY_LSHIFT, KEY_LEFTSHIFT);
xKeyMap.put(KEYMAP_KEY_LCTRL, KEY_LEFTCTRL);
xKeyMap.put(KEYMAP_KEY_LALT, KEY_LEFTALT);
xKeyMap.put(KEYMAP_KEY_RSHIFT, KEY_RIGHTSHIFT);
xKeyMap.put(KEYMAP_KEY_RCTRL, KEY_RIGHTCTRL);
xKeyMap.put(KEYMAP_KEY_RALT, KEY_RIGHTALT);
xKeyMap.put(KEYMAP_KEY_UP, KEY_UP);
xKeyMap.put(KEYMAP_KEY_DOWN, KEY_DOWN);
xKeyMap.put(KEYMAP_KEY_LEFT, KEY_LEFT);
xKeyMap.put(KEYMAP_KEY_RIGHT, KEY_RIGHT);
xKeyMap.put(KEYMAP_KEY_PAGEUP, KEY_PAGEUP);
xKeyMap.put(KEYMAP_KEY_PAGEDOWN, KEY_PAGEDOWN);
xKeyMap.put(KEYMAP_KEY_HOME, KEY_HOME);
xKeyMap.put(KEYMAP_KEY_END, KEY_END);
xKeyMap.put(KEYMAP_KEY_INSERT, KEY_INSERT);
xKeyMap.put(KEYMAP_KEY_DELETE, KEY_DELETE);
xKeyMap.put(KEYMAP_KEY_PAUSE, KEY_PAUSE);
xKeyMap.put(KEYMAP_KEY_NUMPAD0, KEY_KP0);
xKeyMap.put(KEYMAP_KEY_NUMPAD1, KEY_KP1);
xKeyMap.put(KEYMAP_KEY_NUMPAD2, KEY_KP2);
xKeyMap.put(KEYMAP_KEY_NUMPAD3, KEY_KP3);
xKeyMap.put(KEYMAP_KEY_NUMPAD4, KEY_KP4);
xKeyMap.put(KEYMAP_KEY_NUMPAD5, KEY_KP5);
xKeyMap.put(KEYMAP_KEY_NUMPAD6, KEY_KP6);
xKeyMap.put(KEYMAP_KEY_NUMPAD7, KEY_KP7);
xKeyMap.put(KEYMAP_KEY_NUMPAD8, KEY_KP8);
xKeyMap.put(KEYMAP_KEY_NUMPAD9, KEY_KP9);
xKeyMap.put(KEYMAP_KEY_NUMLOCK, KEY_NUMLOCK);
xKeyMap.put(KEYMAP_KEY_SCROLL, KEY_SCROLLLOCK);
xKeyMap.put(KEYMAP_KEY_SUBTRACT, KEY_KPMINUS);
xKeyMap.put(KEYMAP_KEY_ADD, KEY_KPPLUS);
xKeyMap.put(KEYMAP_KEY_DECIMAL, KEY_KPDOT);
xKeyMap.put(KEYMAP_KEY_NUMPADENTER, KEY_KPENTER);
xKeyMap.put(KEYMAP_KEY_DIVIDE, KEY_KPSLASH);
xKeyMap.put(KEYMAP_KEY_MULTIPLY, KEY_KPASTERISK);
xKeyMap.put(KEYMAP_KEY_PRINT, KEY_P);
// xKeyMap.put(KEYMAP_KEY_LWIN, KEY_SUPER_L);
// xKeyMap.put(KEYMAP_KEY_RWIN, KEY_SUPER_R);
/* missing RightK in BoatKeycodes.java */
/* Mouse buttons codes */
xKeyMap.put(MOUSEMAP_BUTTON_LEFT, BOAT_MOUSE_BUTTON_left);
xKeyMap.put(MOUSEMAP_BUTTON_RIGHT, BOAT_MOUSE_BUTTON_right);
xKeyMap.put(MOUSEMAP_BUTTON_MIDDLE, BOAT_MOUSE_BUTTON_middle);
xKeyMap.put(MOUSEMAP_WHEEL_UP, BOAT_MOUSE_WHEEL_up);
xKeyMap.put(MOUSEMAP_WHEEL_DOWN, BOAT_MOUSE_WHEEL_down);
}
@Override
public Object translate(Object keyCode) {
if (xKeyMap.containsKey(keyCode)) {
return xKeyMap.get(keyCode);
} else {
return -1;
}
}
}

View File

@ -1,18 +0,0 @@
package com.tungsten.fcl.onlytest.definitions.id.key;
public interface KeyEvent {
//Define Type ID
int KEYBOARD_BUTTON = 11;
int MOUSE_BUTTON = 12;
int MOUSE_POINTER = 13;
int MOUSE_POINTER_INC = 15;
int TYPE_WORDS = 14;
int KEYMAP_TO_LWJGL = 21;
int KEYMAP_TO_GLFW = 22;
int KEYMAP_TO_X = 23;
int ANDROID_TO_KEYMAP = 24;
String MARK_KEYNAME_SPLIT = "\\|";
String MARK_KEYNAME_SPLIT_STRING = "|";
}

View File

@ -1,148 +0,0 @@
package com.tungsten.fcl.onlytest.definitions.map;
public interface KeyMap {
String
/* basic keys on main keyboard */
KEYMAP_KEY_0 = "0",
KEYMAP_KEY_1 = "1",
KEYMAP_KEY_2 = "2",
KEYMAP_KEY_3 = "3",
KEYMAP_KEY_4 = "4",
KEYMAP_KEY_5 = "5",
KEYMAP_KEY_6 = "6",
KEYMAP_KEY_7 = "7",
KEYMAP_KEY_8 = "8",
KEYMAP_KEY_9 = "9",
KEYMAP_KEY_A = "A",
KEYMAP_KEY_B = "B",
KEYMAP_KEY_C = "C",
KEYMAP_KEY_D = "D",
KEYMAP_KEY_E = "E",
KEYMAP_KEY_F = "F",
KEYMAP_KEY_G = "G",
KEYMAP_KEY_H = "H",
KEYMAP_KEY_I = "I",
KEYMAP_KEY_J = "J",
KEYMAP_KEY_K = "K",
KEYMAP_KEY_L = "L",
KEYMAP_KEY_M = "M",
KEYMAP_KEY_N = "N",
KEYMAP_KEY_O = "O",
KEYMAP_KEY_P = "P",
KEYMAP_KEY_Q = "Q",
KEYMAP_KEY_R = "R",
KEYMAP_KEY_S = "S",
KEYMAP_KEY_T = "T",
KEYMAP_KEY_U = "U",
KEYMAP_KEY_V = "V",
KEYMAP_KEY_W = "W",
KEYMAP_KEY_X = "X",
KEYMAP_KEY_Y = "Y",
KEYMAP_KEY_Z = "Z",
KEYMAP_KEY_MINUS = "-", // - on main keyboard
KEYMAP_KEY_EQUALS = "=", // = on main keyboard
KEYMAP_KEY_LBRACKET = "[", // [ on main keyboard
KEYMAP_KEY_RBRACKET = "]", // ] on main keyboard
KEYMAP_KEY_SEMICOLON = ";", // ; on main keyboard
KEYMAP_KEY_APOSTROPHE = "'", // ' on main keyboard
KEYMAP_KEY_GRAVE = "`", // ` on main keyboard
KEYMAP_KEY_BACKSLASH = "\\", // \ on main keyboard
KEYMAP_KEY_COMMA = ",", // , on main keyboard
KEYMAP_KEY_PERIOD = ".", // . on main keyboard
KEYMAP_KEY_SLASH = "/", // / on main keyboard
/* function keys on main keyboard */
KEYMAP_KEY_ESC = "ESC",
KEYMAP_KEY_F1 = "F1",
KEYMAP_KEY_F2 = "F2",
KEYMAP_KEY_F3 = "F3",
KEYMAP_KEY_F4 = "F4",
KEYMAP_KEY_F5 = "F5",
KEYMAP_KEY_F6 = "F6",
KEYMAP_KEY_F7 = "F7",
KEYMAP_KEY_F8 = "F8",
KEYMAP_KEY_F9 = "F9",
KEYMAP_KEY_F10 = "F10",
KEYMAP_KEY_F11 = "F11",
KEYMAP_KEY_F12 = "F12",
KEYMAP_KEY_TAB = "TAB",
KEYMAP_KEY_BACKSPACE = "BACK",
KEYMAP_KEY_SPACE = "SPACE",
KEYMAP_KEY_CAPITAL = "CAPITAL", //Caps Lock
KEYMAP_KEY_ENTER = "ENTER",
KEYMAP_KEY_LSHIFT = "LSHIFT",
KEYMAP_KEY_LCTRL = "LCTRL",
KEYMAP_KEY_LALT = "LALT",
KEYMAP_KEY_RSHIFT = "RSHIFT",
KEYMAP_KEY_RCTRL = "RCTRL",
KEYMAP_KEY_RALT = "RALT",
KEYMAP_KEY_UP = "UP",
KEYMAP_KEY_DOWN = "DOWN",
KEYMAP_KEY_LEFT = "LEFT",
KEYMAP_KEY_RIGHT = "RIGHT",
KEYMAP_KEY_PAGEUP = "PGUP",
KEYMAP_KEY_PAGEDOWN = "PGDN",
KEYMAP_KEY_HOME = "HOME",
KEYMAP_KEY_END = "END",
KEYMAP_KEY_INSERT = "INSERT",
KEYMAP_KEY_DELETE = "DELETE",
KEYMAP_KEY_PAUSE = "PAUSE", // pause & break
KEYMAP_KEY_PRINT = "PRINT",
KEYMAP_KEY_LWIN = "LWIN",
KEYMAP_KEY_RWIN = "RWIN",
KEYMAP_KEY_RIGHTK = "RIGHTK", // Sec Button in Mouse, how to achieve this in Keyboard?
/* keys on numeric keypad */
KEYMAP_KEY_NUMPAD0 = "NUMPAD0",
KEYMAP_KEY_NUMPAD1 = "NUMPAD1",
KEYMAP_KEY_NUMPAD2 = "NUMPAD2",
KEYMAP_KEY_NUMPAD3 = "NUMPAD3",
KEYMAP_KEY_NUMPAD4 = "NUMPAD4",
KEYMAP_KEY_NUMPAD5 = "NUMPAD5",
KEYMAP_KEY_NUMPAD6 = "NUMPAD6",
KEYMAP_KEY_NUMPAD7 = "NUMPAD7",
KEYMAP_KEY_NUMPAD8 = "NUMPAD8",
KEYMAP_KEY_NUMPAD9 = "NUMPAD9",
KEYMAP_KEY_NUMLOCK = "NUMLOCK", //Num Lock
KEYMAP_KEY_SCROLL = "SCROLL", //Scroll Lock
KEYMAP_KEY_SUBTRACT = "NUMPAD-", // -
KEYMAP_KEY_ADD = "NUMPAD+", // +
KEYMAP_KEY_DECIMAL = "NUMPAD.", // .
KEYMAP_KEY_NUMPADENTER = "NUMPADENTER", // Enter on numeric keypad
KEYMAP_KEY_DIVIDE = "NUMPAD\\", // /
KEYMAP_KEY_MULTIPLY = "NUMPAD*", // *
/* keys on stand gamepad */
KEYMAP_BUTTON_1 = "BUTTON_1",
KEYMAP_BUTTON_2 = "BUTTON_2",
KEYMAP_BUTTON_3 = "BUTTON_3",
KEYMAP_BUTTON_4 = "BUTTON_4",
KEYMAP_BUTTON_5 = "BUTTON_5",
KEYMAP_BUTTON_6 = "BUTTON_6",
KEYMAP_BUTTON_7 = "BUTTON_7",
KEYMAP_BUTTON_8 = "BUTTON_8",
KEYMAP_BUTTON_9 = "BUTTON_9",
KEYMAP_BUTTON_10 = "BUTTON_10",
KEYMAP_BUTTON_11 = "BUTTON_11",
KEYMAP_BUTTON_12 = "BUTTON_12",
KEYMAP_BUTTON_13 = "BUTTON_13",
KEYMAP_BUTTON_14 = "BUTTON_14",
KEYMAP_BUTTON_15 = "BUTTON_15",
KEYMAP_BUTTON_16 = "BUTTON_16",
KEYMAP_BUTTON_A = "BUTTON_A",
KEYMAP_BUTTON_B = "BUTTON_B",
KEYMAP_BUTTON_C = "BUTTON_C",
KEYMAP_BUTTON_X = "BUTTON_X",
KEYMAP_BUTTON_Y = "BUTTON_Y",
KEYMAP_BUTTON_Z = "BUTTON_Z",
KEYMAP_BUTTON_L1 = "BUTTON_L1",
KEYMAP_BUTTON_L2 = "BUTTON_L2",
KEYMAP_BUTTON_R1 = "BUTTON_R1",
KEYMAP_BUTTON_R2 = "BUTTON_R2",
KEYMAP_BUTTON_MODE = "BUTTON_MODE",
KEYMAP_BUTTON_SELECT = "BUTTON_SELECT",
KEYMAP_BUTTON_START = "BUTTON_START",
KEYMAP_BUTTON_THUMBL = "BUTTON_THUMBL",
KEYMAP_BUTTON_THUMBR = "BUTTON_THUMBR";
}

View File

@ -1,11 +0,0 @@
package com.tungsten.fcl.onlytest.definitions.map;
public interface MouseMap {
String
MOUSEMAP_BUTTON_LEFT = "MOUSE_BUTTON_LEFT",
MOUSEMAP_BUTTON_RIGHT = "MOUSE_BUTTON_RIGHT",
MOUSEMAP_BUTTON_MIDDLE = "MOUSE_BUTTON_MIDDLE",
MOUSEMAP_WHEEL_UP = "MOUSE_WHEEL_UP",
MOUSEMAP_WHEEL_DOWN = "MOUSE_WHEEL_DOWN";
}

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ffffffff"
android:pathData="M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0,0 1,6 18V3A1,1 0,0 1,7 2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"/>
</vector>

View File

@ -9,15 +9,4 @@
android:layout_height="match_parent"
android:id="@+id/texture_view"/>
<ImageView
android:id="@+id/mouse"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_cursor"/>
<EditText
android:visibility="gone"
android:id="@+id/input"
android:layout_width="1px"
android:layout_height="1px"/>
</RelativeLayout>

View File

@ -3,7 +3,6 @@ package com.tungsten.fclauncher.bridge;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.util.Log;
import android.view.Surface;
import com.tungsten.fclauncher.FCLPath;
@ -59,7 +58,7 @@ public class FCLBridge implements Serializable {
private boolean isLogPipeReady=false;
private WeakReference<LogReceiver> logReceiver;
public static int cursorMode=CursorEnabled;
public static int cursorMode = CursorEnabled;
public FCLBridge(FCLBridgeCallback callback) {
this.callback = callback;
@ -92,7 +91,7 @@ public class FCLBridge implements Serializable {
LogFileUtil logFileUtil = LogFileUtil.getInstance();
logFileUtil.setLogFilePath(getLogPath());
fclLogThread = new Thread(()->redirectStdio(getLogPath()));
fclLogThread = new Thread(() -> redirectStdio(getLogPath()));
fclLogThread.setName("FCLLogThread");
fclLogThread.start();
while (!isLogPipeReady) {
@ -116,7 +115,7 @@ public class FCLBridge implements Serializable {
}
public void pushEventPointer(int x, int y) {
pushEvent(System.nanoTime(), MotionNotify, (int) (x*0.33), (int) (y*0.3));
pushEvent(System.nanoTime(), MotionNotify, x, y);
}
public void pushEventKey(int keyCode, int keyChar, boolean press) {
@ -140,7 +139,7 @@ public class FCLBridge implements Serializable {
// FCLBridge callbacks
public void setCursorMode(int mode) {
cursorMode=mode;
cursorMode = mode;
if (callback != null) {
callback.onCursorModeChange(mode);
}
@ -170,17 +169,12 @@ public class FCLBridge implements Serializable {
}
public void setLogPipeReady(){
this.isLogPipeReady=true;
this.isLogPipeReady = true;
}
public void receiveLog(String log){
if (logReceiver == null || logReceiver.get() == null) {
logReceiver = new WeakReference<>(new LogReceiver() {
@Override
public void pushLog(String log) {
LogFileUtil.getInstance().writeLog(log);
}
});
logReceiver = new WeakReference<>(log1 -> LogFileUtil.getInstance().writeLog(log1));
} else {
logReceiver.get().pushLog(log);
}

View File

@ -1,6 +1,5 @@
package com.tungsten.fclauncher.utils;
import android.os.Environment;
import android.util.Log;
import com.tungsten.fclauncher.FCLPath;
@ -16,26 +15,31 @@ import java.util.ArrayList;
* @author mio
*/
public class LogFileUtil {
private static final LogFileUtil INSTANCE=new LogFileUtil();
private static final LogFileUtil INSTANCE = new LogFileUtil();
private String logFilePath;
private boolean firstWrite = true;
private boolean isWrite = true;
protected LogFileUtil(){
protected LogFileUtil() {
}
public static LogFileUtil getInstance(){
return INSTANCE;
}
public void setLogFilePath(String logFilePath){
this.logFilePath=logFilePath;
this.logFilePath = logFilePath;
}
public void writeLog(String log) {
Log.e("FCL", log);
if (this.logFilePath==null){
this.logFilePath= FCLPath.SHARED_COMMON_DIR +"/latest.log";
if (this.logFilePath == null) {
this.logFilePath = FCLPath.SHARED_COMMON_DIR + "/latest.log";
}
log+="\n";
if (!isWrite){
log += "\n";
if (!isWrite) {
return;
}
File logFile = new File(this.logFilePath);
@ -54,19 +58,17 @@ public class LogFileUtil {
} else {
addStringLineToFile(log, logFile);
}
}
public void writeLog(ArrayList<String> arrayList){
for (String s:arrayList){
public void writeLog(ArrayList<String> arrayList) {
for (String s:arrayList) {
writeLog(s);
}
}
public static void writeData(String path, String fileData) {
File file = new File(path);
try(FileOutputStream out = new FileOutputStream(file, false)) {
try (FileOutputStream out = new FileOutputStream(file, false)) {
out.write(fileData.getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
e.printStackTrace();