Skip to content

Instantly share code, notes, and snippets.

@meganehouser
Last active December 18, 2015 23:19
Show Gist options
  • Save meganehouser/5860288 to your computer and use it in GitHub Desktop.
Save meganehouser/5860288 to your computer and use it in GitHub Desktop.
Delta Engine の Sample/Empty Game を F# に移植
open DeltaEngine.Core
open DeltaEngine.Datatypes
open DeltaEngine.Platforms
type EmptyGame() =
let mutable fadePercentage = 0.0f
let mutable currentColor = Color.Black
let mutable nextColor = Color.Black
let SwitchNextRandomColor() =
currentColor <- nextColor
nextColor <- Color.GetRandomColor()
fadePercentage <- 0.f
let run (window:Window) =
fadePercentage <- fadePercentage + Time.Current.Delta
if fadePercentage >= 1.0f then
SwitchNextRandomColor()
window.BackgroundColor <- Color.Lerp(currentColor, nextColor, fadePercentage)
interface Runner<Window> with
member this.Run(window) = run window
member this.Run(window) = run window
module Program =
[<EntryPoint>]
[<CompiledName("Main")>]
let main argv =
let app = new App()
app.Start<EmptyGame>()
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment