forked from PojavLauncherTeam/PojavLauncher
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
also lower ram useage to 4GB from 8GB, hopefully this doesn't cause any issues
- Loading branch information
Showing
24 changed files
with
1,056 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
open_collective: pojavlauncher | ||
patreon: pojavlauncher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...auncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/DefaultDataProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.kdt.pojavlaunch.customcontrols.gamepad; | ||
|
||
import net.kdt.pojavlaunch.GrabListener; | ||
|
||
import org.lwjgl.glfw.CallbackBridge; | ||
|
||
public class DefaultDataProvider implements GamepadDataProvider { | ||
public static final DefaultDataProvider INSTANCE = new DefaultDataProvider(); | ||
|
||
// Cannot instantiate this class publicly | ||
private DefaultDataProvider() {} | ||
|
||
@Override | ||
public GamepadMap getGameMap() { | ||
return GamepadMapStore.getGameMap(); | ||
} | ||
|
||
|
||
@Override | ||
public GamepadMap getMenuMap() { | ||
return GamepadMapStore.getMenuMap(); | ||
} | ||
|
||
@Override | ||
public boolean isGrabbing() { | ||
return CallbackBridge.isGrabbing(); | ||
} | ||
|
||
@Override | ||
public void attachGrabListener(GrabListener grabListener) { | ||
CallbackBridge.addGrabListener(grabListener); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 15 additions & 31 deletions
46
...pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/GamepadButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,30 @@ | ||
package net.kdt.pojavlaunch.customcontrols.gamepad; | ||
|
||
import android.view.KeyEvent; | ||
|
||
/** | ||
* Simple button able to store its state and some properties | ||
* This class corresponds to a button that does exist on the gamepad | ||
*/ | ||
public class GamepadButton { | ||
|
||
public int[] keycodes; | ||
public class GamepadButton extends GamepadEmulatedButton { | ||
public boolean isToggleable = false; | ||
private boolean mIsDown = false; | ||
private boolean mIsToggled = false; | ||
|
||
public void update(KeyEvent event){ | ||
boolean isKeyDown = (event.getAction() == KeyEvent.ACTION_DOWN); | ||
update(isKeyDown); | ||
} | ||
|
||
public void update(boolean isKeyDown){ | ||
if(isKeyDown != mIsDown){ | ||
mIsDown = isKeyDown; | ||
if(isToggleable){ | ||
if(isKeyDown){ | ||
mIsToggled = !mIsToggled; | ||
Gamepad.sendInput(keycodes, mIsToggled); | ||
} | ||
return; | ||
} | ||
Gamepad.sendInput(keycodes, mIsDown); | ||
@Override | ||
protected void onDownStateChanged(boolean isDown) { | ||
if(isToggleable && isDown){ | ||
mIsToggled = !mIsToggled; | ||
Gamepad.sendInput(keycodes, mIsToggled); | ||
return; | ||
} | ||
super.onDownStateChanged(isDown); | ||
} | ||
|
||
public void resetButtonState(){ | ||
if(mIsDown || mIsToggled){ | ||
@Override | ||
public void resetButtonState() { | ||
if(!mIsDown && mIsToggled) { | ||
Gamepad.sendInput(keycodes, false); | ||
mIsToggled = false; | ||
} else { | ||
super.resetButtonState(); | ||
} | ||
mIsDown = false; | ||
mIsToggled = false; | ||
} | ||
|
||
public boolean isDown(){ | ||
return isToggleable ? mIsToggled : mIsDown; | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
...auncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/GamepadDataProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package net.kdt.pojavlaunch.customcontrols.gamepad; | ||
|
||
import net.kdt.pojavlaunch.GrabListener; | ||
|
||
public interface GamepadDataProvider { | ||
GamepadMap getMenuMap(); | ||
GamepadMap getGameMap(); | ||
boolean isGrabbing(); | ||
void attachGrabListener(GrabListener grabListener); | ||
} |
Oops, something went wrong.