2019-10-16 18:39:18 +00:00
|
|
|
//
|
|
|
|
// NextTetrominoesView.swift
|
|
|
|
// Tetris
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 10/16/19.
|
|
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import TetrisKit
|
|
|
|
|
|
|
|
public struct NextTetromioesView: View {
|
2019-10-21 03:52:15 +00:00
|
|
|
let size: CGFloat
|
2019-10-16 18:39:18 +00:00
|
|
|
let tetrominoes: [Tetromino]
|
|
|
|
|
2019-10-21 03:52:15 +00:00
|
|
|
public init(size: CGFloat, tetrominoes: [Tetromino]) {
|
|
|
|
self.size = size
|
2019-10-16 18:39:18 +00:00
|
|
|
self.tetrominoes = tetrominoes
|
|
|
|
}
|
|
|
|
|
|
|
|
public var body: some View {
|
|
|
|
VStack {
|
|
|
|
ForEach(0..<self.tetrominoes.count, id: \.self) { (index) in
|
2019-10-21 03:52:15 +00:00
|
|
|
TetrominoView(size: self.size / 4, tetromino: self.tetrominoes[index]).aspectRatio(1, contentMode: .fit)
|
2019-10-16 18:39:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NextTetrominoesView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
2019-10-21 03:52:15 +00:00
|
|
|
NextTetromioesView(size: 50, tetrominoes: [.t, .l, .z])
|
2019-10-16 18:39:18 +00:00
|
|
|
}
|
|
|
|
}
|