thread time through update functions so it can be used
This commit is contained in:
@@ -2,13 +2,13 @@ structure GameUpdate =
|
|||||||
struct
|
struct
|
||||||
open GameType
|
open GameType
|
||||||
|
|
||||||
fun update (game: GameType.game_type, input) =
|
fun update (game: GameType.game_type, input, time) =
|
||||||
let
|
let
|
||||||
val {mode, userKeys} = game
|
val {mode, userKeys} = game
|
||||||
in
|
in
|
||||||
case mode of
|
case mode of
|
||||||
LEVEL level => LevelUpdate.update (level, input, userKeys)
|
LEVEL level => LevelUpdate.update (level, input, userKeys, time)
|
||||||
| TITLE title => TitleUpdate.update (title, input, userKeys)
|
| TITLE title => TitleUpdate.update (title, input, userKeys, time)
|
||||||
| OPTIONS options => OptionsUpdate.update (options, input, userKeys)
|
| OPTIONS options => OptionsUpdate.update (options, input, userKeys, time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
structure LevelUpdate =
|
structure LevelUpdate =
|
||||||
struct
|
struct
|
||||||
fun update (level, input, userKeys) =
|
fun update (level, input, userKeys, time) =
|
||||||
let
|
let
|
||||||
val
|
val
|
||||||
{ player
|
{ player
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ struct
|
|||||||
fun withFocus (newFocus, userKeys) =
|
fun withFocus (newFocus, userKeys) =
|
||||||
{mode = GameType.OPTIONS {focus = newFocus}, userKeys = userKeys}
|
{mode = GameType.OPTIONS {focus = newFocus}, userKeys = userKeys}
|
||||||
|
|
||||||
fun update (options, input: FrameInputType.t, userKeys) =
|
fun update (options, input: FrameInputType.t, userKeys, time) =
|
||||||
case #focus options of
|
case #focus options of
|
||||||
LEFT_KEY =>
|
LEFT_KEY =>
|
||||||
if #downHeld input then withFocus (RIGHT_KEY, userKeys)
|
if #downHeld input then withFocus (RIGHT_KEY, userKeys)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ structure TitleUpdate =
|
|||||||
struct
|
struct
|
||||||
open TitleType
|
open TitleType
|
||||||
|
|
||||||
fun update (titleState, input: FrameInputType.t, userKeys) =
|
fun update (titleState, input: FrameInputType.t, userKeys, time) =
|
||||||
case #focus titleState of
|
case #focus titleState of
|
||||||
START_BUTTON =>
|
START_BUTTON =>
|
||||||
let
|
let
|
||||||
|
|||||||
@@ -293,8 +293,9 @@ struct
|
|||||||
val _ = Gles3.clearColor (1.0, 1.0, 1.0, 1.0)
|
val _ = Gles3.clearColor (1.0, 1.0, 1.0, 1.0)
|
||||||
val _ = Gles3.clear ()
|
val _ = Gles3.clear ()
|
||||||
|
|
||||||
|
val time = Glfw.getTime ()
|
||||||
val input = InputState.getSnapshot ()
|
val input = InputState.getSnapshot ()
|
||||||
val game = GameUpdate.update (game, input)
|
val game = GameUpdate.update (game, input, time)
|
||||||
|
|
||||||
val shellState = drawMode (shellState, game)
|
val shellState = drawMode (shellState, game)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user