add non-configurable escape button to input type, to be used as a way to go backwards or exit menu
This commit is contained in:
@@ -134,6 +134,7 @@ sig
|
|||||||
, down: key_code
|
, down: key_code
|
||||||
, jump: key_code
|
, jump: key_code
|
||||||
, attack: key_code
|
, attack: key_code
|
||||||
|
, escape: key_code
|
||||||
}
|
}
|
||||||
|
|
||||||
val keyFromString: string -> key_code option
|
val keyFromString: string -> key_code option
|
||||||
@@ -275,6 +276,7 @@ struct
|
|||||||
, down: key_code
|
, down: key_code
|
||||||
, jump: key_code
|
, jump: key_code
|
||||||
, attack: key_code
|
, attack: key_code
|
||||||
|
, escape: key_code
|
||||||
}
|
}
|
||||||
|
|
||||||
fun keyFromString str =
|
fun keyFromString str =
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ struct
|
|||||||
, downHeld: bool
|
, downHeld: bool
|
||||||
, attackHeld: bool
|
, attackHeld: bool
|
||||||
, jumpHeld: bool
|
, jumpHeld: bool
|
||||||
|
, escapeHeld: bool
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -206,7 +206,15 @@ struct
|
|||||||
, ...
|
, ...
|
||||||
} = player
|
} = player
|
||||||
|
|
||||||
val {leftHeld, rightHeld, upHeld, downHeld, attackHeld, jumpHeld} = input
|
val
|
||||||
|
{ leftHeld
|
||||||
|
, rightHeld
|
||||||
|
, upHeld
|
||||||
|
, downHeld
|
||||||
|
, attackHeld
|
||||||
|
, jumpHeld
|
||||||
|
, escapeHeld
|
||||||
|
} = input
|
||||||
|
|
||||||
val xAxis = getXAxis (leftHeld, rightHeld)
|
val xAxis = getXAxis (leftHeld, rightHeld)
|
||||||
val facing = getFacing (facing, xAxis)
|
val facing = getFacing (facing, xAxis)
|
||||||
|
|||||||
4
fcore/options/options-type.sml
Normal file
4
fcore/options/options-type.sml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
structure OptionsType =
|
||||||
|
struct
|
||||||
|
datatype focus =
|
||||||
|
end
|
||||||
@@ -304,6 +304,7 @@ struct
|
|||||||
, down = CoreKey.KEY_DOWN
|
, down = CoreKey.KEY_DOWN
|
||||||
, jump = CoreKey.KEY_Z
|
, jump = CoreKey.KEY_Z
|
||||||
, attack = CoreKey.KEY_X
|
, attack = CoreKey.KEY_X
|
||||||
|
, escape = CoreKey.KEY_ESCAPE
|
||||||
}
|
}
|
||||||
|
|
||||||
val () = InputState.setControls controls
|
val () = InputState.setControls controls
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ struct
|
|||||||
, up = CoreKey.KEY_E
|
, up = CoreKey.KEY_E
|
||||||
, attack = CoreKey.KEY_J
|
, attack = CoreKey.KEY_J
|
||||||
, jump = CoreKey.KEY_K
|
, jump = CoreKey.KEY_K
|
||||||
|
, escape = CoreKey.KEY_ESCAPE
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setControls controls = keyMappings := controls
|
fun setControls controls = keyMappings := controls
|
||||||
@@ -19,6 +20,7 @@ struct
|
|||||||
, downHeld = ref false
|
, downHeld = ref false
|
||||||
, jumpHeld = ref false
|
, jumpHeld = ref false
|
||||||
, attackHeld = ref false
|
, attackHeld = ref false
|
||||||
|
, escapeHeld = ref false
|
||||||
, width = ref (1920.0 : Real32.real)
|
, width = ref (1920.0 : Real32.real)
|
||||||
, height = ref (1080.0 : Real32.real)
|
, height = ref (1080.0 : Real32.real)
|
||||||
}
|
}
|
||||||
@@ -30,6 +32,7 @@ struct
|
|||||||
, downHeld = !(#downHeld state)
|
, downHeld = !(#downHeld state)
|
||||||
, attackHeld = !(#attackHeld state)
|
, attackHeld = !(#attackHeld state)
|
||||||
, jumpHeld = !(#jumpHeld state)
|
, jumpHeld = !(#jumpHeld state)
|
||||||
|
, escapeHeld = !(#escapeHeld state)
|
||||||
}
|
}
|
||||||
|
|
||||||
(* there are three action states reported by OS: PRESS, REPEAT and RELEASE.
|
(* there are three action states reported by OS: PRESS, REPEAT and RELEASE.
|
||||||
@@ -40,7 +43,7 @@ struct
|
|||||||
case GlfwKeyMap.codeFromKey key of
|
case GlfwKeyMap.codeFromKey key of
|
||||||
SOME code =>
|
SOME code =>
|
||||||
let
|
let
|
||||||
val {left, right, down, up, attack, jump} = !keyMappings
|
val {left, right, down, up, attack, jump, escape} = !keyMappings
|
||||||
val action = actionToBool action
|
val action = actionToBool action
|
||||||
in
|
in
|
||||||
if code = left then #leftHeld state := action
|
if code = left then #leftHeld state := action
|
||||||
@@ -49,6 +52,7 @@ struct
|
|||||||
else if code = down then #downHeld state := action
|
else if code = down then #downHeld state := action
|
||||||
else if code = attack then #attackHeld state := action
|
else if code = attack then #attackHeld state := action
|
||||||
else if code = jump then #jumpHeld state := action
|
else if code = jump then #jumpHeld state := action
|
||||||
|
else if code = escape then #escapeHeld state := action
|
||||||
else ()
|
else ()
|
||||||
end
|
end
|
||||||
| NONE => ()
|
| NONE => ()
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ struct
|
|||||||
, down = down
|
, down = down
|
||||||
, jump = jump
|
, jump = jump
|
||||||
, attack = attack
|
, attack = attack
|
||||||
|
, escape = CoreKey.KEY_ESCAPE
|
||||||
}
|
}
|
||||||
| _ => NONE
|
| _ => NONE
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user