Last active
December 18, 2015 23:19
-
-
Save meganehouser/5860288 to your computer and use it in GitHub Desktop.
Delta Engine の Sample/Empty Game を F# に移植
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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