-
Notifications
You must be signed in to change notification settings - Fork 124
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
Partially adapted MainGameScreen to use NUI #588
Partially adapted MainGameScreen to use NUI #588
Conversation
fbb5ef1
to
80c43d2
Compare
80c43d2
to
b404ec4
Compare
…atedButton to activate buttons on a given key press. Fixed tutorial.
The controls are now accessed directly from the ShipUIControl interface instead.
Also added some extra JavaDoc to the code.
The ideal solution with NUI would be to scale the widgets with a RelativeLayout or similar widget but for now this works. Multi-touch support requires additional NUI changes that will need to be merged separately.
The "NUI UI Scale" option is now also shown on Android.
6909c6d
to
3bcbbd9
Compare
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.
Have tested this fairly thoroughly - very nice job, as usual!
Looked over the code, no particular comments there other than realizing that I guess we don't have a newer NUI release available, just snapshots
After chat on Discord I know these two be pre-existing issues:
- Mouse clicking on the in-game right side menu seems to have input consumption quirks - screens may open then immediately re-close and/or I can provoke that behavior deeper in screens if I leave a "bad click" live - just once then everything is fine
- ESC closes the main menu and exits the game. Huh. That seems kinda severe
- The "Shoot" binding doesn't show up if you are in mouse/keyboard mode. I figure it might be better if we do show them but keep them locked/disabled if we want to highlight that they're not changeable for the current mode
- Zoom in/out still seems broken on the map, I know this has come up a few times but I guess we still don't have a bug report issue or a fix yet 😅
Specific to this PR (and related to subset PR #605)
- The
SolButtonsTestScreen.java
may only exist in the other PR although in theory this PR covers both? - Rebinding controls seem to break input in-game. Gets better in some cases after restarting, but there's something off (actively being looked at as I write this yay!) - this does seem to work in
develop
Overall even without the controls rebinding working I'm happy to merge this whenever, that sounds like an easy separate fix and this PR is plenty big as is. I figure high odds it isn't an architectural-level problem and an easy thing to resolve later.
Awesome!
@@ -27,7 +27,7 @@ allprojects { | |||
appName = 'DestinationSol' | |||
gdxVersion = '1.9.8' | |||
roboVMVersion = '2.3.3' | |||
nuiVersion = '3.0.0-SNAPSHOT' | |||
nuiVersion = '3.1.0-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.
I guess this is still accurate? I don't see a v3.1 release yet. Thought maybe we had gone past that by now.
Can confirm the rebinding fix and have made issues for my other comments to remember - merging! :-) |
Description
This pull request mostly serves as an example of how to port existing UI screens to use NUI. It partially ports one of the more significant in-game UI screens, the
MainGameScreen
. This screen was responsible for rendering the in-game HUD, warn-drawers and overlays. This pull request also includes a port of theShipKbControl
screen in its entirety, which is used for the touchscreen controls.The following elements of the HUD have been ported to use NUI:
The following elements are still using the pre-existing UI system:
The code here mostly works, however some features are broken due to existing issues in NUI's LibGDX input back-end. Some of these issues could be resolved by porting MovingBlocks/TeraNUI#24 to NUI 2.0 but others will require the
org.terasology.nui.backends.libgdx.NUIInputProcessor
class to be re-written.Testing
Keyboard+Mouse controls
Menu button
Menu
button and the pause menu should be shownescape
keyMap button
Map
button and the map screen should be shownescape
keyItems button
Items
button and a list of the player's current inventory items should be shownTalk button
Talk
button and the talk screen should be shownMercs button
Mercs
button and the mercenaries screen should be shownTutorial
Keyboard controls
Changing key bindings
Options->Controls
menuMap
key toQ
Shoot
key toLeft-Alt
Menu button
escape
key and the pause menu should be shownResume
buttonMap button
Q
key and the map screen should be shown [this isn't currently working]escape
keyItems button
i
key and the items screen should be shownTalk button
t
key and the talk screen should be shownMercs button
m
key and the mercenaries screen should be shownTutorial
Touchscreen controls
emulateMobile
setting set totrue
indebugOptions.ini
but I have primarily tested this on AndroidLeft button
Left
button and the ship should turn leftRight button
Right
button and the ship should turn rightForward button
Fwd
button and the ship should fly forwardsGun 1 button
Gun 1
button and the left gun should fireGun 2 button
Gun 2
button and the right gun should fireAbility button
Ability
button and the player ship's ability should activateTutorial
Outstanding Work
Notes
nui-libgdx
input codeScaledFontProducer
class introduced here is independent of these changes but is used by the new UI screens. It produces scaled variants of fonts using the fragment part of the ResourceUrn e.g.engine:main#2.0
would be theengine:main
font scaled by a factor of 2x. It should be possible to introduce it separately in a different pull request though.Visual Changes
Some comparisons of the UI before and after these changes. The desktop screenshots are using a window resolution of 1024x768. The "Research" button is part of the warp module and so is not modified by these changes.
Desktop
Before
After
Android
Before
After