-
Notifications
You must be signed in to change notification settings - Fork 14
SDL3 upgrade #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Berstanio
wants to merge
13
commits into
libgdx:master
Choose a base branch
from
Berstanio:feat/sdl3-lwjgl3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
SDL3 upgrade #47
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9a5c49e
feat(desktop): Initial translation
Berstanio 9e162b9
feat(desktop): Minor fixes
Berstanio b12b760
chore: License notice
Berstanio e87229a
feat: Remove armeabi
Berstanio e3c48b1
feat: libGDX 1.13.1 requires androidX
Berstanio eb4a194
fix: Bump random versions to fix weird android compile error
Berstanio fcb27f5
feat: Run CI on JDK 17, required by android
Berstanio 4ed9ecd
fix: Fix removed method use `isCatchBackKey`
Berstanio d4faf0d
chore: Unused import
Berstanio f42c67d
fix: Fix old ordinal references
Berstanio 90173eb
feat: Remove lwjgl2 tests
Berstanio 2662380
feat: Define lwjgl3 dependencies
Berstanio e85b726
chore: Update robovm
Berstanio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,18 @@ | ||
Jamepad | ||
Copyright (C) 2016 William Hartman | ||
|
||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
|
||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
|
||
1. The origin of this software must not be misrepresented; you must not | ||
claim that you wrote the original software. If you use this software | ||
in a product, an acknowledgment in the product documentation would be | ||
appreciated but is not required. | ||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source distribution. |
This file contains hidden or 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 hidden or 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 hidden or 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,6 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.badlogicgames.gdx.controllers"> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application/> | ||
</manifest> |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
27 changes: 27 additions & 0 deletions
27
...controllers-desktop/src/main/java/com/badlogic/gdx/controllers/desktop/Configuration.java
This file contains hidden or 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,27 @@ | ||
package com.badlogic.gdx.controllers.desktop; | ||
|
||
import com.badlogic.gdx.controllers.ControllerManager; | ||
|
||
/** | ||
* Class defining the configuration of a {@link ControllerManager}. | ||
* | ||
* @author Benjamin Schulte | ||
*/ | ||
public class Configuration { | ||
/** | ||
* The max number of controllers the ControllerManager should deal with | ||
*/ | ||
public int maxNumControllers = 4; | ||
|
||
/** | ||
* Use RawInput implementation instead of XInput on Windows, if applicable. Enable this if you | ||
* need to use more than four XInput controllers at once. Comes with drawbacks. | ||
*/ | ||
public boolean useRawInput = false; | ||
|
||
/** | ||
* Disable this to return to legacy temporary file loading of database file. | ||
*/ | ||
public boolean loadDatabaseInMemory = true; | ||
} | ||
|
This file contains hidden or 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: 46 additions & 0 deletions
46
...rs-desktop/src/main/java/com/badlogic/gdx/controllers/desktop/support/ControllerAxis.java
This file contains hidden or 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,46 @@ | ||
package com.badlogic.gdx.controllers.desktop.support; | ||
|
||
import org.lwjgl.sdl.SDLGamepad; | ||
|
||
/** | ||
* The list of axes available on a gamepad | ||
* | ||
* Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to | ||
* SDL_JOYSTICK_AXIS_MAX, and are centered within ~8000 of zero, though | ||
* advanced UI will allow users to set or autodetect the dead zone, which | ||
* varies between gamepads. | ||
* | ||
* Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX (fully | ||
* pressed) when reported by SDL_GetGamepadAxis(). Note that this is not the | ||
* same range that will be reported by the lower-level SDL_GetJoystickAxis(). | ||
*/ | ||
public enum ControllerAxis { | ||
INVALID(SDLGamepad.SDL_GAMEPAD_AXIS_INVALID), | ||
LEFTX(SDLGamepad.SDL_GAMEPAD_AXIS_LEFTX), | ||
LEFTY(SDLGamepad.SDL_GAMEPAD_AXIS_LEFTY), | ||
RIGHTX(SDLGamepad.SDL_GAMEPAD_AXIS_RIGHTX), | ||
RIGHTY(SDLGamepad.SDL_GAMEPAD_AXIS_RIGHTY), | ||
LEFT_TRIGGER(SDLGamepad.SDL_GAMEPAD_AXIS_LEFT_TRIGGER), | ||
RIGHT_TRIGGER(SDLGamepad.SDL_GAMEPAD_AXIS_RIGHT_TRIGGER),; | ||
|
||
public static final ControllerAxis[] VALUES = values(); | ||
|
||
private final int id; | ||
|
||
ControllerAxis(int id) { | ||
this.id = id; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public static ControllerAxis getById(int id) { | ||
for (ControllerAxis axis : VALUES) { | ||
if (axis.id == id) | ||
return axis; | ||
} | ||
|
||
return null; | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
...-desktop/src/main/java/com/badlogic/gdx/controllers/desktop/support/ControllerButton.java
This file contains hidden or 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,77 @@ | ||
package com.badlogic.gdx.controllers.desktop.support; | ||
|
||
import org.lwjgl.sdl.SDLGamepad; | ||
|
||
/** | ||
* The list of buttons available on a gamepad | ||
* | ||
* For controllers that use a diamond pattern for the face buttons, the | ||
* south/east/west/north buttons below correspond to the locations in the | ||
* diamond pattern. For Xbox controllers, this would be A/B/X/Y, for Nintendo | ||
* Switch controllers, this would be B/A/Y/X, for GameCube controllers this | ||
* would be A/X/B/Y, for PlayStation controllers this would be | ||
* Cross/Circle/Square/Triangle. | ||
* | ||
* For controllers that don't use a diamond pattern for the face buttons, the | ||
* south/east/west/north buttons indicate the buttons labeled A, B, C, D, or | ||
* 1, 2, 3, 4, or for controllers that aren't labeled, they are the primary, | ||
* secondary, etc. buttons. | ||
* | ||
* The activate action is often the south button and the cancel action is | ||
* often the east button, but in some regions this is reversed, so your game | ||
* should allow remapping actions based on user preferences. | ||
* | ||
* You can query the labels for the face buttons using | ||
* SDL_GetGamepadButtonLabel() | ||
* */ | ||
public enum ControllerButton { | ||
|
||
INVALID(SDLGamepad.SDL_GAMEPAD_BUTTON_INVALID), | ||
SOUTH(SDLGamepad.SDL_GAMEPAD_BUTTON_SOUTH), /** Bottom face button (e.g. Xbox A button) */ | ||
EAST(SDLGamepad.SDL_GAMEPAD_BUTTON_EAST), /** Right face button (e.g. Xbox B button) */ | ||
WEST(SDLGamepad.SDL_GAMEPAD_BUTTON_WEST), /** Left face button (e.g. Xbox X button) */ | ||
NORTH(SDLGamepad.SDL_GAMEPAD_BUTTON_NORTH), /** Top face button (e.g. Xbox Y button) */ | ||
BACK(SDLGamepad.SDL_GAMEPAD_BUTTON_BACK), | ||
GUIDE(SDLGamepad.SDL_GAMEPAD_BUTTON_GUIDE), | ||
START(SDLGamepad.SDL_GAMEPAD_BUTTON_START), | ||
LEFT_STICK(SDLGamepad.SDL_GAMEPAD_BUTTON_LEFT_STICK), | ||
RIGHT_STICK(SDLGamepad.SDL_GAMEPAD_BUTTON_RIGHT_STICK), | ||
LEFT_SHOULDER(SDLGamepad.SDL_GAMEPAD_BUTTON_LEFT_SHOULDER), | ||
RIGHT_SHOULDER(SDLGamepad.SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER), | ||
DPAD_UP(SDLGamepad.SDL_GAMEPAD_BUTTON_DPAD_UP), | ||
DPAD_DOWN(SDLGamepad.SDL_GAMEPAD_BUTTON_DPAD_DOWN), | ||
DPAD_LEFT(SDLGamepad.SDL_GAMEPAD_BUTTON_DPAD_LEFT), | ||
DPAD_RIGHT(SDLGamepad.SDL_GAMEPAD_BUTTON_DPAD_RIGHT), | ||
MISC1(SDLGamepad.SDL_GAMEPAD_BUTTON_MISC1), /** Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button) */ | ||
RIGHT_PADDLE1(SDLGamepad.SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1), /** Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1) */ | ||
LEFT_PADDLE1(SDLGamepad.SDL_GAMEPAD_BUTTON_LEFT_PADDLE1), /** Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3) */ | ||
RIGHT_PADDLE2(SDLGamepad.SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2), /** Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2) */ | ||
LEFT_PADDLE2(SDLGamepad.SDL_GAMEPAD_BUTTON_LEFT_PADDLE2), /** Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4) */ | ||
TOUCHPAD(SDLGamepad.SDL_GAMEPAD_BUTTON_TOUCHPAD), /** PS4/PS5 touchpad button */ | ||
MISC2(SDLGamepad.SDL_GAMEPAD_BUTTON_MISC2), /** Additional button */ | ||
MISC3(SDLGamepad.SDL_GAMEPAD_BUTTON_MISC3), /** Additional button */ | ||
MISC4(SDLGamepad.SDL_GAMEPAD_BUTTON_MISC4), /** Additional button */ | ||
MISC5(SDLGamepad.SDL_GAMEPAD_BUTTON_MISC5), /** Additional button */ | ||
MISC6(SDLGamepad.SDL_GAMEPAD_BUTTON_MISC6),; /** Additional button */ | ||
|
||
public static final ControllerButton[] VALUES = values(); | ||
|
||
private final int id; | ||
|
||
ControllerButton(int id) { | ||
this.id = id; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public static ControllerButton getById(int id) { | ||
for (ControllerButton button : VALUES) { | ||
if (button.id == id) | ||
return button; | ||
} | ||
|
||
return null; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...top/src/main/java/com/badlogic/gdx/controllers/desktop/support/ControllerButtonLabel.java
This file contains hidden or 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,45 @@ | ||
package com.badlogic.gdx.controllers.desktop.support; | ||
|
||
import org.lwjgl.sdl.SDLGamepad; | ||
|
||
/** | ||
* The set of gamepad button labels | ||
* | ||
* This isn't a complete set, just the face buttons to make it easy to show | ||
* button prompts. | ||
* | ||
* For a complete set, you should look at the button and gamepad type and have | ||
* a set of symbols that work well with your art style. | ||
*/ | ||
public enum ControllerButtonLabel { | ||
UNKNOWN(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN), | ||
A(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_A), | ||
B(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_B), | ||
X(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_X), | ||
Y(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_Y), | ||
CROSS(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_CROSS), | ||
CIRCLE(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_CIRCLE), | ||
SQUARE(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_SQUARE), | ||
TRIANGLE(SDLGamepad.SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE),; | ||
|
||
public static final ControllerButtonLabel[] VALUES = values(); | ||
|
||
private final int id; | ||
|
||
ControllerButtonLabel(int id) { | ||
this.id = id; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public static ControllerButtonLabel getById(int id) { | ||
for (ControllerButtonLabel label : VALUES) { | ||
if (label.id == id) | ||
return label; | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the snapshot version needed? Not good to have this library point to a snapshot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the moment yes, so I would only merge this after a stable lwjgl3 release exists.