diff --git a/browser/src/CrossPlatform/AI.fs b/browser/src/CrossPlatform/AI.fs index 0ad7b76..0946800 100644 --- a/browser/src/CrossPlatform/AI.fs +++ b/browser/src/CrossPlatform/AI.fs @@ -268,12 +268,27 @@ let getNextState canSeePlayer game enemy = else enemy | _ -> enemy + +// This conversion required because FSharp do not play +// along with NativeAOT inside interpolated strings + enums. +// Be explicit about how to display strings. +let getStateString state = + match state with + | EnemyStateType.Standing -> "Standing" + | EnemyStateType.Ambushing -> "Ambushing" + | EnemyStateType.Attack -> "Attack" + | EnemyStateType.Path -> "Path" + | EnemyStateType.Pain -> "Pain" + | EnemyStateType.Shoot -> "Shoot" + | (EnemyStateType.Chase (x,y)) -> $"Chase ({x},{y})" + | EnemyStateType.Die -> "Die" + | EnemyStateType.Dead -> "Dead" let preProcess canSeePlayer (enemy,game) = // preprocess looks for state changes based on the current game world state let newEnemy = enemy |> getNextState canSeePlayer game //if newEnemy.State <> enemy.State then - // Utils.log $"Enemy at {enemy.BasicGameObject.Position.vX}, {enemy.BasicGameObject.Position.vY} moving from {enemy.State} to {newEnemy.State}" + // Utils.log $"Enemy at {enemy.BasicGameObject.Position.vX}, {enemy.BasicGameObject.Position.vY} moving from {getStateString enemy.State} to {getStateString newEnemy.State}" (newEnemy,game) // this is loosely based on T_Shoot in WL_ACT2.C diff --git a/desktop/FSharp.Core.rd.xml b/desktop/FSharp.Core.rd.xml new file mode 100644 index 0000000..fdcbfac --- /dev/null +++ b/desktop/FSharp.Core.rd.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/desktop/FSharpWolfenstein.Desktop.fsproj b/desktop/FSharpWolfenstein.Desktop.fsproj index c3c662c..9bffd58 100644 --- a/desktop/FSharpWolfenstein.Desktop.fsproj +++ b/desktop/FSharpWolfenstein.Desktop.fsproj @@ -2,8 +2,12 @@ Exe + net6.0 true + true + true + link false @@ -368,5 +372,9 @@ + + + + diff --git a/desktop/Program.fs b/desktop/Program.fs index bf9219c..55f98e3 100644 --- a/desktop/Program.fs +++ b/desktop/Program.fs @@ -267,6 +267,8 @@ let main _ = let mutable options = WindowOptions.Default options.Size <- Vector2D(int(float screenWidth * zoom),int (float screenHeight * zoom)) options.Title <- "F# Wolfenstein" + Silk.NET.Input.Sdl.SdlInput.RegisterPlatform() + Silk.NET.Input.Glfw.GlfwInput.RegisterPlatform() let window = Window.Create(options) window.add_Load (load window) window.add_Render render