Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import net.kdt.pojavlaunch.services.GameService;
import net.kdt.pojavlaunch.utils.JREUtils;
import net.kdt.pojavlaunch.utils.MCOptionUtils;
import net.kdt.pojavlaunch.utils.TouchControllerInputView;
import net.kdt.pojavlaunch.utils.TouchControllerUtils;
import net.kdt.pojavlaunch.value.MinecraftAccount;
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
Expand All @@ -82,6 +83,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
volatile public static boolean isInputStackCall;

public static TouchCharInput touchCharInput;
private TouchControllerInputView touchControllerInputView;
private MinecraftGLSurface minecraftGLView;
private static Touchpad touchpad;
private LoggerView loggerView;
Expand Down Expand Up @@ -110,9 +112,6 @@ public void onCreate(Bundle savedInstanceState) {

String gameDirPath = Tools.getGameDirPath(minecraftProfile).getAbsolutePath();
MCOptionUtils.load(gameDirPath);
if (Tools.hasTouchController(new File(gameDirPath)) || LauncherPreferences.PREF_FORCE_ENABLE_TOUCHCONTROLLER) {
TouchControllerUtils.initialize(this);
}

Intent gameServiceIntent = new Intent(this, GameService.class);
// Start the service a bit early
Expand All @@ -121,6 +120,10 @@ public void onCreate(Bundle savedInstanceState) {
CallbackBridge.addGrabListener(touchpad);
CallbackBridge.addGrabListener(minecraftGLView);

if (Tools.hasTouchController(new File(gameDirPath)) || LauncherPreferences.PREF_FORCE_ENABLE_TOUCHCONTROLLER) {
TouchControllerUtils.initialize(this, touchControllerInputView);
}

mGyroControl = new GyroControl(this);

// Enabling this on TextureView results in a broken white result
Expand Down Expand Up @@ -174,6 +177,8 @@ protected void initLayout(int resId) {
GLOBAL_CLIPBOARD = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
touchCharInput.setCharacterSender(new LwjglCharSender());

touchControllerInputView.setSize(minecraftGLView.getWidth(), minecraftGLView.getHeight());

if(minecraftProfile.pojavRendererName != null) {
Log.i("RdrDebug","__P_renderer="+minecraftProfile.pojavRendererName);
Tools.LOCAL_RENDERER = minecraftProfile.pojavRendererName;
Expand Down Expand Up @@ -271,6 +276,7 @@ private void bindValues(){
loggerView = findViewById(R.id.mainLoggerView);
mControlLayout = findViewById(R.id.main_control_layout);
touchCharInput = findViewById(R.id.mainTouchCharInput);
touchControllerInputView = findViewById(R.id.touch_controller_input);
mDrawerPullButton = findViewById(R.id.drawer_button);
mHotbarView = findViewById(R.id.hotbar_view);
}
Expand Down Expand Up @@ -329,6 +335,7 @@ public void onConfigurationChanged(@NonNull Configuration newConfig) {
minecraftGLView.refreshSize();
Tools.updateWindowSize(this);
mControlLayout.refreshControlButtonPositions();
touchControllerInputView.setSize(minecraftGLView.getWidth(), minecraftGLView.getHeight());
});
}

Expand Down
Loading