Skip to content

Commit

Permalink
- add actions to support changing volume and gamma using keyboard
Browse files Browse the repository at this point in the history
- fix getKeyCode error
- add wsad keyboard shortcuts for directional arrows to gamefiles for Android
  • Loading branch information
dgengin committed Jun 26, 2016
1 parent 9c4b630 commit f8425a3
Show file tree
Hide file tree
Showing 19 changed files with 352 additions and 70 deletions.
4 changes: 2 additions & 2 deletions gamefiles/towners/adria/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/towners/drunk/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/towners/gillian/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/towners/healer/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/towners/smith/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/towners/strytell/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/towners/townboy/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/towners/twnf/panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
"key": "down",
"key": ["down", "s"],
"action": "focus.moveDown"
}
],
Expand Down
4 changes: 2 additions & 2 deletions gamefiles/ui/level/charPanelQuests.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"action": "focus.click"
},
{
"key": "up",
"key": ["up", "w"],
"action": "focus.moveUp"
},
{
Expand All @@ -27,7 +27,7 @@
"action": "focus.moveUp"
},
{
"key": ["down", "tab"],
"key": ["down", "s", "tab"],
"action": "focus.moveDown"
},
{
Expand Down
188 changes: 160 additions & 28 deletions gamefiles/ui/level/gameMenu2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,95 @@
{
"action": { "name": "resource.add", "id": "gameMenu2" },
"action": [
{ "name": "resource.add", "id": "gameMenu2" },
{
"name": "action.set",
"id": "updateAudioProgressBar",
"action": [
{ "name": "drawable.resizeToPositionX", "id": "progressBar1", "idToPosition": "option1", "offset": 14 },
{ "name": "game.setProperty", "property": "musicVolume", "value": "|progressBar1|size.x|", "propRange": [0, 100], "valueRange": [14, 270] },
{
"name": "if.equal",
"param1": "|game|musicVolume|",
"param2": 0,
"then": { "name": "audio.stop", "id": "main" },
"else": { "name": "audio.play", "id": "main" }
}
]
},
{
"name": "action.set",
"id": "updateSoundProgressBar",
"action": [
{ "name": "drawable.resizeToPositionX", "id": "progressBar2", "idToPosition": "option2", "offset": 14 },
{ "name": "game.setProperty", "property": "soundVolume", "value": "|progressBar2|size.x|", "propRange": [0, 100], "valueRange": [14, 270] }
]
},
{
"name": "action.set",
"id": "updateGammaProgressBar",
"action": { "name": "drawable.resizeToPositionX", "id": "progressBar3", "idToPosition": "option3", "offset": 14 }
}
],
"action": [
{
"name": "action.set",
"id": "updateAudioUpKeyboardShortcut",
"action": [
{ "name": "drawable.moveStepX", "id": "option1", "idAnchorTo": "progressBar1", "range": 283, "steps": 17, "stepOffset": 1 },
"updateAudioProgressBar"
]
},
{
"name": "action.set",
"id": "updateAudioDownKeyboardShortcut",
"action": [
{ "name": "drawable.moveStepX", "id": "option1", "idAnchorTo": "progressBar1", "range": 283, "steps": 17, "stepOffset": -1 },
"updateAudioProgressBar"
]
},
{
"name": "action.set",
"id": "updateSoundUpKeyboardShortcut",
"action": [
{ "name": "drawable.moveStepX", "id": "option2", "idAnchorTo": "progressBar2", "range": 283, "steps": 17, "stepOffset": 1 },
"updateSoundProgressBar"
]
},
{
"name": "action.set",
"id": "updateSoundDownKeyboardShortcut",
"action": [
{ "name": "drawable.moveStepX", "id": "option2", "idAnchorTo": "progressBar2", "range": 283, "steps": 17, "stepOffset": -1 },
"updateSoundProgressBar"
]
},
{
"name": "action.set",
"id": "updateGammaUpKeyboardShortcut",
"action": [
{ "name": "drawable.moveStepX", "id": "option3", "idAnchorTo": "progressBar3", "range": 283, "steps": 15, "stepOffset": 1 },
"updateGammaProgressBar"
]
},
{
"name": "action.set",
"id": "updateGammaDownKeyboardShortcut",
"action": [
{ "name": "drawable.moveStepX", "id": "option3", "idAnchorTo": "progressBar3", "range": 283, "steps": 15, "stepOffset": -1 },
"updateGammaProgressBar"
]
}
],
"keyboard": [
{
"key": ["a", "left"],
"action": "updateAudioDownKeyboardShortcut"
},
{
"key": ["d", "right"],
"action": "updateAudioUpKeyboardShortcut"
}
],
"texture": [
{
"id": "optbar",
Expand Down Expand Up @@ -80,86 +170,128 @@
"textureRect": [283, 28],
"position": [263, 121],
"anchor": "none",
"sound": "titlemov",
"onClick": [
{ "name": "button.click", "id": "music", "playSound": false },
{ "name": "drawable.centerOnMouseX", "id": "option1", "idAnchorTo": "progressBar1", "range": 283, "steps": 17 },
{ "name": "drawable.resizeToPositionX", "id": "progressBar1", "idToPosition": "option1", "offset": 14 },
{ "name": "game.setProperty", "property": "musicVolume", "value": "|progressBar1|size.x|", "propRange": [0, 100], "valueRange": [14, 270] },
{
"name": "if.equal",
"param1": "|game|musicVolume|",
"param2": 0,
"then": { "name": "audio.stop", "id": "main" },
"else": { "name": "audio.play", "id": "main" }
}
"updateAudioProgressBar"
],
"onClickDrag": { "name": "button.click", "id": "btnOption1" }
"onClickDrag": { "name": "button.click", "id": "btnOption1", "playSound": false }
},
{
"id": "btnOption2",
"texture": "empty",
"textureRect": [283, 28],
"position": [263, 166],
"anchor": "none",
"sound": "titlemov",
"onClick": [
{ "name": "button.click", "id": "sound", "playSound": false },
{ "name": "drawable.centerOnMouseX", "id": "option2", "idAnchorTo": "progressBar2", "range": 283, "steps": 17 },
{ "name": "drawable.resizeToPositionX", "id": "progressBar2", "idToPosition": "option2", "offset": 14 },
{ "name": "game.setProperty", "property": "soundVolume", "value": "|progressBar2|size.x|", "propRange": [0, 100], "valueRange": [14, 270] }
"updateSoundProgressBar"
],
"onClickDrag": { "name": "button.click", "id": "btnOption2" }
"onClickDrag": { "name": "button.click", "id": "btnOption2", "playSound": false }
},
{
"id": "btnOption3",
"texture": "empty",
"textureRect": [283, 28],
"position": [263, 211],
"anchor": "none",
"sound": "titlemov",
"onClick": [
{ "name": "button.click", "id": "gamma", "playSound": false },
{ "name": "drawable.centerOnMouseX", "id": "option3", "idAnchorTo": "progressBar3", "range": 283, "steps": 15 },
{ "name": "drawable.resizeToPositionX", "id": "progressBar3", "idToPosition": "option3", "offset": 14 }
"updateGammaProgressBar"
],
"onClickDrag": { "name": "button.click", "id": "btnOption3" }
"onClickDrag": { "name": "button.click", "id": "btnOption3", "playSound": false }
},
{
"id": "music",
"bitmapFont": "bigtgold",
"sound": "titlemov",
"focus": true,
"focusSound": "titlemov",
"focusOnClick": false,
"text": "Music",
"position": [75, 116],
"anchor": "none",
"onFocus": [
"onClick": [
"anchorLeftPentagram",
{ "name": "drawable.anchor", "id": "pent2", "idAnchor": "optbar1", "anchor": "right" }
]
{ "name": "drawable.anchor", "id": "pent2", "idAnchor": "optbar1", "anchor": "right" },
{ "name": "loadJson",
"json": {
"keyboard": [
{
"key": ["a", "left"],
"action": "updateAudioDownKeyboardShortcut"
},
{
"key": ["d", "right"],
"action": "updateAudioUpKeyboardShortcut"
}
]
}
}
],
"onFocus": { "name": "button.click", "id": "music" }
},
{
"id": "sound",
"bitmapFont": "bigtgold",
"sound": "titlemov",
"focus": true,
"focusSound": "titlemov",
"focusOnClick": false,
"text": "Sound",
"position": [75, 161],
"anchor": "none",
"onFocus": [
"onClick": [
"anchorLeftPentagram",
{ "name": "drawable.anchor", "id": "pent2", "idAnchor": "optbar2", "anchor": "right" }
]
{ "name": "drawable.anchor", "id": "pent2", "idAnchor": "optbar2", "anchor": "right" },
{ "name": "loadJson",
"json": {
"keyboard": [
{
"key": ["a", "left"],
"action": "updateSoundDownKeyboardShortcut"
},
{
"key": ["d", "right"],
"action": "updateSoundUpKeyboardShortcut"
}
]
}
}
],
"onFocus": { "name": "button.click", "id": "sound" }
},
{
"id": "gamma",
"bitmapFont": "bigtgold",
"sound": "titlemov",
"focus": true,
"focusSound": "titlemov",
"focusOnClick": false,
"text": "Gamma",
"position": [75, 206],
"anchor": "none",
"onFocus": [
"onClick": [
"anchorLeftPentagram",
{ "name": "drawable.anchor", "id": "pent2", "idAnchor": "optbar3", "anchor": "right" }
]
{ "name": "drawable.anchor", "id": "pent2", "idAnchor": "optbar3", "anchor": "right" },
{ "name": "loadJson",
"json": {
"keyboard": [
{
"key": ["a", "left"],
"action": "updateGammaDownKeyboardShortcut"
},
{
"key": ["d", "right"],
"action": "updateGammaUpKeyboardShortcut"
}
]
}
}
],
"onFocus": { "name": "button.click", "id": "gamma" }
},
{
"id": "colorCycling",
Expand Down
Loading

0 comments on commit f8425a3

Please sign in to comment.