Last active
October 29, 2021 01:27
-
-
Save vikingosegundo/01cf7790104cd582ef8cee63a526bcd9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import SwiftUI | |
@main | |
struct SnakeApp:App { | |
var body:some Scene { | |
WindowGroup { | |
ZStack { | |
Color.black | |
.edgesIgnoringSafeArea(.all) | |
ContentView(state:ViewState( | |
game:createGame(size: (90,50))), | |
pixelFactor:5.0) | |
} | |
} | |
} | |
} | |
final class ViewState:ObservableObject { | |
@Published var game:Game | |
@Published var target:Coordinate? | |
init(game g:Game) { | |
game = g | |
game.register { self.game = g } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment