Skip to content
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

Add 'Set Controls' UI to Preferences Screen #212

Open
ethanms opened this issue Mar 23, 2014 · 5 comments
Open

Add 'Set Controls' UI to Preferences Screen #212

ethanms opened this issue Mar 23, 2014 · 5 comments

Comments

@ethanms
Copy link
Contributor

ethanms commented Mar 23, 2014

Add option to Preferences Screen for 'Set Controls'--

First pass at what should be shown on Set Controls:

  1. Drop List labeled "Control Set" which contains three options: "Default", "User Defined 1" and "User Defined 2"; changing the drop list will cause the values for Item 2 below to be refreshed

  2. A set of JButtons and JLabels, each button will have the name of the item to be controlled, and each label will show a text representation of the current control. Examples: Button = "Fire", Label = "Space" ... Button "Forward", Label = "W". Behaviors:
    2a) When 'Default' is the selected drop list item the buttons will cause a dialog to appear which says "Select a User Defined Control Set First".
    2b) When a user defined control set is selected and a button is pushed a dialog will appear that says "Press the button for this control", there will also be a label showing the current control and OK/CANCEL buttons. While the dialog is up, the label will change to show whatever key/button has been last pushed. When the OK button is pressed the dialog will disappear and the set of controls will now reflect the updated control button. If CANCEL is pressed the dialog will dismiss and the set of controls will remain unchanged.

  3. Buttons for APPLY, SAVE and CANCEL. APPLY will cause the currently set controls to be valid for this instance of the game. SAVE will cause the set of controls to be saved as either User Defined 1 or User Defined 2 whichever is selected. SAVE is not available when 'Default' is shown. CANCEL will dismiss the dialog.

The list of controls:
Tank "Forward"
Tank "Rotate Clockwise"
Tank "Rotate Counter-Clockwise"
Tank "Slow/Stop"
Tank "Fire"
Tank "Lay Mine"
Engineer "Build Road"
Engineer "Build Mine"
Engineer "Build Wall"
Engineer "Build Pillbox"
Engineer "Harvest Tree"

Note, we have two options for Laying Mines, one is Tank which means the mine is dropped behind the tank and the other is Engineer which implies the engineer will run out from the tank to lay the mine.

To start I'm not sure if we will have Engineer options working?

@ethanms ethanms self-assigned this Mar 23, 2014
@ethanms
Copy link
Contributor Author

ethanms commented Mar 24, 2014

image

@ethanms
Copy link
Contributor Author

ethanms commented Mar 24, 2014

Mocked up panel above, please provide any comments/questions

@ChristopherCanfield
Copy link
Member

This looks awesome! Very professional.

On 3/23/2014 10:45 PM, Ethan Schwartz wrote:

image
https://f.cloud.github.com/assets/6492032/2495634/56d091ce-b2fe-11e3-80cc-31b795185415.png


Reply to this email directly or view it on GitHub
#212 (comment).

@ethanms
Copy link
Contributor Author

ethanms commented Mar 24, 2014

Thanks!
We should probably talk about how we intend to handle the controllers and the data here... Perhaps we switch away from default/userdefined and move to keyboard/gamepad as the options. We'll need some get/set methods in the controllers too.

@ChristopherCanfield
Copy link
Member

I think the controllers should pull from here, rather than the other way around. This is different than what I wanted with the Sound system, but that's because the sound system is a singleton that is instantiated on application startup, while the controllers are created much later. There is currently no way for external systems to access controllers, and I'd prefer to keep it that way.

Ideally, the preferences system should provide getters that return key values that match what our library expects: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Input.Keys.html. So either the preferences system or the user interface will map the strings pulled from the Set Controls screen to values usable by our underlying library. You should be able to trivially do this using Keys.valueOf(stringValue) (http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Input.Keys.html#valueOf%28java.lang.String%29) - so no need for a nasty switch or large set of if-else statements.

Once this is created, it will only take a few minutes to switch our controllers to pull the correct keys from the preferences system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants