diff --git a/fcore/core-key.sml b/fcore/core-key.sml index bec6cfe..bcad545 100644 --- a/fcore/core-key.sml +++ b/fcore/core-key.sml @@ -134,6 +134,7 @@ sig , down: key_code , jump: key_code , attack: key_code + , escape: key_code } val keyFromString: string -> key_code option @@ -275,6 +276,7 @@ struct , down: key_code , jump: key_code , attack: key_code + , escape: key_code } fun keyFromString str = diff --git a/fcore/frame-input-type.sml b/fcore/frame-input-type.sml index 0b32e49..e850cc4 100644 --- a/fcore/frame-input-type.sml +++ b/fcore/frame-input-type.sml @@ -7,5 +7,6 @@ struct , downHeld: bool , attackHeld: bool , jumpHeld: bool + , escapeHeld: bool } end diff --git a/fcore/level/player/player.sml b/fcore/level/player/player.sml index ff8e326..4c5a350 100644 --- a/fcore/level/player/player.sml +++ b/fcore/level/player/player.sml @@ -206,7 +206,15 @@ struct , ... } = player - val {leftHeld, rightHeld, upHeld, downHeld, attackHeld, jumpHeld} = input + val + { leftHeld + , rightHeld + , upHeld + , downHeld + , attackHeld + , jumpHeld + , escapeHeld + } = input val xAxis = getXAxis (leftHeld, rightHeld) val facing = getFacing (facing, xAxis) diff --git a/fcore/options/options-type.sml b/fcore/options/options-type.sml new file mode 100644 index 0000000..c980b84 --- /dev/null +++ b/fcore/options/options-type.sml @@ -0,0 +1,4 @@ +structure OptionsType = +struct + datatype focus = +end diff --git a/shell/gl-draw.sml b/shell/gl-draw.sml index 486dbb1..7ed07a4 100644 --- a/shell/gl-draw.sml +++ b/shell/gl-draw.sml @@ -304,6 +304,7 @@ struct , down = CoreKey.KEY_DOWN , jump = CoreKey.KEY_Z , attack = CoreKey.KEY_X + , escape = CoreKey.KEY_ESCAPE } val () = InputState.setControls controls diff --git a/shell/input-state.sml b/shell/input-state.sml index 88d118e..abbf34e 100644 --- a/shell/input-state.sml +++ b/shell/input-state.sml @@ -7,6 +7,7 @@ struct , up = CoreKey.KEY_E , attack = CoreKey.KEY_J , jump = CoreKey.KEY_K + , escape = CoreKey.KEY_ESCAPE } fun setControls controls = keyMappings := controls @@ -19,6 +20,7 @@ struct , downHeld = ref false , jumpHeld = ref false , attackHeld = ref false + , escapeHeld = ref false , width = ref (1920.0 : Real32.real) , height = ref (1080.0 : Real32.real) } @@ -30,6 +32,7 @@ struct , downHeld = !(#downHeld state) , attackHeld = !(#attackHeld state) , jumpHeld = !(#jumpHeld state) + , escapeHeld = !(#escapeHeld state) } (* there are three action states reported by OS: PRESS, REPEAT and RELEASE. @@ -40,7 +43,7 @@ struct case GlfwKeyMap.codeFromKey key of SOME code => let - val {left, right, down, up, attack, jump} = !keyMappings + val {left, right, down, up, attack, jump, escape} = !keyMappings val action = actionToBool action in if code = left then #leftHeld state := action @@ -49,6 +52,7 @@ struct else if code = down then #downHeld state := action else if code = attack then #attackHeld state := action else if code = jump then #jumpHeld state := action + else if code = escape then #escapeHeld state := action else () end | NONE => () diff --git a/shell/parse-controls.sml b/shell/parse-controls.sml index 3c2f26c..9ff67a2 100644 --- a/shell/parse-controls.sml +++ b/shell/parse-controls.sml @@ -103,6 +103,7 @@ struct , down = down , jump = jump , attack = attack + , escape = CoreKey.KEY_ESCAPE } | _ => NONE end