mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
821dd700ff | ||
|
|
ef7780ffaa | ||
|
|
4ee3f23df8 | ||
|
|
cb1378429f | ||
|
|
5cadb5923d | ||
|
|
f51b428de4 | ||
|
|
7fb49b5e01 | ||
|
|
5a735395da | ||
|
|
dda4e4b5c9 | ||
|
|
6d76ce9f5e | ||
|
|
e0ed28543b | ||
|
|
1afe496fed | ||
|
|
31685557d2 | ||
|
|
cf92349436 | ||
|
|
8a74695a74 | ||
|
|
ebb9e3fc8e | ||
|
|
01b127b7f3 | ||
|
|
422839dea4 | ||
|
|
a2e93687f6 | ||
|
|
fab4340461 | ||
|
|
b7a607b765 | ||
|
|
4669337a3f | ||
|
|
7b11b129f7 | ||
|
|
b18eb6b649 | ||
|
|
0879154432 | ||
|
|
f1698ae721 | ||
|
|
ad50070aba | ||
|
|
449a2ebc70 | ||
|
|
be70a5a123 | ||
|
|
d1bbba626d | ||
|
|
2141922ee3 | ||
|
|
c2ec2f2cc3 | ||
|
|
207df24ffd | ||
|
|
0966633d2a | ||
|
|
50bc007d46 | ||
|
|
941b48b802 | ||
|
|
cbc89b8af4 | ||
|
|
9cd2f6e784 | ||
|
|
64ebfa222e | ||
|
|
0129959d7b | ||
|
|
3ebfdb3928 | ||
|
|
bb386e25a0 | ||
|
|
4d3c39224c | ||
|
|
0b16bced84 | ||
|
|
b7d7a2d9bf | ||
|
|
fa702ed90c | ||
|
|
7e10b1315e | ||
|
|
cae9c27c62 | ||
|
|
cd4ee56d48 | ||
|
|
790d36bfbc | ||
|
|
da793a5bf2 | ||
|
|
69edc89292 | ||
|
|
a93f011253 | ||
|
|
4c670ad342 | ||
|
|
d9d6dbdf51 | ||
|
|
da04b7f859 | ||
|
|
8e0b482b23 | ||
|
|
d3933591b5 | ||
|
|
f31674a12e | ||
|
|
c474a82a94 | ||
|
|
71c2c94ece | ||
|
|
75bc685360 | ||
|
|
200aaf7be8 | ||
|
|
f33f994adc | ||
|
|
b1eea9ca76 | ||
|
|
1475e6af7b | ||
|
|
25887952c9 | ||
|
|
137ca0de12 | ||
|
|
a5059beaeb | ||
|
|
4d1ddff798 | ||
|
|
bbfa903a99 | ||
|
|
6ff3be97de | ||
|
|
466a716222 | ||
|
|
185e761f78 | ||
|
|
ea8809ddd0 | ||
|
|
13035d72a4 | ||
|
|
136a928883 | ||
|
|
0c2a51c9f4 | ||
|
|
d74699740e | ||
|
|
542feb038e | ||
|
|
b0ca99f18c | ||
|
|
53faf37dc1 | ||
|
|
63ffddb67b | ||
|
|
4a57bdbc5f | ||
|
|
0ec23b34ba | ||
|
|
d0caa0f78c | ||
|
|
51af06463f | ||
|
|
57cb5d2b51 | ||
|
|
24d8d47ab2 | ||
|
|
aa1b0108f4 | ||
|
|
2e4710c6c2 | ||
|
|
3ef3e7a239 | ||
|
|
a38b9daa6d | ||
|
|
120562952c | ||
|
|
fc309f5eaa | ||
|
|
e87d7c6954 | ||
|
|
8b2b12dbe8 | ||
|
|
e60ca15ae6 | ||
|
|
6fd7fc3a9d | ||
|
|
51a6d9d926 | ||
|
|
5e17828cc4 | ||
|
|
d2a11f1476 | ||
|
|
f8f00e6d9b | ||
|
|
2d8bc175fe | ||
|
|
5de6a9ac8f | ||
|
|
03a597d44c | ||
|
|
139a240ed3 | ||
|
|
26321c9a17 | ||
|
|
888b8fe24a | ||
|
|
53e76c5aeb | ||
|
|
04e5ac449d | ||
|
|
e484e0ba82 | ||
|
|
291973fffe | ||
|
|
01ae001de5 | ||
|
|
711b02be55 | ||
|
|
513e89c073 |
@@ -192,15 +192,17 @@ jobs:
|
|||||||
key: ${{ runner.os }}-14-macports-${{ hashFiles('.github/workflows/macports-deps.txt') }}
|
key: ${{ runner.os }}-14-macports-${{ hashFiles('.github/workflows/macports-deps.txt') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-14-macports-
|
${{ runner.os }}-14-macports-
|
||||||
|
# Updated PATH applies to the next step and onwards
|
||||||
- name: Install MacPorts (if necessary)
|
- name: Install MacPorts (if necessary)
|
||||||
run: |
|
run: |
|
||||||
if [ command -v port &>/dev/null ]; then
|
if command -v /opt/local/bin/port 2>&1 >/dev/null; then
|
||||||
echo "MacPorts already installed"
|
echo "MacPorts already installed"
|
||||||
else
|
else
|
||||||
|
echo "Installing MacPorts"
|
||||||
wget https://github.com/macports/macports-base/releases/download/v2.9.3/MacPorts-2.9.3-14-Sonoma.pkg
|
wget https://github.com/macports/macports-base/releases/download/v2.9.3/MacPorts-2.9.3-14-Sonoma.pkg
|
||||||
sudo installer -pkg ./MacPorts-2.9.3-14-Sonoma.pkg -target /
|
sudo installer -pkg ./MacPorts-2.9.3-14-Sonoma.pkg -target /
|
||||||
fi
|
fi
|
||||||
echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH
|
echo "/opt/local/bin:/opt/local/sbin" >> "$GITHUB_PATH"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
brew uninstall --ignore-dependencies libpng
|
brew uninstall --ignore-dependencies libpng
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
if: ${{ github.event.workflow_run.event == 'pull_request' }}
|
if: ${{ github.event.workflow_run.event == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
- id: 'pr-number'
|
- id: 'pr-number'
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
script: |
|
script: |
|
||||||
@@ -20,8 +20,9 @@ jobs:
|
|||||||
const pullHeadSHA = '${{github.event.workflow_run.head_sha}}';
|
const pullHeadSHA = '${{github.event.workflow_run.head_sha}}';
|
||||||
const pullUserId = ${{github.event.sender.id}};
|
const pullUserId = ${{github.event.sender.id}};
|
||||||
const prNumber = await (async () => {
|
const prNumber = await (async () => {
|
||||||
const pulls = await github.rest.pulls.list({owner, repo});
|
for await (const { data } of github.paginate.iterator(
|
||||||
for await (const {data} of github.paginate.iterator(pulls)) {
|
github.rest.pulls.list, { owner, repo }
|
||||||
|
)) {
|
||||||
for (const pull of data) {
|
for (const pull of data) {
|
||||||
if (pull.head.sha === pullHeadSHA && pull.user.id === pullUserId) {
|
if (pull.head.sha === pullHeadSHA && pull.user.id === pullUserId) {
|
||||||
return pull.number;
|
return pull.number;
|
||||||
@@ -36,7 +37,7 @@ jobs:
|
|||||||
|
|
||||||
return prNumber;
|
return prNumber;
|
||||||
- id: 'artifacts-text'
|
- id: 'artifacts-text'
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
script: |
|
script: |
|
||||||
@@ -54,7 +55,7 @@ jobs:
|
|||||||
return acc;
|
return acc;
|
||||||
}, '### Build Artifacts');
|
}, '### Build Artifacts');
|
||||||
- id: 'add-to-pr'
|
- id: 'add-to-pr'
|
||||||
uses: garrettjoecox/pr-section@3.1.0
|
uses: garrettjoecox/pr-section@4.0.0
|
||||||
with:
|
with:
|
||||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
pr-number: ${{ steps.pr-number.outputs.result }}
|
pr-number: ${{ steps.pr-number.outputs.result }}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ android {
|
|||||||
}
|
}
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode 3
|
versionCode 4
|
||||||
versionName "1.0.2"
|
versionName "1.1.1"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
//ndkBuild {
|
//ndkBuild {
|
||||||
// arguments "APP_PLATFORM=android-23"
|
// arguments "APP_PLATFORM=android-23"
|
||||||
@@ -75,7 +75,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'androidx.core:core:1.7.0' // Use the latest version
|
implementation 'androidx.core:core:1.7.0' // Use the latest version
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
}
|
}
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
task wrapper(type: Wrapper) {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
-->
|
-->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.dishii.mm"
|
package="com.dishii.mm"
|
||||||
android:versionCode="3"
|
android:versionCode="4"
|
||||||
android:versionName="1.0.2"
|
android:versionName="1.1.1"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<!-- OpenGL ES 3.0 -->
|
<!-- OpenGL ES 3.0 -->
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.dishii.mm;
|
||||||
|
|
||||||
|
public class ControllerButtons {
|
||||||
|
// Xbox Buttons
|
||||||
|
public static final int BUTTON_A = 0;
|
||||||
|
public static final int BUTTON_B = 1;
|
||||||
|
public static final int BUTTON_X = 2;
|
||||||
|
public static final int BUTTON_Y = 3;
|
||||||
|
public static final int BUTTON_LB = 9; // Left Bumper
|
||||||
|
public static final int BUTTON_RB = -5; // Right Bumper
|
||||||
|
public static final int BUTTON_BACK = 4;
|
||||||
|
public static final int BUTTON_START = 6;
|
||||||
|
public static final int BUTTON_DPAD_UP = 11;
|
||||||
|
public static final int BUTTON_DPAD_DOWN = 12;
|
||||||
|
public static final int BUTTON_DPAD_LEFT = 13;
|
||||||
|
public static final int BUTTON_DPAD_RIGHT = 14;
|
||||||
|
|
||||||
|
// Xbox Axis (Joysticks and Triggers)
|
||||||
|
public static final int AXIS_LX = 0; // Left stick X
|
||||||
|
public static final int AXIS_LY = 1; // Left stick Y
|
||||||
|
public static final int AXIS_RX = 2; // Right stick X
|
||||||
|
public static final int AXIS_RY = 3; // Right stick Y
|
||||||
|
public static final int AXIS_LT = -2; // Left Trigger (negative axis)
|
||||||
|
public static final int AXIS_RT = -4; // Right Trigger (negative axis)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -20,15 +20,29 @@ import androidx.core.app.ActivityCompat;
|
|||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
//This class is the main SDLActivity and just sets up a bunch of default files
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
//This class is the main SDLActivity and just sets up a bunch of default files and the input overlay
|
||||||
public class MainActivity extends SDLActivity{
|
public class MainActivity extends SDLActivity{
|
||||||
|
|
||||||
private static final int STORAGE_PERMISSION_REQUEST_CODE = 1;
|
private static final int STORAGE_PERMISSION_REQUEST_CODE = 1;
|
||||||
|
|
||||||
|
SharedPreferences preferences;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
preferences = getSharedPreferences("com.dishii.mm.prefs",Context.MODE_PRIVATE);
|
||||||
|
|
||||||
|
setupControllerOverlay();
|
||||||
|
|
||||||
// Check if storage permissions are granted
|
// Check if storage permissions are granted
|
||||||
if (hasStoragePermission()) {
|
if (hasStoragePermission()) {
|
||||||
doVersionCheck();
|
doVersionCheck();
|
||||||
@@ -36,10 +50,10 @@ public class MainActivity extends SDLActivity{
|
|||||||
} else {
|
} else {
|
||||||
requestStoragePermission();
|
requestStoragePermission();
|
||||||
}
|
}
|
||||||
|
attachController();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doVersionCheck(){
|
private void doVersionCheck(){
|
||||||
SharedPreferences preferences = getSharedPreferences("com.dishii.mm.prefs",Context.MODE_PRIVATE);
|
|
||||||
int currentVersion = BuildConfig.VERSION_CODE; // Use your app's version code
|
int currentVersion = BuildConfig.VERSION_CODE; // Use your app's version code
|
||||||
int storedVersion = preferences.getInt("appVersion", 1);
|
int storedVersion = preferences.getInt("appVersion", 1);
|
||||||
|
|
||||||
@@ -184,4 +198,286 @@ public class MainActivity extends SDLActivity{
|
|||||||
return Environment.MEDIA_MOUNTED.equals(state);
|
return Environment.MEDIA_MOUNTED.equals(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public native void attachController();
|
||||||
|
public native void detachController();
|
||||||
|
// Native method for setting button state
|
||||||
|
public native void setButton(int button, boolean value);
|
||||||
|
public native void setCameraState(int axis, float value);
|
||||||
|
|
||||||
|
// Native method for setting joystick axis value
|
||||||
|
public native void setAxis(int axis, short value);
|
||||||
|
|
||||||
|
private Button button1, button2, button3, button4;
|
||||||
|
private Button buttonA, buttonB, buttonX, buttonY;
|
||||||
|
private Button buttonDpadUp, buttonDpadDown, buttonDpadLeft, buttonDpadRight;
|
||||||
|
private Button buttonLB, buttonRB, buttonZ, buttonStart, buttonBack;
|
||||||
|
private Button buttonToggle;
|
||||||
|
private FrameLayout leftJoystick;
|
||||||
|
private ImageView leftJoystickKnob;
|
||||||
|
private View overlayView;
|
||||||
|
|
||||||
|
// Function to set up the controller overlay (inflate layout and initialize buttons)
|
||||||
|
private void setupControllerOverlay() {
|
||||||
|
// Inflate the touchcontrol_overlay layout
|
||||||
|
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
|
overlayView = inflater.inflate(R.layout.touchcontrol_overlay, null);
|
||||||
|
|
||||||
|
// Set layout params for overlayView to control positioning and sizing
|
||||||
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT
|
||||||
|
);
|
||||||
|
overlayView.setLayoutParams(layoutParams);
|
||||||
|
// Add overlay view to the main layout (you may need to add it to a container like FrameLayout)
|
||||||
|
ViewGroup view = (ViewGroup) getContentView();
|
||||||
|
view.addView(overlayView);
|
||||||
|
|
||||||
|
final ViewGroup buttonGroup = overlayView.findViewById(R.id.button_group);
|
||||||
|
|
||||||
|
buttonA = overlayView.findViewById(R.id.buttonA);
|
||||||
|
buttonB = overlayView.findViewById(R.id.buttonB);
|
||||||
|
buttonX = overlayView.findViewById(R.id.buttonX);
|
||||||
|
buttonY = overlayView.findViewById(R.id.buttonY);
|
||||||
|
|
||||||
|
buttonDpadUp = overlayView.findViewById(R.id.buttonDpadUp);
|
||||||
|
buttonDpadDown = overlayView.findViewById(R.id.buttonDpadDown);
|
||||||
|
buttonDpadLeft = overlayView.findViewById(R.id.buttonDpadLeft);
|
||||||
|
buttonDpadRight = overlayView.findViewById(R.id.buttonDpadRight);
|
||||||
|
|
||||||
|
buttonLB = overlayView.findViewById(R.id.buttonLB);
|
||||||
|
buttonRB = overlayView.findViewById(R.id.buttonRB);
|
||||||
|
buttonZ = overlayView.findViewById(R.id.buttonZ);
|
||||||
|
|
||||||
|
buttonStart = overlayView.findViewById(R.id.buttonStart);
|
||||||
|
buttonBack = overlayView.findViewById(R.id.buttonBack);
|
||||||
|
|
||||||
|
buttonToggle = overlayView.findViewById(R.id.buttonToggle);
|
||||||
|
|
||||||
|
// Initialize joysticks and joystick knobs from the inflated layout
|
||||||
|
leftJoystick = overlayView.findViewById(R.id.left_joystick);
|
||||||
|
leftJoystickKnob = overlayView.findViewById(R.id.left_joystick_knob);
|
||||||
|
|
||||||
|
FrameLayout rightScreenArea = overlayView.findViewById(R.id.right_screen_area);
|
||||||
|
|
||||||
|
// Set OnTouchListeners for the Xbox controller buttons
|
||||||
|
addTouchListener(buttonA, ControllerButtons.BUTTON_A); // SDL Button 0 (A)
|
||||||
|
addTouchListener(buttonB, ControllerButtons.BUTTON_B); // SDL Button 1 (B)
|
||||||
|
addTouchListener(buttonX, ControllerButtons.BUTTON_X); // SDL Button 2 (X)
|
||||||
|
addTouchListener(buttonY, ControllerButtons.BUTTON_Y); // SDL Button 3 (Y)
|
||||||
|
|
||||||
|
setupCButtons(buttonDpadUp, ControllerButtons.AXIS_RY, 1); // SDL Button 10 (D-Pad Up)
|
||||||
|
setupCButtons(buttonDpadDown, ControllerButtons.AXIS_RY , -1); // SDL Button 11 (D-Pad Down)
|
||||||
|
setupCButtons(buttonDpadLeft, ControllerButtons.AXIS_RX, 1); // SDL Button 12 (D-Pad Left)
|
||||||
|
setupCButtons(buttonDpadRight, ControllerButtons.AXIS_RX, -1); // SDL Button 13 (D-Pad Right)
|
||||||
|
|
||||||
|
addTouchListener(buttonLB, ControllerButtons.BUTTON_LB); // SDL Button 4 (LB)
|
||||||
|
addTouchListener(buttonRB, ControllerButtons.BUTTON_RB); // SDL Button 5 (RB)
|
||||||
|
addTouchListener(buttonZ, ControllerButtons.AXIS_RT); // SDL Button 5 (Z)
|
||||||
|
|
||||||
|
addTouchListener(buttonStart, ControllerButtons.BUTTON_START); // SDL Button 7 (Start)
|
||||||
|
addTouchListener(buttonBack, ControllerButtons.BUTTON_BACK); // SDL Button 6 (Back)
|
||||||
|
|
||||||
|
|
||||||
|
// Setup joystick movement
|
||||||
|
setupJoystick(leftJoystick, leftJoystickKnob, true); // Left joystick
|
||||||
|
|
||||||
|
setupLookAround(rightScreenArea);
|
||||||
|
|
||||||
|
setupToggleButton(buttonToggle,buttonGroup);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupToggleButton(Button button, ViewGroup uiGroup){
|
||||||
|
boolean isHidden = preferences.getBoolean("controlsVisible", false); // Default to 'false' (visible)
|
||||||
|
uiGroup.setVisibility(isHidden ? View.INVISIBLE : View.VISIBLE); // Set the initial visibility based on the saved state
|
||||||
|
/*if(isHidden){
|
||||||
|
detachController();
|
||||||
|
}*/
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
boolean isHidden = false;
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (isHidden) {
|
||||||
|
uiGroup.setVisibility(View.VISIBLE); // Show UI elements
|
||||||
|
//attachController();
|
||||||
|
} else {
|
||||||
|
uiGroup.setVisibility(View.INVISIBLE); // Hide UI elements
|
||||||
|
//detachController();
|
||||||
|
}
|
||||||
|
preferences.edit().putBoolean("controlsVisible", !isHidden).apply();
|
||||||
|
isHidden = !isHidden; // Toggle state
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to set a touch listener for each button
|
||||||
|
private void addTouchListener(Button button, int buttonNum) {
|
||||||
|
button.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
switch (event.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
setButton(buttonNum, true);
|
||||||
|
button.setPressed(true);
|
||||||
|
return true;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
setButton(buttonNum, false);
|
||||||
|
button.setPressed(false);
|
||||||
|
return true;
|
||||||
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
setButton(buttonNum, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupCButtons(Button button, int buttonNum, int direction) {
|
||||||
|
button.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
switch (event.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
setAxis(buttonNum, direction<0 ? Short.MAX_VALUE : Short.MIN_VALUE);
|
||||||
|
button.setPressed(true);
|
||||||
|
return true;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
setAxis(buttonNum, (short) 0);
|
||||||
|
button.setPressed(false);
|
||||||
|
return true;
|
||||||
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
setAxis(buttonNum, (short) 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean TouchAreaEnabled = true;
|
||||||
|
|
||||||
|
void DisableTouchArea(){
|
||||||
|
TouchAreaEnabled = false;
|
||||||
|
}
|
||||||
|
void EnableTouchArea(){
|
||||||
|
TouchAreaEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupLookAround(FrameLayout rightScreenArea) {
|
||||||
|
rightScreenArea.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
private float lastX = 0;
|
||||||
|
private float lastY = 0;
|
||||||
|
private boolean isTouching = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
switch (event.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
// Start tracking the finger's position
|
||||||
|
lastX = event.getX();
|
||||||
|
lastY = event.getY();
|
||||||
|
isTouching = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
if (isTouching) {
|
||||||
|
// Calculate the change in position (delta)
|
||||||
|
float deltaX = event.getX() - lastX;
|
||||||
|
float deltaY = event.getY() - lastY;
|
||||||
|
|
||||||
|
// Update the last position
|
||||||
|
lastX = event.getX();
|
||||||
|
lastY = event.getY();
|
||||||
|
|
||||||
|
// Increase sensitivity by using a larger multiplier
|
||||||
|
// Adjust these multipliers to suit your needs
|
||||||
|
float sensitivityMultiplier = 15; // Higher value for more sensitivity
|
||||||
|
float rx = (deltaX * sensitivityMultiplier);
|
||||||
|
float ry = (deltaY * sensitivityMultiplier);
|
||||||
|
|
||||||
|
// Send the mapped values to the joystick axes
|
||||||
|
setCameraState(0, rx); // Right stick X axis
|
||||||
|
setCameraState(1, ry); // Right stick Y axis
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
// Stop tracking the finger's position and reset joystick input
|
||||||
|
isTouching = false;
|
||||||
|
setCameraState(0, 0.0f); // Reset right stick X axis
|
||||||
|
setCameraState(1, 0.0f); // Reset right stick Y axis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TouchAreaEnabled; // Event full handled
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Function to set joystick movement with reset to center when not touched
|
||||||
|
private void setupJoystick(FrameLayout joystickLayout, ImageView joystickKnob, boolean isLeft) {
|
||||||
|
joystickLayout.post(() -> {
|
||||||
|
// Calculate the joystick center once, before any events
|
||||||
|
final float joystickCenterX = joystickLayout.getWidth() / 2f;
|
||||||
|
final float joystickCenterY = joystickLayout.getHeight() / 2f;
|
||||||
|
|
||||||
|
joystickLayout.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
switch (event.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
// Calculate the joystick movement and move the knob
|
||||||
|
float deltaX = event.getX() - joystickCenterX;
|
||||||
|
float deltaY = event.getY() - joystickCenterY;
|
||||||
|
|
||||||
|
// Clamp the joystick movement to prevent it from going outside the area
|
||||||
|
float maxRadius = joystickLayout.getWidth() / 2f - joystickKnob.getWidth() / 2f;
|
||||||
|
float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||||
|
if (distance > maxRadius) {
|
||||||
|
float scale = maxRadius / distance;
|
||||||
|
deltaX *= scale;
|
||||||
|
deltaY *= scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
joystickKnob.setX(joystickCenterX + deltaX - joystickKnob.getWidth() / 2f);
|
||||||
|
joystickKnob.setY(joystickCenterY + deltaY - joystickKnob.getHeight() / 2f);
|
||||||
|
|
||||||
|
// Send joystick values to native C code
|
||||||
|
short x = (short) (deltaX / maxRadius * Short.MAX_VALUE);
|
||||||
|
short y = (short) (deltaY / maxRadius * Short.MAX_VALUE);
|
||||||
|
|
||||||
|
// Send X-axis and Y-axis values
|
||||||
|
setAxis(isLeft ? ControllerButtons.AXIS_LX : ControllerButtons.AXIS_RX, x); // X-axis
|
||||||
|
setAxis(isLeft ? ControllerButtons.AXIS_LY : ControllerButtons.AXIS_RY, y); // Y-axis
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
// Reset joystick knob to the center position (ensure it's placed correctly)
|
||||||
|
joystickKnob.setX(joystickCenterX - joystickKnob.getWidth() / 2f);
|
||||||
|
joystickKnob.setY(joystickCenterY - joystickKnob.getHeight() / 2f);
|
||||||
|
|
||||||
|
// Reset joystick values to 0 when released or canceled
|
||||||
|
setAxis(isLeft ? ControllerButtons.AXIS_LX : ControllerButtons.AXIS_RX, (short) 0); // X-axis
|
||||||
|
setAxis(isLeft ? ControllerButtons.AXIS_LY : ControllerButtons.AXIS_RY, (short) 0); // Y-axis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- Pressed state -->
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<solid android:color="#10FFFFFF" /> <!-- Darker color when pressed -->
|
||||||
|
<stroke
|
||||||
|
android:width="2.5dp"
|
||||||
|
android:color="#20FFFFFF" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Default state -->
|
||||||
|
<item>
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<solid android:color="#20FFFFFF" />
|
||||||
|
<stroke
|
||||||
|
android:width="2.5dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<vector android:alpha="1.0" android:height="221.78dp"
|
||||||
|
android:viewportHeight="221.78" android:viewportWidth="221.78"
|
||||||
|
android:width="221.78dp"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillAlpha="1.0"
|
||||||
|
android:fillColor="#20FFFFFF"
|
||||||
|
android:pathData="M221.78,87.07v47.64a11.53,11.53 0,0 1,-11.5 11.5H151.62a5.42,5.42 0,0 0,-5.41 5.41v58.66a11.53,11.53 0,0 1,-11.5 11.5H87.07a11.53,11.53 0,0 1,-11.5 -11.5V151.61a5.41,5.41 0,0 0,-5.41 -5.41H11.5A11.53,11.53 0,0 1,0 134.7V87.05a11.53,11.53 0,0 1,11.5 -11.5H70.16a5.41,5.41 0,0 0,5.41 -5.41V11.5A11.53,11.53 0,0 1,87.07 0h47.64a11.53,11.53 0,0 1,11.5 11.5V70.16a5.41,5.41 0,0 0,5.41 5.41h58.66A11.53,11.53 0,0 1,221.78 87.07Z"
|
||||||
|
android:strokeWidth="2.5"
|
||||||
|
android:strokeColor="#25FFFFFF"
|
||||||
|
android:strokeAlpha="1.0" />
|
||||||
|
<path android:fillColor="#25FFFFFF" android:fillAlpha="1.0"
|
||||||
|
android:pathData="M195.47,110.32l-16.26,-9.38a0.65,0.65 0,0 0,-1 0.56v18.78a0.66,0.66 0,0 0,1 0.57l16.26,-9.39A0.66,0.66 0,0 0,195.47 110.32Z" />
|
||||||
|
<path android:fillColor="#25FFFFFF" android:fillAlpha="1.0"
|
||||||
|
android:pathData="M26.31,110.32l16.26,-9.38a0.65,0.65 0,0 1,1 0.56v18.78a0.66,0.66 0,0 1,-1 0.57l-16.26,-9.39A0.66,0.66 0,0 1,26.31 110.32Z" />
|
||||||
|
<path android:fillColor="#25FFFFFF" android:fillAlpha="1.0"
|
||||||
|
android:pathData="M110.32,26.31l-9.38,16.26a0.65,0.65 0,0 0,0.56 1h18.78a0.66,0.66 0,0 0,0.57 -1l-9.39,-16.26A0.66,0.66 0,0 0,110.32 26.31Z" />
|
||||||
|
<path android:fillColor="#25FFFFFF" android:fillAlpha="1.0"
|
||||||
|
android:pathData="M110.32,195.47l-9.38,-16.26a0.65,0.65 0,0 1,0.56 -1h18.78a0.66,0.66 0,0 1,0.57 1l-9.39,16.26A0.66,0.66 0,0 1,110.32 195.47Z" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- Pressed state -->
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<layer-list>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#10FFFFFF" /> <!-- Darker color when pressed -->
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" />
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Default state -->
|
||||||
|
<item>
|
||||||
|
<layer-list>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#20FFFFFF" /> <!-- Default color -->
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" />
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#20FFFFFF"
|
||||||
|
android:pathData="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<solid android:color="#10FFFFFF" />
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" />
|
||||||
|
<padding
|
||||||
|
android:bottom="10dp"
|
||||||
|
android:left="10dp"
|
||||||
|
android:right="10dp"
|
||||||
|
android:top="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="oval">
|
||||||
|
<solid android:color="#30000000" />
|
||||||
|
<size
|
||||||
|
android:width="30dp"
|
||||||
|
android:height="30dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- Pressed state -->
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<layer-list>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#10FFFFFF" /> <!-- Darker color when pressed -->
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="10dp"
|
||||||
|
android:bottomRightRadius="10dp"
|
||||||
|
android:topLeftRadius="50dp"
|
||||||
|
android:topRightRadius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Default state -->
|
||||||
|
<item>
|
||||||
|
<layer-list>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#20FFFFFF" /> <!-- Default color -->
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="10dp"
|
||||||
|
android:bottomRightRadius="10dp"
|
||||||
|
android:topLeftRadius="50dp"
|
||||||
|
android:topRightRadius="10dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- Pressed state -->
|
||||||
|
<item android:state_pressed="true">
|
||||||
|
<layer-list>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#10FFFFFF" /> <!-- Darker color when pressed -->
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="10dp"
|
||||||
|
android:bottomRightRadius="10dp"
|
||||||
|
android:topLeftRadius="10dp"
|
||||||
|
android:topRightRadius="50dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Default state -->
|
||||||
|
<item>
|
||||||
|
<layer-list>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#20FFFFFF" /> <!-- Default color -->
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#25FFFFFF" />
|
||||||
|
<size
|
||||||
|
android:width="25dp"
|
||||||
|
android:height="25dp" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="10dp"
|
||||||
|
android:bottomRightRadius="10dp"
|
||||||
|
android:topLeftRadius="10dp"
|
||||||
|
android:topRightRadius="50dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@android:color/transparent">
|
||||||
|
|
||||||
|
<!-- New Grouping Layout -->
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/button_group"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- Left Joystick -->
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/left_joystick"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:background="@drawable/ic_stick"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/left_joystick_knob"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/ic_button" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/right_screen_area"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/left_joystick"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:src="@drawable/ic_cross"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/buttonDpadDown"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/buttonDpadRight"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/buttonDpadLeft"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/buttonDpadUp" />
|
||||||
|
|
||||||
|
<!-- D-Pad -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonDpadUp"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/buttonDpadRight"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/buttonDpadRight"
|
||||||
|
android:background="@android:color/transparent"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonDpadDown"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/buttonDpadLeft"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/buttonDpadLeft"
|
||||||
|
android:background="@android:color/transparent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonDpadLeft"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginEnd="60dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/left_joystick"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/left_joystick"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/left_joystick"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/buttonLB"
|
||||||
|
android:background="@android:color/transparent"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonDpadRight"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/buttonDpadDown"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/buttonDpadDown"
|
||||||
|
android:background="@android:color/transparent"/>
|
||||||
|
|
||||||
|
<!-- Action Buttons (A, B, X, Y) -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonB"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="@drawable/ic_button"
|
||||||
|
android:text="B"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/buttonA"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/buttonA"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonA"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginEnd="30dp"
|
||||||
|
android:background="@drawable/ic_button"
|
||||||
|
android:text="A"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/buttonZ"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonY"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="@drawable/ic_button"
|
||||||
|
android:text="Y"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/buttonB"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/buttonB"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonX"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:background="@drawable/ic_button"
|
||||||
|
android:text="X"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/buttonA"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/buttonA"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<!-- Shoulder Buttons -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonLB"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:background="@drawable/ic_trigger_button_left"
|
||||||
|
android:text="L"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonRB"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="@drawable/ic_trigger_button_right"
|
||||||
|
android:text="R"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonZ"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="@drawable/ic_trigger_button_right"
|
||||||
|
android:text="Z"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/buttonRB"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<!-- Start and Back Buttons -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonBack"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginEnd="100dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/ic_rectangular_button"
|
||||||
|
android:text="Back"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonStart"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginStart="100dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/ic_rectangular_button"
|
||||||
|
android:text="Start"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:textColor="#25FFFFFF"/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<!-- Toggle Button -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonToggle"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/ic_show"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
+3
-3
@@ -5,10 +5,10 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
|
|||||||
|
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
|
||||||
|
|
||||||
project(2s2h VERSION 1.0.2 LANGUAGES C CXX)
|
project(2s2h VERSION 1.1.1 LANGUAGES C CXX)
|
||||||
include(CMake/2ship-cvars.cmake)
|
include(CMake/2ship-cvars.cmake)
|
||||||
include(CMake/lus-cvars.cmake)
|
include(CMake/lus-cvars.cmake)
|
||||||
set(PROJECT_BUILD_NAME "Rika Charlie" CACHE STRING "" FORCE)
|
set(PROJECT_BUILD_NAME "Satoko Bravo" CACHE STRING "" FORCE)
|
||||||
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE)
|
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT 2ship)
|
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT 2ship)
|
||||||
@@ -32,7 +32,7 @@ endif()
|
|||||||
set(GFX_DEBUG_DISASSEMBLER ON)
|
set(GFX_DEBUG_DISASSEMBLER ON)
|
||||||
|
|
||||||
# Tell LUS we're using F3DEX_GBI_2 (in a way that doesn't break libgfxd)
|
# Tell LUS we're using F3DEX_GBI_2 (in a way that doesn't break libgfxd)
|
||||||
set(USE_F3DEX2 ON)
|
set(GBI_UCODE F3DEX_GBI_2)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Set target arch type if empty. Visual studio solution generator provides it.
|
# Set target arch type if empty. Visual studio solution generator provides it.
|
||||||
|
|||||||
+1
-1
Submodule OTRExporter updated: e8f93ff692...1cbb1b65dd
@@ -0,0 +1,239 @@
|
|||||||
|
# Building 2 Ship 2 Harkinian
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
|
||||||
|
Requires:
|
||||||
|
* At least 8GB of RAM (machines with 4GB have seen complier failures)
|
||||||
|
* Visual Studio 2022 Community Edition with the C++ feature set
|
||||||
|
* One of the Windows SDKs that comes with Visual Studio, for example the current Windows 10 version 10.0.19041.0
|
||||||
|
* The `MSVC v143 - VS 2022 C++ build tools` component of Visual Studio
|
||||||
|
* Python 3 (can be installed manually or as part of Visual Studio)
|
||||||
|
* Git (can be installed manually or as part of Visual Studio)
|
||||||
|
* Cmake (can be installed via chocolatey or manually)
|
||||||
|
|
||||||
|
During installation, check the "Desktop development with C++" feature set:
|
||||||
|
|
||||||
|

|
||||||
|
Doing so should also check one of the Windows SDKs by default. Then, in the installation details in the right-hand column, make sure you also check the v143 toolset. This is often done by default.
|
||||||
|
|
||||||
|
It is recommended that you install Python and Git standalone, the install process in VS Installer has given some issues in the past.
|
||||||
|
|
||||||
|
1. Clone the 2 Ship 2 Harkinian repository
|
||||||
|
|
||||||
|
_Note: Be sure to either clone with the ``--recursive`` flag or do ``git submodule update --init`` after cloning to pull in the libultraship submodule!_
|
||||||
|
|
||||||
|
2. After setup and initial build, use the built-in O2R extraction to make your mm.o2r file.
|
||||||
|
|
||||||
|
_Note: Instructions assume using powershell_
|
||||||
|
```powershell
|
||||||
|
# Navigate to the 2ship2harkinian repo within powershell. ie: cd "C:\yourpath\2ship2harkinian"
|
||||||
|
cd 2ship2harkinian
|
||||||
|
|
||||||
|
# Setup cmake project
|
||||||
|
# Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging
|
||||||
|
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64
|
||||||
|
|
||||||
|
# Generate 2ship.o2r
|
||||||
|
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target Generate2ShipOtr
|
||||||
|
|
||||||
|
# Compile project
|
||||||
|
# Add `--config Release` if you're packaging
|
||||||
|
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64
|
||||||
|
|
||||||
|
# Now you can run the executable in .\build\x64 or run in Visual Studio
|
||||||
|
```
|
||||||
|
|
||||||
|
### Developing 2S2H
|
||||||
|
With the cmake build system you have two options for working on the project:
|
||||||
|
|
||||||
|
#### Visual Studio
|
||||||
|
To develop using Visual Studio you only need to use cmake to generate the solution file:
|
||||||
|
```powershell
|
||||||
|
# Generates 2s2h.sln at `build/x64` for Visual Studio 2022
|
||||||
|
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Visual Studio Code or another editor
|
||||||
|
To develop using Visual Studio Code or another editor you only need to open the repository in it.
|
||||||
|
To build you'll need to follow the instructions from the building section.
|
||||||
|
|
||||||
|
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
|
||||||
|
|
||||||
|
_Experimental: You can also use another build system entirely rather than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._
|
||||||
|
|
||||||
|
|
||||||
|
### Generating the distributable
|
||||||
|
After compiling the project you can generate the distributable by running:
|
||||||
|
```powershell
|
||||||
|
# Go to build folder
|
||||||
|
cd "build/x64"
|
||||||
|
# Generate
|
||||||
|
& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP
|
||||||
|
```
|
||||||
|
|
||||||
|
### Additional CMake Targets
|
||||||
|
#### Clean
|
||||||
|
```powershell
|
||||||
|
# If you need to clean the project you can run
|
||||||
|
C:\Program Files\CMake\bin\cmake.exe --build build-cmake --target clean
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Regenerate Asset Headers
|
||||||
|
```powershell
|
||||||
|
# If you need to regenerate the asset headers to check them into source
|
||||||
|
C:\Program Files\CMake\bin\cmake.exe --build build-cmake --target ExtractAssetHeaders
|
||||||
|
```
|
||||||
|
|
||||||
|
## Linux
|
||||||
|
### Install dependencies
|
||||||
|
#### Debian/Ubuntu
|
||||||
|
```sh
|
||||||
|
# using gcc
|
||||||
|
apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev
|
||||||
|
|
||||||
|
# or using clang
|
||||||
|
apt-get install clang git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev
|
||||||
|
```
|
||||||
|
#### Arch
|
||||||
|
```sh
|
||||||
|
# using gcc
|
||||||
|
pacman -S gcc git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost
|
||||||
|
|
||||||
|
# or using clang
|
||||||
|
pacman -S clang git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost
|
||||||
|
```
|
||||||
|
#### Fedora
|
||||||
|
```sh
|
||||||
|
# using gcc
|
||||||
|
dnf install gcc gcc-c++ git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools nlohmann-json-devel tinyxml2-devel spdlog-devel boost-devel
|
||||||
|
|
||||||
|
# or using clang
|
||||||
|
dnf install clang git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools nlohmann-json-devel tinyxml2-devel spdlog-devel boost-devel
|
||||||
|
```
|
||||||
|
#### openSUSE
|
||||||
|
```sh
|
||||||
|
# using gcc
|
||||||
|
zypper in gcc gcc-c++ git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel
|
||||||
|
|
||||||
|
# or using clang
|
||||||
|
zypper in clang libstdc++-devel git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
_Note: If you're using Visual Studio Code, the [CMake Tools plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repo and enter the directory
|
||||||
|
git clone https://github.com/HarbourMasters/2ship2harkinian.git
|
||||||
|
cd 2ship2harkinian
|
||||||
|
|
||||||
|
# Clone the submodules
|
||||||
|
git submodule update --init
|
||||||
|
|
||||||
|
# Generate Ninja project
|
||||||
|
# Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging
|
||||||
|
# Add `-DPython3_EXECUTABLE=$(which python3)` if you are using non-standard Python installations such as PyEnv
|
||||||
|
cmake -H. -Bbuild-cmake -GNinja
|
||||||
|
|
||||||
|
# Generate 2ship.o2r
|
||||||
|
cmake --build build-cmake --target Generate2ShipOtr
|
||||||
|
|
||||||
|
# Compile the project
|
||||||
|
# Add `--config Release` if you're packaging
|
||||||
|
cmake --build build-cmake
|
||||||
|
|
||||||
|
# Now you can run the executable in ./build-cmake/mm/2s2h.elf
|
||||||
|
# To develop the project open the repository in VSCode (or your preferred editor)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Generate a distributable
|
||||||
|
After compiling the project you can generate a distributable by running of the following:
|
||||||
|
```bash
|
||||||
|
# Go to build folder
|
||||||
|
cd build-cmake
|
||||||
|
# Generate
|
||||||
|
cpack -G DEB
|
||||||
|
cpack -G ZIP
|
||||||
|
cpack -G External (creates appimage)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Additional CMake Targets
|
||||||
|
#### Clean
|
||||||
|
```bash
|
||||||
|
# If you need to clean the project you can run
|
||||||
|
cmake --build build-cmake --target clean
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Regenerate Asset Headers
|
||||||
|
```bash
|
||||||
|
# If you need to regenerate the asset headers to check them into source
|
||||||
|
cmake --build build-cmake --target ExtractAssetHeaders
|
||||||
|
```
|
||||||
|
|
||||||
|
## macOS
|
||||||
|
Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, ninja, cmake, nlohmann-json, libzip` (can be installed via homebrew, macports, etc)
|
||||||
|
|
||||||
|
**Important: For maximum performance make sure you have ninja build tools installed!**
|
||||||
|
|
||||||
|
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repo
|
||||||
|
git clone https://github.com/HarbourMasters/2ship2harkinian.git
|
||||||
|
cd 2ship2harkinian
|
||||||
|
# Clone the submodule libultraship
|
||||||
|
git submodule update --init
|
||||||
|
|
||||||
|
# Generate Ninja project
|
||||||
|
# Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging
|
||||||
|
cmake -H. -Bbuild-cmake -GNinja
|
||||||
|
|
||||||
|
# Generate 2ship.o2r
|
||||||
|
cmake --build build-cmake --target Generate2ShipOtr
|
||||||
|
|
||||||
|
# Compile the project
|
||||||
|
# Add `--config Release` if you're packaging
|
||||||
|
cmake --build build-cmake
|
||||||
|
|
||||||
|
# Now you can run the executable file:
|
||||||
|
./build-cmake/mm/2s2h-macos
|
||||||
|
# To develop the project open the repository in VSCode (or your preferred editor)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Generating a distributable
|
||||||
|
After compiling the project you can generate a distributable by running of the following:
|
||||||
|
```bash
|
||||||
|
# Go to build folder
|
||||||
|
cd build-cmake
|
||||||
|
# Generate
|
||||||
|
cpack
|
||||||
|
```
|
||||||
|
|
||||||
|
### Additional CMake Targets
|
||||||
|
#### Clean
|
||||||
|
```bash
|
||||||
|
# If you need to clean the project you can run
|
||||||
|
cmake --build build-cmake --target clean
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Regenerate Asset Headers
|
||||||
|
```bash
|
||||||
|
# If you need to regenerate the asset headers to check them into source
|
||||||
|
cmake --build build-cmake --target ExtractAssetHeaders
|
||||||
|
```
|
||||||
|
|
||||||
|
# Compatible Roms
|
||||||
|
See [`supportedHashes.json`](supportedHashes.json)
|
||||||
|
|
||||||
|
## Getting CI to work on your fork
|
||||||
|
|
||||||
|
The CI works via [Github Actions](https://github.com/features/actions) where we mostly make use of machines hosted by Github; except for the very first step of the CI process called "Extract assets". This steps extracts assets from the game file and generates an "assets" folder in `mm/`.
|
||||||
|
|
||||||
|
To get this step working on your fork, you'll need to add a machine to your own repository as a self-hosted runner via "Settings > Actions > Runners" in your repository settings. Make sure to add the 'asset-builder' tag to your newly added runner to assign it to run this step. To setup your runner as a service read the docs [here](https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service?platform=linux).
|
||||||
|
|
||||||
|
### Runner on Windows
|
||||||
|
You'll have to enable the ability to run unsigned scripts through PowerShell. To do this, open Powershell as administrator and run `set-executionpolicy remotesigned`. Most dependencies get installed as part of the CI process. You will also need to separately install 7z and add it to the PATH so `7z` can be run as a command. [Chocolatey](https://chocolatey.org/) or other package managers can be used to install it easily.
|
||||||
|
|
||||||
|
### Runner on UNIX systems
|
||||||
|
If you're on macOS or Linux take a look at `macports-deps.txt` or `apt-deps.txt` to see the dependencies expected to be on your machine.
|
||||||
@@ -7,4 +7,4 @@
|
|||||||
"name": "NTSC-U GC",
|
"name": "NTSC-U GC",
|
||||||
"sha1": "9743aa026e9269b339eb0e3044cd5830a440c1fd"
|
"sha1": "9743aa026e9269b339eb0e3044cd5830a440c1fd"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+1
-1
Submodule libultraship updated: e2f0264218...e823c0fa72
+42
-14
@@ -8,6 +8,7 @@
|
|||||||
#include <Fast3D/gfx_pc.h>
|
#include <Fast3D/gfx_pc.h>
|
||||||
#include "UIWidgets.hpp"
|
#include "UIWidgets.hpp"
|
||||||
#include "HudEditor.h"
|
#include "HudEditor.h"
|
||||||
|
#include "Notification.h"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "graphic/Fast3D/gfx_metal.h"
|
#include "graphic/Fast3D/gfx_metal.h"
|
||||||
@@ -20,6 +21,9 @@
|
|||||||
#include "include/global.h"
|
#include "include/global.h"
|
||||||
#include "include/z64audio.h"
|
#include "include/z64audio.h"
|
||||||
|
|
||||||
|
#include "Enhancements/Trackers/ItemTracker.h"
|
||||||
|
#include "Enhancements/Trackers/ItemTrackerSettings.h"
|
||||||
|
|
||||||
namespace BenGui {
|
namespace BenGui {
|
||||||
// MARK: - Delegates
|
// MARK: - Delegates
|
||||||
|
|
||||||
@@ -27,7 +31,6 @@ std::shared_ptr<BenMenuBar> mBenMenuBar;
|
|||||||
|
|
||||||
std::shared_ptr<Ship::GuiWindow> mConsoleWindow;
|
std::shared_ptr<Ship::GuiWindow> mConsoleWindow;
|
||||||
std::shared_ptr<Ship::GuiWindow> mStatsWindow;
|
std::shared_ptr<Ship::GuiWindow> mStatsWindow;
|
||||||
std::shared_ptr<Ship::GuiWindow> mInputEditorWindow;
|
|
||||||
std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow;
|
std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow;
|
||||||
|
|
||||||
std::shared_ptr<SaveEditorWindow> mSaveEditorWindow;
|
std::shared_ptr<SaveEditorWindow> mSaveEditorWindow;
|
||||||
@@ -35,6 +38,11 @@ std::shared_ptr<HudEditorWindow> mHudEditorWindow;
|
|||||||
std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
|
std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
|
||||||
std::shared_ptr<CollisionViewerWindow> mCollisionViewerWindow;
|
std::shared_ptr<CollisionViewerWindow> mCollisionViewerWindow;
|
||||||
std::shared_ptr<EventLogWindow> mEventLogWindow;
|
std::shared_ptr<EventLogWindow> mEventLogWindow;
|
||||||
|
std::shared_ptr<BenMenu> mBenMenu;
|
||||||
|
std::shared_ptr<BenInputEditorWindow> mBenInputEditorWindow;
|
||||||
|
std::shared_ptr<Notification::Window> mNotificationWindow;
|
||||||
|
std::shared_ptr<ItemTrackerWindow> mItemTrackerWindow;
|
||||||
|
std::shared_ptr<ItemTrackerSettingsWindow> mItemTrackerSettingsWindow;
|
||||||
|
|
||||||
void SetupGuiElements() {
|
void SetupGuiElements() {
|
||||||
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
|
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
|
||||||
@@ -47,7 +55,7 @@ void SetupGuiElements() {
|
|||||||
mBenMenuBar = std::make_shared<BenMenuBar>(CVAR_MENU_BAR_OPEN, CVarGetInteger(CVAR_MENU_BAR_OPEN, 0));
|
mBenMenuBar = std::make_shared<BenMenuBar>(CVAR_MENU_BAR_OPEN, CVarGetInteger(CVAR_MENU_BAR_OPEN, 0));
|
||||||
gui->SetMenuBar(std::reinterpret_pointer_cast<Ship::GuiMenuBar>(mBenMenuBar));
|
gui->SetMenuBar(std::reinterpret_pointer_cast<Ship::GuiMenuBar>(mBenMenuBar));
|
||||||
|
|
||||||
if (gui->GetMenuBar() && !gui->GetMenuBar()->IsVisible()) {
|
if (!gui->GetMenuBar() && !CVarGetInteger("gSettings.DisableMenuShortcutNotify", 0)) {
|
||||||
#if defined(__SWITCH__) || defined(__WIIU__) || defined(__ANDROID__)
|
#if defined(__SWITCH__) || defined(__WIIU__) || defined(__ANDROID__)
|
||||||
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press - to access enhancements menu");
|
gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Press - to access enhancements menu");
|
||||||
#else
|
#else
|
||||||
@@ -55,6 +63,9 @@ void SetupGuiElements() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mBenMenu = std::make_shared<BenMenu>("gWindows.Menu", "Settings Menu");
|
||||||
|
gui->SetMenu(mBenMenu);
|
||||||
|
|
||||||
mStatsWindow = gui->GetGuiWindow("Stats");
|
mStatsWindow = gui->GetGuiWindow("Stats");
|
||||||
if (mStatsWindow == nullptr) {
|
if (mStatsWindow == nullptr) {
|
||||||
SPDLOG_ERROR("Could not find stats window");
|
SPDLOG_ERROR("Could not find stats window");
|
||||||
@@ -65,43 +76,60 @@ void SetupGuiElements() {
|
|||||||
SPDLOG_ERROR("Could not find console window");
|
SPDLOG_ERROR("Could not find console window");
|
||||||
}
|
}
|
||||||
|
|
||||||
mInputEditorWindow = gui->GetGuiWindow("Input Editor");
|
|
||||||
if (mInputEditorWindow == nullptr) {
|
|
||||||
SPDLOG_ERROR("Could not find input editor window");
|
|
||||||
}
|
|
||||||
|
|
||||||
mGfxDebuggerWindow = gui->GetGuiWindow("GfxDebuggerWindow");
|
mGfxDebuggerWindow = gui->GetGuiWindow("GfxDebuggerWindow");
|
||||||
if (mGfxDebuggerWindow == nullptr) {
|
if (mGfxDebuggerWindow == nullptr) {
|
||||||
SPDLOG_ERROR("Could not find input GfxDebuggerWindow");
|
SPDLOG_ERROR("Could not find input GfxDebuggerWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
mSaveEditorWindow = std::make_shared<SaveEditorWindow>("gWindows.SaveEditor", "Save Editor");
|
mBenInputEditorWindow = std::make_shared<BenInputEditorWindow>("gWindows.BenInputEditor", "2S2H Input Editor");
|
||||||
|
gui->AddGuiWindow(mBenInputEditorWindow);
|
||||||
|
|
||||||
|
mSaveEditorWindow = std::make_shared<SaveEditorWindow>("gWindows.SaveEditor", "Save Editor", ImVec2(480, 600));
|
||||||
gui->AddGuiWindow(mSaveEditorWindow);
|
gui->AddGuiWindow(mSaveEditorWindow);
|
||||||
|
|
||||||
mHudEditorWindow = std::make_shared<HudEditorWindow>("gWindows.HudEditor", "Hud Editor");
|
mHudEditorWindow = std::make_shared<HudEditorWindow>("gWindows.HudEditor", "HUD Editor", ImVec2(480, 600));
|
||||||
gui->AddGuiWindow(mHudEditorWindow);
|
gui->AddGuiWindow(mHudEditorWindow);
|
||||||
|
|
||||||
mActorViewerWindow = std::make_shared<ActorViewerWindow>("gWindows.ActorViewer", "Actor Viewer");
|
mActorViewerWindow = std::make_shared<ActorViewerWindow>("gWindows.ActorViewer", "Actor Viewer", ImVec2(520, 600));
|
||||||
gui->AddGuiWindow(mActorViewerWindow);
|
gui->AddGuiWindow(mActorViewerWindow);
|
||||||
|
|
||||||
mCollisionViewerWindow = std::make_shared<CollisionViewerWindow>("gWindows.CollisionViewer", "Collision Viewer");
|
mCollisionViewerWindow =
|
||||||
|
std::make_shared<CollisionViewerWindow>("gWindows.CollisionViewer", "Collision Viewer", ImVec2(390, 475));
|
||||||
gui->AddGuiWindow(mCollisionViewerWindow);
|
gui->AddGuiWindow(mCollisionViewerWindow);
|
||||||
|
|
||||||
mEventLogWindow = std::make_shared<EventLogWindow>("gWindows.EventLog", "Event Log");
|
mEventLogWindow = std::make_shared<EventLogWindow>("gWindows.EventLog", "Event Log", ImVec2(520, 600));
|
||||||
gui->AddGuiWindow(mEventLogWindow);
|
gui->AddGuiWindow(mEventLogWindow);
|
||||||
|
|
||||||
|
mItemTrackerWindow = std::make_shared<ItemTrackerWindow>("gWindows.ItemTracker", "Item Tracker");
|
||||||
|
gui->AddGuiWindow(mItemTrackerWindow);
|
||||||
|
|
||||||
|
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>("gWindows.ItemTrackerSettings",
|
||||||
|
"Item Tracker Settings", ImVec2(800, 400));
|
||||||
|
gui->AddGuiWindow(mItemTrackerSettingsWindow);
|
||||||
|
gui->SetPadBtnTogglesMenu();
|
||||||
|
|
||||||
|
mNotificationWindow = std::make_shared<Notification::Window>("gWindows.Notifications", "Notifications Window");
|
||||||
|
gui->AddGuiWindow(mNotificationWindow);
|
||||||
|
mNotificationWindow->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Destroy() {
|
void Destroy() {
|
||||||
|
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
|
||||||
|
|
||||||
|
gui->RemoveAllGuiWindows();
|
||||||
mBenMenuBar = nullptr;
|
mBenMenuBar = nullptr;
|
||||||
|
mBenMenu = nullptr;
|
||||||
mStatsWindow = nullptr;
|
mStatsWindow = nullptr;
|
||||||
mConsoleWindow = nullptr;
|
mConsoleWindow = nullptr;
|
||||||
mInputEditorWindow = nullptr;
|
mBenInputEditorWindow = nullptr;
|
||||||
mGfxDebuggerWindow = nullptr;
|
mGfxDebuggerWindow = nullptr;
|
||||||
mCollisionViewerWindow = nullptr;
|
mCollisionViewerWindow = nullptr;
|
||||||
mEventLogWindow = nullptr;
|
mEventLogWindow = nullptr;
|
||||||
|
mNotificationWindow = nullptr;
|
||||||
mSaveEditorWindow = nullptr;
|
mSaveEditorWindow = nullptr;
|
||||||
mHudEditorWindow = nullptr;
|
mHudEditorWindow = nullptr;
|
||||||
mActorViewerWindow = nullptr;
|
mActorViewerWindow = nullptr;
|
||||||
|
mItemTrackerWindow = nullptr;
|
||||||
|
mItemTrackerSettingsWindow = nullptr;
|
||||||
}
|
}
|
||||||
} // namespace BenGui
|
} // namespace BenGui
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user